A.3. Sampling of MPI Applications

When sampling a normal, non-MPI application, the sample command creates a fingerprint file called sample.smp by default, unless overridden by an explicit parameter like so:

$ sample -o myapp-test4.smp -r ./myapp arg1

In a MPI environment, there are several instances of the sampler that all try to create their own fingerprint files, typically in the same directory. Clearly, they need to use different names for their files, or else the files overwrite one another. It is your responsibility to provide a template for the names of these files as an input to the sample command:

$ mpirun -np 16 sample -o test4/myapp-%r.smp -r ./myapp arg1

The %r is a special sequence that expands to a unique value for each rank. On many systems it expands to the MPI rank number, but on systems where the rank number is not available to Freja, it expands to a combination of hostname and a unique number, e.g., "node45-17", where node45 is the name of the node, and 17 is a sequential number within that node.

The following table lists the special sequences that Freja recognizes:

Table A.1. Fingerprint filename substitutions

SequenceSubstitution
%r

If executed in an MPI environment this is replaced with the MPI rank number, if known. On other systems it is equivalent to %h-%p (see below).

Example: x-%r.smp becomes x-17.smp (MPI), or x-myhost-123.smp (otherwise)

%h

Replaced with the current hostname of the machine.

Example: x-%h.smp becomes x-myhost.smp

%p

Replaced with a unique number within the current host. Note: It is not related to the Pid of the target process.

Example: x-%p.smp becomes x-123.smp

%u

Expands to ".number" in such a way that the resulting filename becomes unique. Numbers are tried sequentially, starting with 0. As a special case, the number ".0" is elided.

Example: x%u.smp becomes x.smp (first file), x.1.smp (next file) etc.

%U

Expands to ".number" in such a way that the resulting filename becomes unique. Numbers are tried sequentially until a unique number is found.

Example: x%U.smp becomes x.0.smp (first file), x.1.smp (next file), etc.

%{ENV}

Replaced with the content of the environment variable ENV

Example: x-%{USER}.smp becomes x-demo.smp

%%

Replaced with a single %. This is sometimes useful on Windows when encoding commands in a batch file.

Example: x%%.smp becomes x%.smp


The following table lists the environment variables that Freja tries in sequence to determine the MPI rank number.

Table A.2. %r substitutions

Environment variable[a]Used for MPI type:
PMI_RANKMPICH 2 and derivatives
OMPI_COMM_WORLD_RANKOpenMPI 1.3
OMPI_MCA_ns_nds_vpidOpenMPI 1.2 and derivatives
PMI_IDSLURM PMI
SLURM_PROCIDSLURM
LAMRANKLAM
MPI_RANKIDHP MPI for Linux
MP_CHILDIBM PE
MP_RANKSun CT
MPIRUN_RANKMVAPICH 1.1

[a] The inclusion of an environment variable in this list does not automatically imply that Freja is certified for that platform.