Re: [OMPI users] function fgets hangs a mpi program when it is used ompi-ps command
ompi-ps talks to mpirun to get the info, and then pretty-prints it to stderr. Best guess is that it is having problems contacting mpirun. Are you running it on the same node as mpirun (a requirement, unless you pass it the full contact info)? Check the ompi-ps man page and also "ompi-ps -h" to ensure you are running it correctly. There may be options that would help to figure out what is wrong (I forget what they all are). On Thu, Sep 23, 2010 at 12:21 PM, Matheus Bersot Siqueira Barros < matheusberso...@gmail.com> wrote: > Jeff and Ralph, > > Thank you for your reply. > > 1) I'm not running on machines with OpenFabrics. > > 2) In my example, ompi-ps prints a maximum 82 bytes per line. Even so, I > augment to 300 bytes per line to be sure that it is not the problem. > > char mystring [300]; > ... > fgets (mystring , 300 , pFile); > > 2) When I run ps, it shows just two process: ps and bash. > PID TTY TIME CMD > 1961 pts/500:00:00 bash > 2154 pts/500:00:00 ps > > But when I run ps -a -l, it appears my program(test.run) and other > processes. I put below just the information related to my program. > > F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD > 0 S 1000 1841 1840 0 80 0 - 18054 pipe_w pts/000:00:00 test.run > 0 S 1000 1842 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run > 0 S 1000 1843 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run > 0 S 1000 1844 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run > > pipe_s = wait state on read/write against a pipe. > > So, with that command I concluded that one mpi process is waiting for the > read of a pipe. > > The problem still persists. > > Thanks, > Matheus. > > > On Wed, Sep 22, 2010 at 11:24 AM, Ralph Castainwrote: > >> Printouts of less than 100 bytes would be unusual...but possible >> >> >> On Wed, Sep 22, 2010 at 8:15 AM, Jeff Squyres wrote: >> >>> Are you running on machines with OpenFabrics devices (that Open MPI is >>> using)? >>> >>> Is ompi-ps printing 100 bytes or more? >>> >>> What does ps show when your program is hung? >>> >>> >>> >>> On Sep 17, 2010, at 3:13 PM, Matheus Bersot Siqueira Barros wrote: >>> >>> > Open MPI Version = 1.4.2 >>> > OS = Ubuntu 10.04 LTS and CentOS 5.3 >>> > >>> > When I run the mpi program below in the terminal, the function fgets >>> hangs. >>> > How do I know it? I do a printf before and later the call of fgets and >>> only the message "before fgets()" is showed. >>> > >>> > However, when I run the same program at Eclipse 3.6 with CDT >>> 7.0.0.201006141710 or using gdb it runs normally. >>> > If you change the command in the function popen to another one(for >>> instance: "ls -l"), it will run correctly. >>> > >>> > I use the following commands to compile and run the program: >>> > >>> > compile : mpicc teste.c -o teste.run >>> > >>> > run : mpirun -np 4 ./teste.run >>> > >>> > >>> > Does anyone know why the program behaves like that? >>> > >>> > Thanks in advance, >>> > >>> > Matheus Bersot. >>> > >>> > MPI_PROGRAM: >>> > >>> > #include >>> > #include "mpi.h" >>> > >>> > int main(int argc, char *argv[]) >>> > { >>> >int rank, nprocs; >>> >FILE * pFile = NULL; >>> >char mystring [100]; >>> > >>> > MPI_Init(,); >>> > MPI_Comm_size(MPI_COMM_WORLD,); >>> > MPI_Comm_rank(MPI_COMM_WORLD,); >>> > >>> >if(rank == 0) >>> >{ >>> >pFile = popen ("ompi-ps" , "r"); >>> >if (pFile == NULL) perror ("Error opening file"); >>> >else { >>> > while(!feof(pFile)) >>> > { >>> >printf("before fgets()\n"); >>> >fgets (mystring , 100 , pFile); >>> >printf("after fgets()\n"); >>> >puts (mystring); >>> > } >>> > pclose (pFile); >>> >} >>> > } >>> > >>> > MPI_Finalize(); >>> >return 0; >>> > } >>> > ___ >>> > users mailing list >>> > us...@open-mpi.org >>> > http://www.open-mpi.org/mailman/listinfo.cgi/users >>> >>> >>> -- >>> Jeff Squyres >>> jsquy...@cisco.com >>> For corporate legal information go to: >>> http://www.cisco.com/web/about/doing_business/legal/cri/ >>> >>> >>> ___ >>> users mailing list >>> us...@open-mpi.org >>> http://www.open-mpi.org/mailman/listinfo.cgi/users >>> >> >> >> ___ >> users mailing list >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users >> > > > > -- > - > "In moments of crisis, only the inspiration is more important than > knowledge." > (Albert Einstein) > > ___ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users >
Re: [OMPI users] function fgets hangs a mpi program when it is used ompi-ps command
Jeff and Ralph, Thank you for your reply. 1) I'm not running on machines with OpenFabrics. 2) In my example, ompi-ps prints a maximum 82 bytes per line. Even so, I augment to 300 bytes per line to be sure that it is not the problem. char mystring [300]; ... fgets (mystring , 300 , pFile); 2) When I run ps, it shows just two process: ps and bash. PID TTY TIME CMD 1961 pts/500:00:00 bash 2154 pts/500:00:00 ps But when I run ps -a -l, it appears my program(test.run) and other processes. I put below just the information related to my program. F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 0 S 1000 1841 1840 0 80 0 - 18054 pipe_w pts/000:00:00 test.run 0 S 1000 1842 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run 0 S 1000 1843 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run 0 S 1000 1844 1840 0 80 0 - 18053 poll_s pts/000:00:00 test.run pipe_s = wait state on read/write against a pipe. So, with that command I concluded that one mpi process is waiting for the read of a pipe. The problem still persists. Thanks, Matheus. On Wed, Sep 22, 2010 at 11:24 AM, Ralph Castainwrote: > Printouts of less than 100 bytes would be unusual...but possible > > > On Wed, Sep 22, 2010 at 8:15 AM, Jeff Squyres wrote: > >> Are you running on machines with OpenFabrics devices (that Open MPI is >> using)? >> >> Is ompi-ps printing 100 bytes or more? >> >> What does ps show when your program is hung? >> >> >> >> On Sep 17, 2010, at 3:13 PM, Matheus Bersot Siqueira Barros wrote: >> >> > Open MPI Version = 1.4.2 >> > OS = Ubuntu 10.04 LTS and CentOS 5.3 >> > >> > When I run the mpi program below in the terminal, the function fgets >> hangs. >> > How do I know it? I do a printf before and later the call of fgets and >> only the message "before fgets()" is showed. >> > >> > However, when I run the same program at Eclipse 3.6 with CDT >> 7.0.0.201006141710 or using gdb it runs normally. >> > If you change the command in the function popen to another one(for >> instance: "ls -l"), it will run correctly. >> > >> > I use the following commands to compile and run the program: >> > >> > compile : mpicc teste.c -o teste.run >> > >> > run : mpirun -np 4 ./teste.run >> > >> > >> > Does anyone know why the program behaves like that? >> > >> > Thanks in advance, >> > >> > Matheus Bersot. >> > >> > MPI_PROGRAM: >> > >> > #include >> > #include "mpi.h" >> > >> > int main(int argc, char *argv[]) >> > { >> >int rank, nprocs; >> >FILE * pFile = NULL; >> >char mystring [100]; >> > >> > MPI_Init(,); >> > MPI_Comm_size(MPI_COMM_WORLD,); >> > MPI_Comm_rank(MPI_COMM_WORLD,); >> > >> >if(rank == 0) >> >{ >> >pFile = popen ("ompi-ps" , "r"); >> >if (pFile == NULL) perror ("Error opening file"); >> >else { >> > while(!feof(pFile)) >> > { >> >printf("before fgets()\n"); >> >fgets (mystring , 100 , pFile); >> >printf("after fgets()\n"); >> >puts (mystring); >> > } >> > pclose (pFile); >> >} >> > } >> > >> > MPI_Finalize(); >> >return 0; >> > } >> > ___ >> > users mailing list >> > us...@open-mpi.org >> > http://www.open-mpi.org/mailman/listinfo.cgi/users >> >> >> -- >> Jeff Squyres >> jsquy...@cisco.com >> For corporate legal information go to: >> http://www.cisco.com/web/about/doing_business/legal/cri/ >> >> >> ___ >> users mailing list >> us...@open-mpi.org >> http://www.open-mpi.org/mailman/listinfo.cgi/users >> > > > ___ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users > -- - "In moments of crisis, only the inspiration is more important than knowledge." (Albert Einstein)
Re: [OMPI users] function fgets hangs a mpi program when it is used ompi-ps command
Printouts of less than 100 bytes would be unusual...but possible On Wed, Sep 22, 2010 at 8:15 AM, Jeff Squyreswrote: > Are you running on machines with OpenFabrics devices (that Open MPI is > using)? > > Is ompi-ps printing 100 bytes or more? > > What does ps show when your program is hung? > > > > On Sep 17, 2010, at 3:13 PM, Matheus Bersot Siqueira Barros wrote: > > > Open MPI Version = 1.4.2 > > OS = Ubuntu 10.04 LTS and CentOS 5.3 > > > > When I run the mpi program below in the terminal, the function fgets > hangs. > > How do I know it? I do a printf before and later the call of fgets and > only the message "before fgets()" is showed. > > > > However, when I run the same program at Eclipse 3.6 with CDT > 7.0.0.201006141710 or using gdb it runs normally. > > If you change the command in the function popen to another one(for > instance: "ls -l"), it will run correctly. > > > > I use the following commands to compile and run the program: > > > > compile : mpicc teste.c -o teste.run > > > > run : mpirun -np 4 ./teste.run > > > > > > Does anyone know why the program behaves like that? > > > > Thanks in advance, > > > > Matheus Bersot. > > > > MPI_PROGRAM: > > > > #include > > #include "mpi.h" > > > > int main(int argc, char *argv[]) > > { > >int rank, nprocs; > >FILE * pFile = NULL; > >char mystring [100]; > > > > MPI_Init(,); > > MPI_Comm_size(MPI_COMM_WORLD,); > > MPI_Comm_rank(MPI_COMM_WORLD,); > > > >if(rank == 0) > >{ > >pFile = popen ("ompi-ps" , "r"); > >if (pFile == NULL) perror ("Error opening file"); > >else { > > while(!feof(pFile)) > > { > >printf("before fgets()\n"); > >fgets (mystring , 100 , pFile); > >printf("after fgets()\n"); > >puts (mystring); > > } > > pclose (pFile); > >} > > } > > > > MPI_Finalize(); > >return 0; > > } > > ___ > > users mailing list > > us...@open-mpi.org > > http://www.open-mpi.org/mailman/listinfo.cgi/users > > > -- > Jeff Squyres > jsquy...@cisco.com > For corporate legal information go to: > http://www.cisco.com/web/about/doing_business/legal/cri/ > > > ___ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users >
Re: [OMPI users] function fgets hangs a mpi program when it is used ompi-ps command
Are you running on machines with OpenFabrics devices (that Open MPI is using)? Is ompi-ps printing 100 bytes or more? What does ps show when your program is hung? On Sep 17, 2010, at 3:13 PM, Matheus Bersot Siqueira Barros wrote: > Open MPI Version = 1.4.2 > OS = Ubuntu 10.04 LTS and CentOS 5.3 > > When I run the mpi program below in the terminal, the function fgets hangs. > How do I know it? I do a printf before and later the call of fgets and only > the message "before fgets()" is showed. > > However, when I run the same program at Eclipse 3.6 with CDT > 7.0.0.201006141710 or using gdb it runs normally. > If you change the command in the function popen to another one(for instance: > "ls -l"), it will run correctly. > > I use the following commands to compile and run the program: > > compile : mpicc teste.c -o teste.run > > run : mpirun -np 4 ./teste.run > > > Does anyone know why the program behaves like that? > > Thanks in advance, > > Matheus Bersot. > > MPI_PROGRAM: > > #include > #include "mpi.h" > > int main(int argc, char *argv[]) > { >int rank, nprocs; >FILE * pFile = NULL; >char mystring [100]; > > MPI_Init(,); > MPI_Comm_size(MPI_COMM_WORLD,); > MPI_Comm_rank(MPI_COMM_WORLD,); > >if(rank == 0) >{ >pFile = popen ("ompi-ps" , "r"); >if (pFile == NULL) perror ("Error opening file"); >else { > while(!feof(pFile)) > { >printf("before fgets()\n"); >fgets (mystring , 100 , pFile); >printf("after fgets()\n"); >puts (mystring); > } > pclose (pFile); >} > } > > MPI_Finalize(); >return 0; > } > ___ > users mailing list > us...@open-mpi.org > http://www.open-mpi.org/mailman/listinfo.cgi/users -- Jeff Squyres jsquy...@cisco.com For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/