/usr/share/code_saturne/runcase_mpi_rank is in code-saturne-data 4.2.0+repack-1build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | #!/bin/sh
#-------------------------------------------------------------------------------
# This file is part of Code_Saturne, a general-purpose CFD tool.
#
# Copyright (C) 1998-2015 EDF S.A.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 51 Franklin
# Street, Fifth Floor, Boston, MA 02110-1301, USA.
#-------------------------------------------------------------------------------
#===============================================================================
# A priori detection of the rank of a MPI process
#===============================================================================
#
# In order to get the MPI rank from a script launched
# by mpirun (or prun, mpijob, or equivalent):
#
# MPI_RANK=`runcase_mpi_rank $@`
#
# Mainly useful to launch MPMD applications
# like coupling within MPI environments
# which do not have a command like mpiexec.
# Current systems
# ---------------
# For MPICH2 or MPICH-3 (which also provides the mpiexec command)
if [ "$PMI_RANK" != "" ] ; then
MPI_RANK="$PMI_RANK"
# For Open MPI (it also provides the mpiexec command)
elif [ "$OMPI_MCA_ns_nds_vpid" != "" ] ; then # Open MPI 1.2
MPI_RANK="$OMPI_MCA_ns_nds_vpid"
elif [ "$OMPI_COMM_WORLD_RANK" != "" ] ; then # Open MPI 1.3
MPI_RANK="$OMPI_COMM_WORLD_RANK"
# Otherwise, with SLURM
elif [ "$PMI_ID" != "" ] ; then
MPI_RANK="$PMI_ID"
elif [ "$SLURM_PROCID" != "" ] ; then
MPI_RANK="$SLURM_PROCID"
# For IBM Platform MPI
elif [ "$MPI_RANKID" != "" ] ; then
MPI_RANK="$MPI_RANKID"
# Current systems for which we have no access (so trust docs)
# -------------------------------------------
# For IBM PE
elif [ "$MP_CHILD" != "" ] ; then
MPI_RANK="$MP_CHILD"
# Obsolete systems (are any of those still used somewhere ?)
# ----------------
# For MVAPICH 1.1
elif [ "$SMPIRUN_RANK" != "" ] ; then
MPI_RANK="$MPIRUN_RANK"
# For LAM 7.1 (an appschema can also be used)
elif [ "$LAMRANK" != "" ] ; then
MPI_RANK="$LAMRANK"
# On HP AlphaServer cluster (CCRT: Chrome)
elif [ "$RMS_RANK" != "" ] ; then
MPI_RANK="$RMS_RANK"
# On Opteron cluster under Linux MPICH-GM
elif [ "$GMPI_ID" != "" ] ; then
MPI_RANK="$GMPI_ID"
# On cluster with HP-MPI (has become Platform MPI since)
elif [ "$MPI_PROC" != "" ] ; then
MPI_RANK=`echo $MPI_PROC | cut -f 2 -d,`
# On cluster under Linux with Scali MPI (bought by Platform computing)
elif [ "$SCAMPI_PROCESS_PARAM" != "" ] ; then
MPI_RANK=`echo $SCAMPI_PROCESS_PARAM | cut -f4 -d' '`
# For "standard" MPICH 1.2 (with "usual" chp4 communication)
else
MPI_RANK=0
next_arg_is_rank=""
for arg in "$@" ; do
if [ "$arg" = "-p4rmrank" ] ; then
next_arg_is_rank="1"
elif [ "$next_arg_is_rank" = "1" ] ; then
MPI_RANK="$arg"
next_arg_is_rank="0"
fi
done
# End of known cases
fi
# Output of the obtained rank
echo "$MPI_RANK"
|