Search code examples
fortranmpiopenaccnvprof

nvprof with MPICH


I am trying to profile an MPI/OpenACC Fortran code. I found a site that details how to run nvprof with MPI here. The examples given are for OpenMPI. However, I am limited to MPICH and I can't figure out the equivalent. Anyone know what it would be?


Solution

  • As far as I can tell the only OpenMPI specific parts of the nvprof examples are the use of OMPI_COMM_WORLD_RANK to get a unique filename for each rank. According to the discussion here you may be able to use either PMI_RANK or PMI_ID instead.

    On my system I have the following small program

    program env
      implicit none
      call system("echo $PMI_RANK")
    end program env
    

    I compile with mpif90 env.f90 -o test and run with mpirun -np 2 ./test and get

    0
    1
    

    as output. So I think you can just replace -o output.%h.%p.%q{OMPI_COMM_WORLD_RANK} with -o output.%h.%p.%q{PMI_RANK}.

    For the cray-mpt mpi library I believe the correct variable is in fact ALPS_APP_PE instead.