Wrong mpi number of processors

前端 未结 4 705
北荒
北荒 2021-02-11 04:39

Sorry, I\'m sure making a silly mistake, but did not work out.

I\'m compiling a simple mpi hello world:

#include 
#include 

         


        
相关标签:
4条回答
  • 2021-02-11 05:04

    In this case, you need mpiexec from the 'mpich2' package.

    Firstly, remove all mpi packages that installed on your computer. If your server is Ubuntu, you can use the command:

    sudo apt-get purge mpi mpich2 openmpi-common
    

    To make sure that you have removed all the packages, try this command

    which mpiexec
    

    If you got nothing in response, you already removed all the packages.

    Then reinstall the package of mpich2

    sudo apt-get install mpich2
    

    Try to compile and run your code again! Hope this help!

    0 讨论(0)
  • 2021-02-11 05:12

    INSTALL

    sudo apt-get install libopenmpi-dev openmpi-bin openmpi-doc
    

    Now compile and execute code

    0 讨论(0)
  • 2021-02-11 05:13

    I don't know how you can compile it:

     int main (argc, argv)
     int argc;
     char *argv[];
    

    will be changed to

     int main (int argc, char *argv[])
    

    another point is that mpi is message passing interface that passes messages between processes not cores or processors if you have a 4 core system you can run your code with so many processes as your ram permits but only 4 processes are working at any time and other processes must wait so it is efficient that you use only 4 process.

    0 讨论(0)
  • 2021-02-11 05:18

    There is nothing wrong with your code. The only problem that can be is with your mpi installation.

    Notice:

    There is a differences between processor to core. its not the same thing.

    0 讨论(0)
提交回复
热议问题