2017-10-08 177 views
-1

我试图运行MPI程序,但我有一些问题与安装。我从储备库中获得数据包,我可以编译我的程序,但是当我尝试运行该程序,我可以做T吧。 嗯,我的计划是一点点比最大的“Hello World”的,但我的问题是与MPI库(我想是这样),不与代码。这里是我的“你好世界”平行(当然西班牙语):MPI程序运行在Linux

#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

的输出(用于@吉勒)

LS -1ħ OLA

只是

HOLA

从COMAND线输出显示是这样的:

[proxy:0:[email protected]] HYDU_create_process 
    (./utils/launch/launch.c:75): execvp error on file hola (No such file 
    or directory) 
    [proxy:0:[email protected]] HYDU_create_process 
    (./utils/launch/launch.c:75): execvp error on file hola (No such file 
or directory) 
[proxy:0:[email protected]] HYDU_create_process 
(./utils/launch/launch.c:75): [proxy:0:[email protected]] 
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:[email protected]] 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. 

回答

0

确定。我可以让它工作。 我不是在Linux方面的专家并安装软件包。似乎有一个包mpi文件编译,并有另一个包运行mpi文件。我稍后安装了编译软件包和运行软件包。然后我“打开”运行包,我可以运行我的程序。 首先我得到了编译器包。

的apt-get安装lam4-dev的

其次,我得到了运行包。

的apt-get安装LAM-运行

三我打开运行时包

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你的回答和对不起,如果我是一个菜鸟的问题,我的英语水平。

0

在您提出的问题,您应该总是包括命令行导致错误消息。

无论如何,看来你跑

mpirun hola 

,而不是

mpirun ./hola 
+0

我用了mpirun ./hola和mpirun hola(可能有用)。抱歉,报告错误的行是。 “mpirun ./hola”或“mpirun -np 3 ./hola”,当我想使用多个进程时。 – Patricio

+0

请用你的'mpicc'和'mpirun'命令和输出编辑你的问题。你只在一台机器上运行吗? 'ls -l hola'说什么? –

+0

'ls -l'这是'ls减小写L'。您使用的是哪个发行版和MPI库?如果你'mpirun -np 5'pwd'/hola'怎么办?如果它仍然不起作用,你可以尝试'strace -f -e execve mpirun -np 5'pwd'/hola'?你能确认你只在一个节点上运行,并且在'miMachine-LMint'上调用了'mpirun'吗?如果你'ls -l hola; mpirun -np 1 ls -l hola'? –