File: getgrank.c

package info (click to toggle)
mpich 1.1.0-3
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 22,116 kB
  • ctags: 27,349
  • sloc: ansic: 193,435; sh: 11,172; fortran: 6,545; makefile: 5,801; cpp: 5,020; tcl: 3,548; asm: 3,536; csh: 1,079; java: 614; perl: 183; awk: 168; sed: 70; f90: 62
file content (29 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "mpi.h"
#include "mpeexten.h"

/*@
  MPE_Comm_global_rank - Returns the rank in MPI_COMM_WORLD for a
  given (communicator,rank) pair

  Input Parameters:
. comm - Communicator
. rank - Rank in comm

  Output Parameters:
. grank - Rank in comm world
@*/
void MPE_Comm_global_rank( comm, rank, grank )
MPI_Comm comm;
int      rank, *grank;
{
/* We could cache world_group, at least, but then we'd have no way to
   free it later */
MPI_Group group, world_group;
int lrank = rank;   /* Just in case rank has no address (passed in register) */

MPI_Comm_group( comm, &group );
MPI_Comm_group( MPI_COMM_WORLD, &world_group );
MPI_Group_translate_ranks( group, 1, &lrank, world_group, grank );
MPI_Group_free( &group );
MPI_Group_free( &world_group );
}