Remove old mpirun script -- it doesn't work anymore
This commit was SVN r2773.
Этот коммит содержится в:
родитель
f579cb08c1
Коммит
a7ca0c60dc
@ -14,6 +14,3 @@ mpirun2_SOURCES = \
|
||||
|
||||
mpirun2_LDADD = $(libs)
|
||||
mpirun2_DEPENDENCIES = $(mpirun2_LDADD)
|
||||
|
||||
clean-local:
|
||||
test -z "$(OMPI_CXX_TEMPLATE_REPOSITORY)" || $(RM) -rf $(OMPI_CXX_TEMPLATE_REPOSITORY)
|
||||
|
@ -1,269 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# $HEADER$
|
||||
#
|
||||
# Quick and dirty hack of an mpirun to be used only with the cofs
|
||||
# "RTE" (if you can call it that). Does not guarantee cleanup just
|
||||
# yet (still trying to figure out how to make that one work..)
|
||||
#
|
||||
# On the other hand, it will get us to MPI_INIT faster than just about
|
||||
# any other idea I have...
|
||||
#
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Some basic defaults
|
||||
#
|
||||
######################################################################
|
||||
ompi_numprocs="1"
|
||||
ompi_hosts="localhost"
|
||||
ompi_debug=0
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Global variables
|
||||
#
|
||||
######################################################################
|
||||
ompi_hostfile=""
|
||||
ompi_jobhandle=""
|
||||
ompi_app_args=""
|
||||
ompi_mydir=""
|
||||
ompi_cwd="`pwd`"
|
||||
ompi_prepped=""
|
||||
|
||||
# Get the dir where this script is
|
||||
dir="`dirname $0`"
|
||||
if test "$dir" = "."; then
|
||||
ompi_mydir=`pwd`
|
||||
else
|
||||
ompi_mydir="$dir"
|
||||
pushd $ompi_mydir 2>&1 > /dev/null
|
||||
ompi_mydir="`pwd`"
|
||||
popd 2>&1 > /dev/null
|
||||
fi
|
||||
unset dir
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Do argument parsing (not a function so I have the orig $*)
|
||||
#
|
||||
######################################################################
|
||||
args_err=0
|
||||
for i ; do
|
||||
case "${i}" in
|
||||
-np)
|
||||
shift
|
||||
ompi_numprocs=${1}
|
||||
shift
|
||||
;;
|
||||
-hostfile)
|
||||
shift
|
||||
ompi_hostfile=${1}
|
||||
shift
|
||||
;;
|
||||
-d)
|
||||
shift
|
||||
ompi_debug=1
|
||||
echo "Debugging output enabled"
|
||||
;;
|
||||
-h)
|
||||
shift
|
||||
args_err=1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
ompi_app_args="$@"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "$args_err" != "0" ; then
|
||||
echo "usage: mpirun [-np #] [-hostfile file] [-d]"
|
||||
echo " -np # Start # processes across as many hosts as available"
|
||||
echo " -hostfile file Read file for list of hosts to use for starting procs"
|
||||
echo " -d Enable debugging in the mpirun script"
|
||||
fi
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Debugging echo - only prints if debugging is enabled
|
||||
#
|
||||
######################################################################
|
||||
debug_echo() {
|
||||
if test "$ompi_debug" != "0"; then
|
||||
echo "$*"
|
||||
fi
|
||||
}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# prep_environ
|
||||
#
|
||||
# make environment push happen
|
||||
#
|
||||
######################################################################
|
||||
do_add_env() {
|
||||
str="$*"
|
||||
name="`echo ${str} | cut -d= -f1`"
|
||||
val="`echo ${str} | cut -d= -f2-`"
|
||||
|
||||
ompi_prepped="${ompi_prepped} -x ${name} \"${val}\""
|
||||
}
|
||||
|
||||
|
||||
do_prep_environ() {
|
||||
local a=""
|
||||
local envfile="/tmp/ompi_mpirun_env_$$"
|
||||
|
||||
rm -f "${envfile}"
|
||||
printenv > "${envfile}"
|
||||
|
||||
while IFS= read envpair
|
||||
do
|
||||
if test "`echo ${envpair} | grep \"^mca_\"`" != "" ; then
|
||||
do_add_env "${envpair}"
|
||||
elif test "`echo ${envpair} | grep \"^OMPI_MPI\"`" != "" ; then
|
||||
do_add_env "${envpair}"
|
||||
fi
|
||||
done < "${envfile}"
|
||||
|
||||
rm -f "${envfile}"
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# start_proc
|
||||
#
|
||||
# Start a process on the given node. Pushes out required environment
|
||||
# variables...
|
||||
#
|
||||
# ARGUMENTS:
|
||||
# hostname
|
||||
# vpid
|
||||
# argv argv to start
|
||||
#
|
||||
######################################################################
|
||||
do_start_proc() {
|
||||
local rmt_hostname=$1 ; shift
|
||||
local rmt_vpid=$1 ; shift
|
||||
local should_wait=$1 ; shift
|
||||
local argv="$*"
|
||||
local rmt_boot="${ompi_mydir}/mpiboot"
|
||||
local cmd=""
|
||||
|
||||
cmd="ssh ${rmt_hostname}"
|
||||
if test "$should_wait" = "0" ; then
|
||||
cmd="${cmd} -f "
|
||||
fi
|
||||
cmd="${cmd} -n ${rmt_boot} "
|
||||
cmd="${cmd} -cellid 1 -jobid ${ompi_jobid} -procid ${rmt_vpid}"
|
||||
cmd="${cmd} -numprocs ${ompi_numprocs}"
|
||||
cmd="${cmd} -pwd ${ompi_cwd} ${ompi_prepped}"
|
||||
if test ! -z "${OMPI_MCA_oob_cofs_dir}" ; then
|
||||
cmd="${cmd} -commdir ${OMPI_MCA_oob_cofs_dir}"
|
||||
else
|
||||
if test -d $HOME/cofs; then
|
||||
OMPI_MCA_oob_cofs_dir="$HOME/cofs"
|
||||
elif test -d /tmp/cofs; then
|
||||
OMPI_MCA_oob_cofs_dir="/tmp/cofs"
|
||||
else
|
||||
OMPI_MCA_oob_cofs_dir="$HOME/cofs"
|
||||
mkdir $HOME/cofs
|
||||
fi
|
||||
export OMPI_MCA_OOB_cofs_dir
|
||||
cmd="${cmd} -commdir ${OMPI_MCA_oob_cofs_dir}"
|
||||
fi
|
||||
cmd="${cmd} -- ${argv}"
|
||||
debug_echo "executing: ${cmd}"
|
||||
${cmd}
|
||||
}
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# make_hosts_list
|
||||
#
|
||||
# make the ompi_hosts list, if a hostfile was specified
|
||||
#
|
||||
######################################################################
|
||||
make_hosts_list() {
|
||||
if test -z "${ompi_hostfile}" ; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! test -f "${ompi_hostfile}" ; then
|
||||
echo "Could not fine ${ompi_hostfile}. Aborting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ompi_hosts=""
|
||||
for i in `cat "${ompi_hostfile}"` ; do
|
||||
if test -z "${ompi_hosts}" ; then
|
||||
ompi_hosts="${i}"
|
||||
else
|
||||
ompi_hosts="${ompi_hosts} ${i}"
|
||||
fi
|
||||
done
|
||||
|
||||
if test -z "${ompi_hosts}" ; then
|
||||
echo "Did not find any valid hostnames in ${ompi_hostfile}. Aborting"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# launch procs
|
||||
#
|
||||
# fire up a bunch of procs...
|
||||
#
|
||||
######################################################################
|
||||
launch_procs() {
|
||||
local args="$*"
|
||||
set -- ${ompi_hosts}
|
||||
local i
|
||||
|
||||
if test -z "${args}" ; then
|
||||
echo "Did not find valid MPI app to start - being a coward and aborting."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
do_prep_environ
|
||||
|
||||
# do N - 1 procs in the loop not waiting around
|
||||
for (( i=0 ; i < ${ompi_numprocs} - 1 ; i++)) ; do
|
||||
do_start_proc "${1}" "${i}" "0" "${args}"
|
||||
shift
|
||||
if test -z "${1}" ; then
|
||||
set -- ${ompi_hosts}
|
||||
fi
|
||||
done
|
||||
|
||||
# do the Nth proc and wait around
|
||||
do_start_proc "${1}" "${i}" "1" "${args}"
|
||||
}
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# Do the prep work
|
||||
#
|
||||
######################################################################
|
||||
ompi_jobid="${$}"
|
||||
|
||||
|
||||
######################################################################
|
||||
#
|
||||
# exit cleanly
|
||||
#
|
||||
######################################################################
|
||||
|
||||
make_hosts_list
|
||||
|
||||
launch_procs "${ompi_app_args}"
|
||||
|
||||
exit 0
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user