[mpich-discuss] Problems with MPI_Comm_spawn and MPI_Comm_get_parent

Jan Malburg nj_Brillus at gmx.de
Wed Nov 12 02:24:13 CST 2008


Hello,

I have a Problem with MPI_Comm_spawn and MPI_Comm_get_parent. As I have understand this functions can be used for adding additional Nodes at runtime. So that the old and the new Nodes share a communicate. This Communicater ist one of the return values of MPI_Comm_spawn @ the already running nodes. And at the new Nodes you can get the Communicator with MPI_Comm_get_parent.

Ich have now writen this test programm

#include "mpi.h"
#include <iostream>

using namespace std;
int main(int argc, char *argv[])
{
	//init MPI
	MPI_Init( &argc, &argv);

	// Test if the process is a spawn
	MPI_Comm spawn;
	MPI_Comm_get_parent(&spawn);
	if(spawn==MPI_COMM_NULL)
	{
		//if not a Spawn build 2 new process
		int error[2];
		MPI_Comm_spawn("C:\\Dokumente und Einstellungen\\Malburg\\Eigene Dateien\\Visual Studio Projects\\ShaderTests\\Test1\\MPI_SPAWN Test\\debug\\MPI_SPAWN Test.exe",
		MPI_ARGV_NULL,2,MPI_INFO_NULL,0,MPI_COMM_WORLD,&spawn,error);
	}

	// Get the Count and Nr of Options
	int NodeCount,NodeNumber;
	MPI_Comm_size(spawn, &NodeCount);		// determine # of mpi procs
	MPI_Comm_rank(spawn, &NodeNumber);		// get determine mpi rank of this process

	// Output
	cout <<"Before Barrier! " <<NodeNumber <<" of "<<NodeCount<<" "<<endl;
	MPI_Barrier(spawn);	

	cout <<"Before Bcast! " <<NodeNumber <<" of "<<NodeCount<<" "<<endl;
	char i;
	MPI_Bcast(&i,1,MPI_BYTE,0,spawn);

	cout <<"After Bcast! " <<NodeNumber <<" of "<<NodeCount<<" "<<endl;	
	MPI_Finalize();
	return 0;
}

The Problem is that the communicator don't work as I aspect. The Output of the Programm is the following when I Use 1.0.7:


Before Barrier! 1 of 2
Before Barrier! 0 of 2
Before Barrier! 0 of 1
Before Bcast! 0 of 2
Before Bcast! 1 of 2
Before Bcast! 0 of 1

And with 1.0.8 the output is:

Before Barrier! 0 of 1
Before Bcast! 0 of 1

In Bcast th program hangs. Barrier works over all 3 Processes that I have tested.
MPI_Comm_size and MPI_Comm_rank works if as set to their MPI_COMM_WORLD.

Can anyone tell me what I doing wrong or is their a Bug?. My System runs an Windows XP and compiled with Visual Studio 2005.

Thanks in advance,
Jan


PS: The output I would aspect is
Before Barrier! 1 of 3
Before Barrier! 2 of 3
Before Barrier! 0 of 3
Before Bcast! 0 of 3
Before Bcast! 1 of 3
Before Bcast! 2 of 3
After Bcast! 0 of 3
After Bcast! 1 of 3
After Bcast! 2 of 3

-- 
GMX Download-Spiele: Preizsturz! Alle Puzzle-Spiele Deluxe über 60% billiger.
http://games.entertainment.gmx.net/de/entertainment/games/download/puzzle/index.html



More information about the mpich-discuss mailing list