pcoords: Interchange Between Process Number and BLACS Coordinates

Description Usage Arguments Details Value Examples

Description

Grabs the existing BLACS context grid information.

Usage

1
2
3
base.pnum(ICTXT, PROW, PCOL)

base.pcoord(ICTXT, PNUM)

Arguments

ICTXT

BLACS context number.

PROW, PCOL

BLACS grid location row/column

PNUM

process rank

Details

For advanced users only. These functions are simple recreations of the BLACS routines BLACS_PNUM and BLACS_PCOORD. The former gets the process number associated with the BLACS process grid location c(MYPROW, MYPCOL), while the latter does the reverse.

Value

pnum returns an integer; pcoord returns a list containing elements PROW and PCOL.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
spmd.code <- "
  suppressMessages(library(pbdMPI))
  suppressMessages(library(pbdBASE))
  init.grid()

  ### get the ICTXT = 0 BLACS coordsinates for process 3
  myCoords <- base.pcoord(ICTXT = 0, PNUM = 3)
  comm.print(myCoords)

  ### get the ICTXT = 1 BLACS coordsinates for process 3
  myCoords <- base.pcoord(ICTXT = 1, PNUM = 3)
  comm.print(myCoords)

  ### get the ICTXT = 2 BLACS coordsinates for process 3
  myCoords <- base.pcoord(ICTXT = 2, PNUM = 3)
  comm.print(myCoords)

  finalize()
"
pbdMPI::execmpi(spmd.code = spmd.code, nranks = 4L)

pbdBASE documentation built on March 26, 2020, 9:37 p.m.