Mpi程序用linux运行

时间:2017-10-08 21:25:35

标签: linux mpi

我正在尝试运行mpi程序,但我在安装时遇到了一些问题。我从存储库中获取数据包,我可以编译我的程序,但是当我尝试运行程序时,我无法完成。 好吧,我的程序比“Hello World”有点大,但我的问题是mpi库(我想是这样),而不是代码。这是我的“Hello World”并行(当然是西班牙语):

#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;
}

当我使用mpicc时出现hola文件。

  

mpicc hola.c -o hola

然后我运行我的程序:

  

mpirun -np 5 ./hola

(对于@Gilles)

的输出
  

ls -1 hola

只是

  

HOLA

来自命令行的输出显示如下:

  [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. 

2 个答案:

答案 0 :(得分:1)

报告问题时,应始终包含导致错误消息的命令行。

无论如何,你好像跑了

mpirun hola

而不是

mpirun ./hola

答案 1 :(得分:1)

确定。我可以让它工作。 我不是linux和安装包的专家。似乎有一个包到mpi文件编译,还有另一个包来运行mpi文件。我稍后安装了compile包和run packege。然后我开始&#34;运行包,我可以运行我的程序。 首先我得到了编译器包。

  

apt-get install lam4-dev

其次我得到了运行包。

  

apt-get install lam-runtime

第三,我打开了运行时包

  

lamboot

这是我的命令行输出。首先运行程序

  

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

感谢@Gilles的回答,对不起,如果我是一个菜鸟问题和我的英语。

相关问题