【发布时间】:2018-03-04 13:24:40
【问题描述】:
我正在实现一个应该运行主从算法的程序,主从作业将由执行参数决定。 例如:
mpirun -oversubscribe -tag-output -np 1 BioNetFit2 -a load -c parabolaA_272002678.sconf : -oversubscribe -tag-output -np 4 BioNetFit2 -t particle -p 0 -a run -c parabolaA_272002678.sconf
在这种情况下,master 将运行这部分:./BioNetFit2 -a load -c parabolaA_272002678.sconf
而slave会执行这部分:./BioNetFit2 -t particle -p 0 -a run -c parabolaA_272002678.sconf
这就是我初始化通信世界的方式:
cout << "Detected BNF2mpi in Pheromones init()" << endl;
MPI_Init(NULL, NULL);
// Get the number of processes
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
cout << "Defined mpi environment" << endl;
// Get the rank of the process
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
cout << "My rank is " << world_rank << "and I have just started." << endl;
我的问题是master发送了一条消息,slave从来没有收到,反之亦然。
所有源代码都在这里:https://github.com/raqueldias/testing_rep 这是一个大程序,是别人在boost-MPI中实现的,我的工作是将分布式消息传递功能从boost-MPI转换为MPI。
我的第一个非常基本的问题是:如果我像这样分两部分运行程序,默认情况下进程是否能够正常通信,或者我必须指定任何不同的配置才能使它们通信?
【问题讨论】:
-
请在问题中发布发送/接收部分。目前尚不清楚它的原因是什么。放更多代码以便我们检查。
-
刚刚上传了整个源代码。