Skip to content

Instantly share code, notes, and snippets.

@simonpintarelli
Created August 20, 2018 15:53
Show Gist options
  • Save simonpintarelli/b3e4ceaf284a1552722c371bed0afba2 to your computer and use it in GitHub Desktop.
Save simonpintarelli/b3e4ceaf284a1552722c371bed0afba2 to your computer and use it in GitHub Desktop.

Installation

wget https://github.com/LLNL/mpiP/archive/3.4.1.tar.gz
tar xf 3.4.1.tar.gz
mkdir -p $HOME/local
(
    cd mpiP-3.4.1
    ./configure --with-cxx=cc --disable-bfd --disable-libunwind --with-cc=cc --with-f77=ftn --prefix=$HOME/local/mpip
    make install
)

Make sure that python3 is NOT loaded.

Example code

#include <mpi.h>
#include <unistd.h>

int main(int argc, char *argv[])
{
  int comm = MPI_COMM_WORLD;
  int nprocs, rank;
  int sleeptime = 10;
  MPI_Init (&argc, &argv);
  MPI_Comm_size (comm, &nprocs);
  MPI_Comm_rank (comm, &rank);
  MPI_Barrier (comm);
  if (rank == 0)
  {
    sleep (sleeptime);        /* slacker! delaying everyone else */
  }
  MPI_Barrier (comm);
  MPI_Finalize ();

  return 0;
}

Run

Compile command: cc main.cpp -g -L${HOME}/local/mpip/lib -lmpiP -lm -liberty -o a.out

Threshold reporting variable, for more options see http://mpip.sourceforge.net/#Runtime_Configuration

export MPIP="-t 10.0"

Execute: srun -ppdebug -n36 ./a.out

Output:

simonpi@daint104:~/mpiP-example> srun -n36  ./a.out  1000
mpiP: Found MPIP environment variable [-t 10.0 -k 2]
mpiP: Set the report print threshold to [10.00%].
mpiP: Set the callsite stack traceback depth to [2].
mpiP:
mpiP: mpiP: mpiP V3.4.1 (Build Aug 20 2018/17:20:41)
mpiP: Direct questions and errors to mpip-help@lists.sourceforge.net
mpiP:
Mean - 0.499507, Standard deviation = 0.288137
mpiP:
mpiP: Storing mpiP output in [./a.out.36.38783.1.mpiP].
mpiP:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment