[mpich-discuss] get the process rank in the bash script

Pavan Balaji balaji at mcs.anl.gov
Sun Apr 28 17:13:36 CDT 2013

You can use PMI_RANK.  I just tried it and it works as expected.  Which
version of MPICH are you using?

 -- Pavan

On 02/25/2013 10:06 AM US Central Time, Kirill Lykov wrote:
> Dear mpich users,
> I'm looking for an environmental variable which can be used in a bash script to identify the process rank.
> I launch a bash script using mpi:
> mpirun ./my-script.sh
> In my-script I want to use the rank of the process to identify which input file to use. In OpenMPI, I used OMPI_COMM_WORLD_RANK and my-script.sh looked like the following:
> inputName="MyInput_$OMPI_COMM_WORLD_RANK"./myexe $inputName
> What can be used in MPICH instead of OMPI_COMM_WORLD_RANK? I found somewhere that $PMI_RANK is the same but I found that it is empty.
> Kirill Lykov, Mr.
> Doctoral Assistant
> Institute of
> Computational Science 
> Faculty of Informatics
> Università della Svizzera italiana, USI
> Via G. Buffi 13
> CH - 6904 Lugano
> (e) kirill.lykov at usi.ch 
> (t) +41 (0) 788413392
> _______________________________________________
> discuss mailing list     discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss

Pavan Balaji

More information about the discuss mailing list