简体   繁体   中英

Mpi program run with linux

I am trying to run a mpi program but i have some problem with the installation. I get the packet from a repository and i can compile my program, but when i try to run the program i can t do it. Well, my program is a little bit biggest than an "Hello World", but my problem is with mpi library (i think so), not with the code. Here is my "Hello World" parallel (in spanish of course):

#include <stdio.h>
#include <mpi.h>

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

 MPI_Init(&argc, &argv);

 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
 MPI_Comm_size(MPI_COMM_WORLD, &size);

printf("Hola Mundo! Soy el %d de %d\n", rank, size);

MPI_Finalize();

return 0;
}

When i use mpicc appears the hola file.

mpicc hola.c -o hola

Then i run my program:

mpirun -np 5 ./hola

The output of (for @Gilles)

ls -1 hola

is just

hola

The output show from the comand line is this:

  [proxy:0:0@miMachine-LMint] HYDU_create_process 
   (./utils/launch/launch.c:75): execvp error on file hola (No such file 
  or directory)
   [proxy:0:0@miMachine-LMint] HYDU_create_process 
   (./utils/launch/launch.c:75): execvp error on file hola (No such file 
or directory)
[proxy:0:0@miMachine-LMint] HYDU_create_process 
(./utils/launch/launch.c:75): [proxy:0:0@patricio-LMint] 
HYDU_create_process (./utils/launch/launch.c:75): execvp error on file 
hola (No such file or directory)
execvp error on file hola (No such file or directory)
[proxy:0:0@miMachine-LMint] HYDU_create_process 
(./utils/launch/launch.c:75): execvp error on file hola (No such file 
or directory)




Well the thing is that i dont know what is the problem. 

When you report an issue, you should always include the command line that leads to the error message.

Anyway, it seems you ran

mpirun hola

instead of

mpirun ./hola

ok. i could make it work. I am not an expert in linux and install packages. Seems that there is a package to mpi file compile and there is another package to run mpi files. I installed the compile package and the run packege later. Then i "turned on" the run package and i could ran my program. First i got the compiler package.

apt-get install lam4-dev

Second i got the run package.

apt-get install lam-runtime

Third i turned on the run time package

lamboot

And here is my command line output. First ran the program

mpirun -np 5 ./algo

 Hola! Soy el 0 de 5 Hola! Soy el 2 de 5 Hola! Soy el 1 de 5 Hola! Soy el 3 de 5 Hola! Soy el 4 de 5 

Thanks @Gilles for your answer and sorry if i it was a rookie question and my english.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM