|
Packit |
857059 |
# BEGIN_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Copyright (c) 2015, Intel Corporation
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# Redistribution and use in source and binary forms, with or without
|
|
Packit |
857059 |
# modification, are permitted provided that the following conditions are met:
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# * Redistributions of source code must retain the above copyright notice,
|
|
Packit |
857059 |
# this list of conditions and the following disclaimer.
|
|
Packit |
857059 |
# * Redistributions in binary form must reproduce the above copyright
|
|
Packit |
857059 |
# notice, this list of conditions and the following disclaimer in the
|
|
Packit |
857059 |
# documentation and/or other materials provided with the distribution.
|
|
Packit |
857059 |
# * Neither the name of Intel Corporation nor the names of its contributors
|
|
Packit |
857059 |
# may be used to endorse or promote products derived from this software
|
|
Packit |
857059 |
# without specific prior written permission.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
Packit |
857059 |
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
Packit |
857059 |
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
Packit |
857059 |
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
|
Packit |
857059 |
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
Packit |
857059 |
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
Packit |
857059 |
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
Packit |
857059 |
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
Packit |
857059 |
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit |
857059 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# END_ICS_COPYRIGHT8 ****************************************
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# [ICS VERSION STRING: unknown]
|
|
Packit |
857059 |
#! /bin/bash
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# initialize
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# BASE PATH TO MPI EXECUTABLES: To use an alternate location,
|
|
Packit |
857059 |
# either edit this line or set MPICH_PREFIX in your environment.
|
|
Packit |
857059 |
# see iba_select_mpi for the set of default MPI selections
|
|
Packit |
857059 |
# default to MPI used for build
|
|
Packit |
857059 |
MPICH_PREFIX=
|
|
Packit |
857059 |
|
|
Packit |
857059 |
mpirunfile=
|
|
Packit |
857059 |
vfselectmethod=sid_qlc
|
|
Packit |
857059 |
vfname=
|
|
Packit |
857059 |
vfsid=
|
|
Packit |
857059 |
dsprtg=
|
|
Packit |
857059 |
qname=
|
|
Packit |
857059 |
numprocs=2
|
|
Packit |
857059 |
wrkdir=$HOME
|
|
Packit |
857059 |
mrailmap=
|
|
Packit |
857059 |
|
|
Packit |
857059 |
MPI_CMD_ARGS=
|
|
Packit |
857059 |
|
|
Packit |
857059 |
MOAB_DJOB_QUEUE_ARGS=""
|
|
Packit |
857059 |
MOAB_DJOB_WRK_DIR_ARGS=""
|
|
Packit |
857059 |
|
|
Packit |
857059 |
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# Usage - display usage syntax and exit
|
|
Packit |
857059 |
|
|
Packit |
857059 |
Usage()
|
|
Packit |
857059 |
{
|
|
Packit |
857059 |
echo "Usage: submit.mvapich.job [-V vf_select_method] [-s vf_sid] [-n vf_name]"
|
|
Packit |
857059 |
echo " [-d dsp_rtg] [-q queue_name] [-p num_processes] [-w wrk_dir]"
|
|
Packit |
857059 |
echo " [-m <unit:port>[,<unit:port>]]"
|
|
Packit |
857059 |
echo " mpi_run_file [mpi_run_file args]"
|
|
Packit |
857059 |
echo -e "\n where vf_select_method is one of:"
|
|
Packit |
857059 |
echo " vf_name: Name of virtual fabric - use -n to define vf name"
|
|
Packit |
857059 |
echo " sid : ServiceId of virtual fabric - use -s option to define service id"
|
|
Packit |
857059 |
echo " sid_qlc: ServiceId of virtual fabric - use -s option to define service id,"
|
|
Packit |
857059 |
echo " uses dist_sa (default)"
|
|
Packit |
857059 |
echo " where dsp_rtg is: 1-adaptive, 2-static_src, 3-static_dest, or 4-static_base"
|
|
Packit |
857059 |
echo " where queue_name is a valid Moab queue name (default queue is batch)"
|
|
Packit |
857059 |
echo " where num_processes is the number of processors to run MPI on"
|
|
Packit |
857059 |
echo " where wrk_dir is the directory the job should execute in (default $""HOME)"
|
|
Packit |
857059 |
echo " where unit:port is the unit/port pair is used to setup a rail"
|
|
Packit |
857059 |
exit 2
|
|
Packit |
857059 |
}
|
|
Packit |
857059 |
|
|
Packit |
857059 |
|
|
Packit |
857059 |
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# process opts and args
|
|
Packit |
857059 |
|
|
Packit |
857059 |
while getopts r:h:V:s:n:d:p:q:w:m: param
|
|
Packit |
857059 |
do
|
|
Packit |
857059 |
case $param in
|
|
Packit |
857059 |
r)
|
|
Packit |
857059 |
export mpirunfile=$OPTARG;;
|
|
Packit |
857059 |
V)
|
|
Packit |
857059 |
export vfselectmethod=$OPTARG;;
|
|
Packit |
857059 |
s)
|
|
Packit |
857059 |
export vfsid=$OPTARG;;
|
|
Packit |
857059 |
n)
|
|
Packit |
857059 |
export vfname=$OPTARG;;
|
|
Packit |
857059 |
d)
|
|
Packit |
857059 |
export dsprtg=$OPTARG;;
|
|
Packit |
857059 |
p)
|
|
Packit |
857059 |
export numprocs=$OPTARG;;
|
|
Packit |
857059 |
q)
|
|
Packit |
857059 |
export qname=$OPTARG;;
|
|
Packit |
857059 |
w)
|
|
Packit |
857059 |
export wrkdir=$OPTARG;;
|
|
Packit |
857059 |
m)
|
|
Packit |
857059 |
export mrailmap=$OPTARG;;
|
|
Packit |
857059 |
?)
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
esac
|
|
Packit |
857059 |
done
|
|
Packit |
857059 |
shift $(($OPTIND -1))
|
|
Packit |
857059 |
|
|
Packit |
857059 |
mpirunfile=$1
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# validate args
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$mpirunfile" = "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Must provide an mpi_run_file"
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ ! -f $mpirunfile ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "mpi_run_file \"$mpirunfile\" does not exist"
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$dsprtg" != "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
if [ $dsprtg -lt 1 -o $dsprtg -gt 4 ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo dispersive routing value must be between 1 and 4
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
# get opagetvf_func definition
|
|
Packit |
857059 |
. /usr/bin/opagetvf_env
|
|
Packit |
857059 |
|
|
Packit |
857059 |
case $vfselectmethod in
|
|
Packit |
857059 |
vf_name)
|
|
Packit |
857059 |
opagetvf_func "-d '$vfname'" VIADEV_DEFAULT_PKEY VIADEV_DEFAULT_SERVICE_LEVEL MTU
|
|
Packit |
857059 |
if [ $? -ne 0 ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Failed to get environment variables for VF with Name \"$vfname\""
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
export MPI_CMD_ARGS="VIADEV_DEFAULT_PKEY=$VIADEV_DEFAULT_PKEY VIADEV_DEFAULT_SERVICE_LEVEL=$VIADEV_DEFAULT_SERVICE_LEVEL VIADEV_DEFAULT_MTU=MTU$MTU MV_MTU=$MTU PSM_PKEY=$VIADEV_DEFAULT_PKEY IPATH_SL=$VIADEV_DEFAULT_SERVICE_LEVEL PSM_MTU=$MTU";;
|
|
Packit |
857059 |
sid)
|
|
Packit |
857059 |
opagetvf_func "-S '$vfsid'" VIADEV_DEFAULT_PKEY VIADEV_DEFAULT_SERVICE_LEVEL MTU
|
|
Packit |
857059 |
if [ $? -ne 0 ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Failed to get environment variables for VF with SID \"$vfsid\""
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
export MPI_CMD_ARGS="VIADEV_DEFAULT_PKEY=$VIADEV_DEFAULT_PKEY VIADEV_DEFAULT_SERVICE_LEVEL=$VIADEV_DEFAULT_SERVICE_LEVEL VIADEV_DEFAULT_MTU=MTU$MTU MV_MTU=$MTU PSM_PKEY=$VIADEV_DEFAULT_PKEY IPATH_SL=$VIADEV_DEFAULT_SERVICE_LEVEL PSM_MTU=$MTU";;
|
|
Packit |
857059 |
sid_qlc)
|
|
Packit |
857059 |
export MPI_CMD_ARGS="PSM_PATH_REC=opp PSM_IB_SERVICE_ID=$vfsid";;
|
|
Packit |
857059 |
*)
|
|
Packit |
857059 |
echo Unknown vfselectmethod $vfselectmethod
|
|
Packit |
857059 |
Usage;;
|
|
Packit |
857059 |
esac
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$dsprtg" != "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
case $dsprtg in
|
|
Packit |
857059 |
1)
|
|
Packit |
857059 |
export routing=adaptive;;
|
|
Packit |
857059 |
2)
|
|
Packit |
857059 |
export routing=static_src;;
|
|
Packit |
857059 |
3)
|
|
Packit |
857059 |
export routing=static_dest;;
|
|
Packit |
857059 |
4)
|
|
Packit |
857059 |
export routing=static_base;;
|
|
Packit |
857059 |
esac
|
|
Packit |
857059 |
export MPI_CMD_ARGS="$MPI_CMD_ARGS PSM_PATH_SELECTION=$routing"
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$MPICH_PREFIX" = "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
. /usr/bin/iba_select_mpi
|
|
Packit |
857059 |
if ! valid_mpich_prefix
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
find_mpi $prefix/mpi/gcc/mvapich-1*qlc
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
if ! valid_mpich_prefix
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
find_mpi $prefix/mpi/gcc/mvapich-1*
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$qname" != "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
export MOAB_DJOB_QUEUE_ARGS="-q $qname"
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ ! -d $wrkdir ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "wrk_dir \"$wrkdir\" does not exist"
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$wrkdir" != "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
export MOAB_DJOB_WRK_DIR_ARGS="-d $wrkdir"
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
if [ "$mrailmap" != "" ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
. /usr/bin/opagetvf_env
|
|
Packit |
857059 |
|
|
Packit |
857059 |
iba_getpsm_func $mrailmap
|
|
Packit |
857059 |
if [ $? -ne 0 ]
|
|
Packit |
857059 |
then
|
|
Packit |
857059 |
echo "Failed to get environment variable for PSM with value \"$mrailmap\""
|
|
Packit |
857059 |
Usage
|
|
Packit |
857059 |
else
|
|
Packit |
857059 |
export MPI_CMD_ARGS="$MPI_CMD_ARGS PSM_MULTIRAIL=1 PSM_MULTIRAIL_MAP=$mrailmap"
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
fi
|
|
Packit |
857059 |
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# submit the job from stdin
|
|
Packit |
857059 |
#
|
|
Packit |
857059 |
# parameters:
|
|
Packit |
857059 |
# -E: Moab adds standard Moab environment variables to the job's environment.
|
|
Packit |
857059 |
# -l: Defines the resources that are required by the job and establishes a
|
|
Packit |
857059 |
# limit to the amount of resource that can be consumed.
|
|
Packit |
857059 |
# + tpn: Tasks per node allowed on allocated hosts,
|
|
Packit |
857059 |
# + procs: Requests a specific amount of processors for the job.
|
|
Packit |
857059 |
# -q: Specifies the destination queue (Class) the job should execute in.
|
|
Packit |
857059 |
# -d: Specifies which directory the job should execute in.
|
|
Packit |
857059 |
# -V: Declares that all environment variables in the msub environment are
|
|
Packit |
857059 |
# exported to the batch job.
|
|
Packit |
857059 |
|
|
Packit |
857059 |
cat moab.mpi.job.wrapper > .run.mvapich
|
|
Packit |
857059 |
echo $MPICH_PREFIX/bin/mpirun_rsh -np $numprocs -hostfile '.mpi_hosts_file.$$' $MPI_CMD_ARGS $* >> .run.mvapich
|
|
Packit |
857059 |
msub -E -l procs=$numprocs $MOAB_DJOB_WRK_DIR_ARGS $MOAB_DJOB_QUEUE_ARGS -V .run.mvapich
|
|
Packit |
857059 |
rm .run.mvapich
|
|
Packit |
857059 |
|
|
Packit |
857059 |
exit 0
|