[mpich-discuss] I: Re: Problem to run MPICH2 on Windows 7 with user interface

Rosa Brancaccio rossella_brancaccio at yahoo.it
Tue Apr 19 08:27:14 CDT 2011


Hi all,
first of all, thank you for your kind responses.
I realize that I have explained myself very badly.
I'm sorry, now I'll try to do it better :)
I can run the "hello world" program (I copy the code below) 
without problems, both as traditional executable and as parallel 
program with n processes.

#include "mpi.h"
#include <stdio.h>
#include <cstdio>
#include <cstring>

int main (int argc, char *argv[])
{

	char	txt={'\0'};
	int node;
   	
	MPI_Init(&argc,&argv);
	MPI_Comm_rank(MPI_COMM_WORLD, &node);
	printf("Hello World from Node %d\n",node);
	fflush(stdout);
	printf("press any key to exit ");
	fflush(stdout);
	scanf(" ",&txt);
	fflush(stdout);
	     
	MPI_Finalize();
	
	return 0;
}

I compiled this code both with Labwindows/CVI and Visual Studio 2010 
compiler, and I started the program by the command prompt (MSDOS windows).
Of course, running the program as traditional executable the output 
is "Hello World from Node 0".
Running the program as parallel executable (mpiexec -n 4 myapp.exe) 
the output is:
"Hello World from Node 3" 
"Hello World from Node 0" 
"Hello World from Node 1" 
"Hello World from Node 2" 
in different order any time I run it.

I tried to write the output on several files without problems. 
The program works fine both when compiled by Labwindows/CVI and 
by Visual Studio 2010. The program works fine both starting it as 
traditional executable and as parallel program (mpiexec -n 4 myapp.exe).
The code is:

int main (int argc, char *argv[])
{
	FILE*	f=NULL;
	char	path[9999]={'\0'},name[99]={'\0'};
	int node;
   
   	sprintf(path,"c:\\test\\file");

	MPI_Init(&argc,&argv);
   	MPI_Comm_rank(MPI_COMM_WORLD, &node);
	sprintf(name,"_node%d.txt",node);
	strcat(path,name);
	f=fopen(path,"a");
	fprintf(f,"Hello World from Node %d\n",node);
	fclose(f);

	fflush(NULL);
	MPI_Finalize();

	return 0;
}
The output with n processes is n files with the correct written 
"Hello World from Node X" with X from 0 to n.

The problem arises when I try to insert in my code the following line:

MessagePopup("MPICH2 TEST","Test Successfully Completed \nOK");

This line should start a small window with title "MPICH2 TEST" and 
the written "Test Successfully Completed OK" and a botton "OK" and 
the window should wait until I press the "OK" button and then it
should expire. 
The "MessagePopup" command comes from LabWindows/CVI GUI Library and 
it works fine both when compiled by CVI and by Visual Studio.
When I start this code as traditional executable the program write 
"Hello World from Node 0" and the window appears correctly.
When I run the code with mpi (calling mpiexec -n 4 myapp.exe) 
unfortunately no writtens appear, no windows starts, and the 
command prompt is locked undefinitely until I press CTRL-C to 
kill the jobs. Moreover during this test the 4 myapp exist and I
can see them in the list of windows task manager.
I tried to use the -localroot options but nothing has changed: 
the program is locked and I must press CTRL-C to kill the processes. 
Anyway this is the messages (after the CTRL_C command):
>mpiexec -n 2 -localroot MPI_test_VS.exe

mpiexec aborting job...
The thread to be suspended is no longer active, exit_code = 123
unable terminate process safely. exit_code = 123
unable to read the cmd header on the pmi context, Error = -1.
Error posting readv, Connessione in corso interrotta forzatamente dall'host remoto.(10054)
unable to read the cmd header on the pmi context, Error = -1.
Error posting readv, Connessione in corso interrotta forzatamente dall'host remoto.(10054)
job aborted:
rank: node: exit code[: error message]
0: PC-ROSSELLA: 123: mpiexec aborting job
1: PC-ROSSELLA: 255

At the end my question is: 
is there a way to use the CVI GUI library and MPI?

Thank you all and best regards

Rosa


--- Lun 18/4/11, Jayesh Krishna <jayesh at mcs.anl.gov> ha scritto:

> Da: Jayesh Krishna <jayesh at mcs.anl.gov>
> Oggetto: Re: [mpich-discuss] I: Re: Problem to run MPICH2 on Windows 7 with user interface
> A: mpich-discuss at mcs.anl.gov
> Cc: "rossella brancaccio" <rossella_brancaccio at yahoo.it>
> Data: Lunedì 18 Aprile 2011, 19:55
> Hi,
>  Did you try the "-localroot" option  (mpiexec -n 2
> -localroot myguiapp.exe)?
>  Also try running your program with mpiexec (myguiapp.exe)
> . This might reveal error messages like missing dlls etc.
> 
> Regards,
> Jayesh
> 
> ----- Original Message -----
> From: "Nicolas Rosner" <nrosner at gmail.com>
> To: mpich-discuss at mcs.anl.gov
> Cc: "rossella brancaccio" <rossella_brancaccio at yahoo.it>
> Sent: Monday, April 18, 2011 11:41:36 AM
> Subject: Re: [mpich-discuss] I: Re: Problem to run MPICH2
> on Windows 7 with user interface
> 
> Ciao Rosa,
> 
> > Unfortuntely my problem is not with I/O on files, but
> with
> > standard output and with user interface.
> 
> If you're running into problems when trying to run the
> simplest case
> you've described (a basic "hello world" program that only
> uses
> stdout), may I suggest it could be a good idea to focus
> exclusively on
> that before mixing in additional issues?
> 
> Although it is possible for an MPI-enhanced program to use
> a GUI
> library, it may not be trivial to get that right initially.
> And, while
> creating and writing to files is usually easier than GUI
> stuff, it's
> still not as trivial as simply writing to standard output.
> 
> The latter is indeed trivial, and should be handled
> automagically for
> you, including the multiplexing of each rank's stdout (i.e.
> output
> should look as if your main mpiexec process had carried out
> each
> printf locally).
> 
> If your simplest example still fails to work properly when
> run under
> mpiexec, could you please retry with a copy of the standard
> "hellow.c"
> code (see below) to see whether any problems persist?
> 
> Regards,
> Nicolás
> 
> 
> #include <stdio.h>
> #include "mpi.h"
> 
> int main( int argc, char *argv[] )
> {
>     int rank, size;
>     MPI_Init( 0, 0 );
>     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>     MPI_Comm_size(MPI_COMM_WORLD, &size);
>     printf( "Hello world from process %d of
> %d\n", rank, size );
>     MPI_Finalize();
>     return 0;
> }
> 
> 
> >> I write the "hello word" test program. The MPICH2
> library is linked
> >> and there is no problem to run the program
> (without call mpiexec)
> >> from my compiler, obviously it starts with only 1
> process and it
> >> prints "Hello word from node 0" on stdout.
> >> If I try to start the program from command line
> (MS-DOS shell) with
> >> the following command
> >> mpiexec -n 4 Test.exe
> >> 4 processes of test.exe start (I can see them in
> the Windows Task
> >> Manager) but the output does not appear, the
> command prompt is
> >> indefinitely locked until I press CTRL-C to stop
> processes.
> _______________________________________________
> mpich-discuss mailing list
> mpich-discuss at mcs.anl.gov
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss
> 


More information about the mpich-discuss mailing list