问题描述
超级编辑:
添加广播步骤将导致两个进程打印 ncols
由主节点(从中我可以检查输出)。但为什么?我的意思是,所有的广播变量已经有一个值在他们的声明! (偏离主题)。
Adding the broadcast step, will result in ncols
to get printed by the two processes by the master node (from which I can check the output). But why? I mean, all variables that are broadcast have already a value in the line of their declaration!!! (off-topic image).
我有一些代码基于这。
我检查了集群配置是否正常, a href =http://stackoverflow.com/questions/212528/get-the-ip-address-of-the-machine>打印将运行到其上的计算机的IP :
I checked that cluster configuration is OK, with this simple program, which also printed the IP of the machine that it would run onto:
int main (int argc, char *argv[])
{
int rank, size;
MPI_Init (&argc, &argv); /* starts MPI */
MPI_Comm_rank (MPI_COMM_WORLD, &rank); /* get current process id */
MPI_Comm_size (MPI_COMM_WORLD, &size); /* get number of processes */
printf( "Hello world from process %d of %d\n", rank, size );
// removed code that printed IP address
MPI_Finalize();
return 0;
}
打印每台机器的IP两次。
which printed every machine's IP twice.
EDIT_2
如果我只打印网格,对于一台计算机:
If I print (only) the grid, like in the example, I am getting for one computer:
Processes grid pattern:
0 1
2 3
和两个:
Processes grid pattern:
推荐答案
两个节点中的可执行文件不一样!
Executables were not the same in both nodes!
有一个非常困难的时间,所以当我有一个安装问题,我只是跳过它。所以现在,更改只会出现在一个节点中。代码会奇怪,除非一些(或所有)代码是相同的。
When I configured the cluster, I had a very hard time, so when I had a problem with mounting, I just skipped it. So now, the changes would appear only in one node. The code would behave weirdly, unless some (or all) of the code was the same.
这篇关于MPI代码不能与2个节点,但与1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!