[GE users] Question concerning MPI_UNIVERSE_SIZE

Chansup Byun chansup.byun at sun.com
Wed Nov 26 14:33:05 GMT 2008


On 11/26/08 04:36, Rainer M Krug wrote:
> Hi
>
> I have the following C program:
>
> ## C_rainer.c
> #include <stdio.h>
> #include "mpi.h"
>
> int main(int argc, char** argv)
> {
>     int rank, size, nameLen;
>     char processorName[MPI_MAX_PROCESSOR_NAME];
>
>     MPI_Init(&argc, &argv);
>     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>     MPI_Comm_rank(MPI_COMM_WORLD, &rank);
>   

Two identical lines? Shouldn't the second line be

    MPI_Comm_size(MPI_COMM_WORLD, &size);


>     MPI_Get_processor_name(processorName, &nameLen);
>
>     int *MPI_Universe_Size;
>     int univ_flag;
>     MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_UNIVERSE_SIZE,
> &MPI_Universe_Size, &univ_flag);
>
>     printf("Hello, rank %d, size %d on processor %s\n", rank,
> size,processorName);
>     printf("Universe Size %d\n", *MPI_Universe_Size);
>     MPI_Finalize();
>     return 0;
> }
>
> when I compile it with mpicc (openmpi_gnu) and execute it, I get the
> following output:
>
> rkrug at head001:~/Documents/examples/C_MPI> ./mpi_rainer
>   

When you execute an MPI program, you need to use the mpirun command:

mpirun -np <number_of_procs> ./mpi_rainer

It appears to me that you are running a stand alone program on each node.

Regards,
- Chansup

> Hello, rank 0, size 0 on processor head001
> Universe Size 1
> rkrug at head001:~/Documents/examples/C_MPI>
>
> Should that not be Universe Size equals the number of nodes? Because
> this is the reason why I don't get Rmpi in R to work: it only sees the master
> (head001).
>
> When I use qsub, I get the following:
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp019
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
> Hello, rank 0, size 0 on processor comp004
> Universe Size 1
>
> which is more or less what I expected (only that each node has a
> quadcore, and I would somehow expect to get 4 for the Universe size)
>
> Is this a setup issue of openMPI?
>
> Thanks
>
> Rainer
>

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=89969

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list