|
请问一下,我看molpro手册上说可以通过更改bin/molpro中的-d -I -W的选项更改默认环境变量,但是我打开molpro文件怎么没有看到这几个选项啊?
我的molpro文件如下:
- #!/bin/sh
- MOLPRO_PREFIX='/home/hexin/molpro/molprop_2012_1_Linux_x86_64_i8'
- exe="${MOLPRO_PREFIX}/bin/molpro.exe"
- HOSTFILE_FORMAT="%u %N %n %x %d"
- LAUNCHER="${MOLPRO_PREFIX}/parallel.x %x"
- envlist="LD_LIBRARY_PATH"
- LD_LIBRARY_PATH=":$LD_LIBRARY_PATH"
- USER=${USER:-$LOGNAME}
- if [ "x`hostname`" != x ] ; then
- HOST="`hostname`"
- else
- # used previously, but sometimes the variables were not set correctly
- HOST=${HOST:-${HOSTNAME:-`hostname`}}
- HOST="`echo ${HOST} | sed -e 's/\..*//g'`"
- fi
- AIXTHREAD_SCOPE=${AIXTHREAD_SCOPE:-"s"}
- if [ x"$MOLPRO_OPTIONS" != x ] ; then
- set -- $MOLPRO_OPTIONS "$@"
- MOLPRO_OPTIONS=""
- fi
- hostfile="${TMPDIR:-/tmp}/procgrp.$"
- MOLPRO_OPTIONS_FILE="${TMPDIR:-/tmp}/molpro_options.$"
- MOLPRO_NOARG="1"
- logfile=1
- MP_NODES=${MP_NODES:-0}
- MP_PROCS=${MP_PROCS:-1}
- if [ x"$PBS_NODEFILE" != x ] ; then
- nodefile="$PBS_NODEFILE" # PBS
- elif [ x"$QSUB_NODEINF" != x ] ; then
- nodefile="$QSUB_NODEINF" # NQS
- elif [ x"$PE_HOSTFILE" != x ] ; then
- nodefile="$PE_HOSTFILE" # SunGridEngine
- elif [ x"$LSB_DJOB_HOSTFILE" != x ]; then
- nodefile="$LSB_DJOB_HOSTFILE" # LSF
- elif [ x"$LSB_HOSTS" != x ]; then
- nodefile="${TMPDIR:-/tmp}/nodefile.$" # Lava
- rm -f "${nodefile}"
- for h in $LSB_HOSTS ; do echo $h >> "${nodefile}" ; done
- else
- nodefile=""
- fi
- nodelist=
- NODELIST=
- OMP_NUM_THREADS=${OMP_NUM_THREADS:-1}
- proc=0
- RT_GRQ=${RT_GRQ:-"ON"}
- verbose=0
- envlist="$envlist AIXTHREAD_SCOPE MOLPRO_PREFIX MP_NODES MP_PROCS \
- MP_TASKS_PER_NODE MOLPRO_NOARG MOLPRO_OPTIONS MOLPRO_OPTIONS_FILE \
- MPI_MAX_CLUSTER_SIZE PROCGRP RT_GRQ TCGRSH TMPDIR XLSMPOPTS"
- if [ "x${machine}" = xXT ] ; then
- SHMEM_SWAP_BACKOFF="150"
- CRAY_PORTALS_USE_BLOCKING_POLL="yes"
- XT_SYMMETRIC_HEAP_SIZE="1G"
- envlist="$envlist SHMEM_SWAP_BACKOFF CRAY_PORTALS_USE_BLOCKING_POLL XT_SYMMETRIC_HEAP_SIZE"
- fi
- molpro_help () {
- cat << _EOF_
- This help information relates to the shell script only, for details on
- options processed by the Molpro executable please refer to the Molpro
- manual.
- The main purpose of this shell script is to enable launching of the
- Molpro executable for parallel execution by setting up the environment,
- host files etc. It is possible to run the Molpro executable directly
- for serial builds, or launch with mpirun or equivalent for parallel
- builds.
- -h | --help : print this help information
- --hostfile-format : override the default hostfile format
- --launcher : override the default executable launcher
- --nodefile : override the default location of the node file
- -n | --tasks : specify number of processes
- -N | --task-specification : specify processes, nodes, threads (see Molpro manual for details)
- -t | --omp-num-threads : specify number of openmp threads (if enabled)
- --tcgssh : for TCGMSG builds, use ssh instead of rsh
- -v : verbose output (also passed onto the Molpro executable)
- -x : specify a different Molpro executable to run
- * : all other options passed on to the main Molpro executable
- _EOF_
- exit 0
- }
- while test "x$1" != x ; do
- case $1 in
- -h | --help ) molpro_help ;;
- --hostfile-format ) shift; HOSTFILE_FORMAT="$1" ;;
- --launcher ) shift; LAUNCHER="$1" ;;
- --nodefile ) shift; nodefile="$1" ;;
- -n | --tasks ) shift; nodelist="$1" ;;
- -n* ) nodelist="`echo "$1" | sed -e 's/^-n//g'`" ;;
- -N | --task-specification ) shift; NODELIST="$1" ;;
- -t | --omp-num-threads ) shift; OMP_NUM_THREADS="$1" ;;
- --tcgssh ) TCGRSH="`which ssh`" ;;
- -v ) verbose=1; MOLPRO_OPTIONS="$MOLPRO_OPTIONS -v";;
- -x ) shift; exe="$1" ;;
- * ) MOLPRO_OPTIONS="$MOLPRO_OPTIONS $1" ;;
- esac
- shift
- done
- # add executable directory to PATH for finding mrcc executables
- export PATH="`echo ${exe} | sed -e 's/\/[^\/]*$//g'`:${PATH}"
- if [ "x$LAUNCHER" = x ] ; then
- mode="serial"
- if [ "x$verbose" = x1 ] ; then echo " # SERIAL mode"; fi
- LAUNCHER="$exe"
- else
- mode="parallel"
- if [ "x$verbose" = x1 ] ; then echo " # PARALLEL mode"; fi
- # determine MP_PROCS
- MP_PROCS=1
- if [ "x$nodelist" != x ] ; then
- MP_PROCS="`echo $nodelist | sed -e 's/\/.*$//g' -e '/:/d'`"
- tasks_per_node="`echo $nodelist | sed -e 's/^.*\///g' -e 's/^[0-9]*$//g' -e 's/:.*$//g'`"
- k="`echo $nodelist | sed -e '/:/!d' -e 's/^.*://g'`"
- if [ "x$verbose" = x1 ] ; then
- echo " nodelist=$nodelist"
- echo " first =$MP_PROCS"
- echo " second =$tasks_per_node"
- echo " third =$k"
- fi
- if [ "x$k" != x ] ; then OMP_NUM_THREADS="$k"; fi
- fi
- XLSMPOPTS="parthds=$OMP_NUM_THREADS"
- if [ "x${tasks_per_node}" = x ] ; then
- LAUNCHER="`echo $LAUNCHER | sed -e 's/ -npernode %p//'`"
- else
- MPI_TASKS_PER_NODE="$tasks_per_node"
- MPI_MAX_CLUSTER_SIZE="$tasks_per_node"
- fi
- # set up & write a hostfile
- if [ "x$HOSTFILE_FORMAT" != x ] ; then
- HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%d/$working_dir/g'`"
- HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%N/$hostname/g'`"
- HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%n/1/g'`"
- HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%u/$user/g'`"
- HOSTFILE_FORMAT="`echo $HOSTFILE_FORMAT | sed -e 's/%x/$exe/g'`"
- if [ "x$verbose" = x1 ] ; then echo " HOSTFILE_FORMAT: $HOSTFILE_FORMAT"; fi
- working_dir="`pwd`"
- rm -f $hostfile
- if [ -r "$nodefile" ] ; then # get nodes from PBS, this should over ride MP_PROCS etc.
- user="$USER"
- nodes_used=0
- # some nodefiles contain other columns, assume node is in first column, nprocs in second
- cat $nodefile | while read line; do
- hostname="`echo $line | sed -e 's/ .*$//g'`"
- count="`echo $line | sed -e 's/^[^ ]* *//g' -e 's/ .*$//g'`"
- if [ x"$count" = x ] ; then count=1 ; fi
- while [ $count -gt 0 ]; do
- count=`expr $count - 1`
- nodes_used=`expr $nodes_used + 1`
- if [ "x$nodelist" != x ] ; then
- if [ $nodes_used -le $MP_PROCS ] ; then
- eval echo "$HOSTFILE_FORMAT" >> $hostfile
- fi
- else
- eval echo "$HOSTFILE_FORMAT" >> $hostfile
- fi
- done
- done
- MP_PROCS=`cat "$hostfile" | wc -l`
- elif [ "x$NODELIST" != x ] ; then # get nodes from -N option
- hostname="$HOST"
- user="$USER"
- NODELIST="`echo $NODELIST | sed -e 's/,/ /g'`"
- for i in $NODELIST; do
- eval `echo $i | awk -v RS=: '{if (int($1)==$1) print "count="$1; else print "hostname="$1}'`
- while [ $count -gt 0 ]; do
- count=`expr $count - 1`
- eval echo "$HOSTFILE_FORMAT" >> $hostfile
- done
- done
- MP_PROCS=`cat "$hostfile" | wc -l`
- else # local machine
- hostname="$HOST"
- user="$USER"
- count=$MP_PROCS
- > $hostfile
- while [ $count -gt 0 ]; do
- count=`expr $count - 1`
- eval echo "$HOSTFILE_FORMAT" >> $hostfile
- done
- fi
- # should sort hostfile somehow with sort on column with node names
- if [ "x$verbose" = x1 ] ; then echo; cat $hostfile; echo; fi
- # below is needed for tcgmsg, but really this should be treated more generally
- PROCGRP="$hostfile"
- fi
- LAUNCHER="`echo $LAUNCHER | sed -e 's/%x/$exe/g'`"
- LAUNCHER="`echo $LAUNCHER | sed -e 's/%h/$hostfile/g'`"
- LAUNCHER="`echo $LAUNCHER | sed -e 's/%n/$MP_PROCS/g'`"
- LAUNCHER="`echo $LAUNCHER | sed -e 's/%p/$tasks_per_node/g'`"
- for i in $envlist ; do
- eval j="$"$i
- if [ "x${j}" != x ] ; then LAUNCHER="`echo $LAUNCHER | sed -e 's/%e/'$i='
- $i' %e/g'`"; fi
- done
- LAUNCHER="`echo $LAUNCHER | sed -e 's/%e//g'`"
- fi
- for i in $envlist ; do
- eval j="$"$i
- if [ "x${j}" != x ] ; then
- export $i
- if [ "x$verbose" = x1 ] ; then echo " export $i='${j}'" ; fi
- else
- if [ "x$verbose" = x1 ] ; then echo " $i='${j}'" ; fi
- fi
- done
- if [ "x${OMP_NUM_THREADS}" != x1 ] ; then
- MOLPRO_OPTIONS="${MOLPRO_OPTIONS} -t ${OMP_NUM_THREADS}"
- fi
- LAUNCHER="`eval echo $LAUNCHER` $MOLPRO_OPTIONS"
- if [ "x$verbose" = x1 ] ; then echo "$LAUNCHER" ; fi
- if [ "x$mode" = xserial ] ; then
- exec $LAUNCHER
- else
- echo "${MOLPRO_OPTIONS}" > ${MOLPRO_OPTIONS_FILE}
- if [ x"`uname -s`" = xDarwin ] ; then
- tt=`lsof -p $|egrep ' 0u *CHR'| sed -e 's/^.* *//'|grep '/dev/tty'`
- if [ x"$tt" = x ] ; then
- eval $LAUNCHER
- rc=$?
- else
- eval $LAUNCHER </dev/null
- rc=$?
- fi
- else
- eval $LAUNCHER
- rc=$?
- fi
- fi
- if [ "x${LSB_HOSTS}" != x ] && [ "x${LSB_DJOB_HOSTFILE}" = x ]; then rm -f "${nodefile}" ; fi
- rm -f ${hostfile} ${MOLPRO_OPTIONS_FILE}
- exit ${rc}
复制代码
|
|