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

Rosa Brancaccio rossella_brancaccio at yahoo.it
Wed Apr 20 08:41:00 CDT 2011


Hi all,
hi Florin, 
finally my program run with user interface!!
Yes, the problem disappears when I start spmd in debug mode!
But in addition the GUI appears only if I start mpiexec with the -localroot option.
Until now I am testing my program in one PC only, I have a doubt: if I try to run mpiexec with the localroot option, maybe the program cannot run in the other hosts of the cluster, is it correct or not? In that case I cannot distribute my program in the other hosts… 
Now, unfortunately, if I run the program with n processes then n GUI appear!!!
That is that each process has and manages the own user interface and,
I saw, they are independently , unless for the quit button: if I press one of the n Quit button all processes and all GUI terminate.
The code is below:

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

	if (InitCVIRTE (0, argv, 0) == 0)
		return -1;    /* out of memory */
	
	MPI_Init(&argc,&argv);
	
	if( panel <= 0 ) {
		panel = LoadPanel(0,"Test.uir",PANEL);
		DisplayPanel(panel);
		RunUserInterface();
	}    

	MPI_Finalize();   
	 	
	return 0;
}

int CVICALLBACK Test_Callback (int panel, int control, int event,void *callbackData, int eventData1, int eventData2) {
	
	switch (event) {
		
		case EVENT_COMMIT:  {
		
		int done = 0, n, myid, numprocs, i;
		int  namelen;
		char processor_name[MPI_MAX_PROCESSOR_NAME];
		char	txt[9999];
			
		MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
		MPI_Comm_rank(MPI_COMM_WORLD,&myid);
		MPI_Get_processor_name(processor_name,&namelen);
		
		sprintf(txt,"Process %d of %d is on %s\n",myid, numprocs, processor_name);
		SetCtrlVal(panel,PANEL_TEXTBOX,txt);

		break;
		}
	}
	return 0;
}

int CVICALLBACK CB_Quit_Callback (int panel, int control, int event,void *callbackData, int eventData1, int eventData2) {
	
	switch (event)	{
		case EVENT_COMMIT: {
		
			if(panel > 0 ) {
				DiscardPanel(panel);
				QuitUserInterface(0);
			}
			break;
		}
	}
	return 0;
}

I tried to give the GUI control to only one process, but if I change (in the main) the line :
if( panel <= 0 ) {

with the two:
MPI_Comm_rank(MPI_COMM_WORLD,&myid);
if( myid == 0 ) {

no GUI appears.
Any suggestions?
Thank you very much to all you.
Regards
Rosa



> Hi Rosa,
> 
> I think you need to have smpd running in a interactive console session as
> opposed to a standard windows service. As Jayesh told me in a older thread,
> smpd cannot run as a interactive windows service yet.
> My particular issue was fixed by running smpd in debug mode as a user
> process. For this, try stopping the smpd service on all nodes, then start it
> manually from command line using "smpd -d 0". Run your regular mpiexec
> command on the master node after that.
> 
> Hope this helps,
> Florin Ciubotaru
> 
> On Tue, Apr 19, 2011 at 4:27 PM, Rosa Brancaccio <
> rossella_brancaccio at yahoo.it> wrote:
> 
> > 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
> > >
> > _______________________________________________
> > 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