[mpich-discuss] help

guchonglin-6 guchonglin-6 at 163.com
Sat Apr 3 22:20:15 CDT 2010


Hello:

       Now my problem changes to the following:

       I use the function MPI_Comm_rank anf MPI_Comm_size。but the reslut is

      node1:/usr/cluster # mpiexec -n 2 ./d
      HELLOWORLD!process0 of 1 on node1
      HELLOWORLD!process0 of 1 on node2

      The problem is it should show process0 of 2 on node1 and process 1 of 2 on node2

     So,please help me.

The code is the following, so I want to know why like this:

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

int main(int argc,char **argv)
{
   int myid,numprocs;
   int namelen;
   char processor_name[MPI_MAX_PROCESSOR_NAME];
   MPI_Init(&argc,&argv);
   
   MPI_Comm_rank(MPI_COMM_WORLD,&myid);
   MPI_Comm_size(MPI_COMM_WORLD,&numprocs);
   MPI_Get_processor_name(processor_name,&namelen);
   printf("HELLOWORLD!process%d of %d on %s\n",myid,numprocs,processor_name);
   MPI_Finalize();
return 0;
}

         Thank you!

                                                                                                                                  Gugu









 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20100404/1fdb0564/attachment.htm>


More information about the mpich-discuss mailing list