Example MPI Process and Ranking Identification

Typically, a process in a parallel application needs to know what its entity is, known as its rank and how many other processes exist within this ranking. A process finds out its own rank by calling:

MPI_Comm_rank( ): 
Int myrank;
MPI_Comm_rank(MPI_COMM_WORLD, &myrank); 

The total number of processes is returned by MPI_Comm_size( ):

int nprocs;
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);

Copyright 2002-2014 ClusterVision BV