--- +++ @@ -302,7 +302,23 @@ . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -403,7 +419,7 @@ did= vid= user= -usersubname= +usernoext= objs= qid=background cpu= @@ -571,7 +587,7 @@ justlist=yes ;; -fe* | -FE*) - feature=$value + feature=$value ;; -pr* | -PR*) @@ -667,50 +683,19 @@ esac ;; -u* | -U*) - user=`dirname $value`/`$BASENAME $value .f` - usersubname=$user - basefile=`$BASENAME $value` - if test ${basefile##*.} = f - then - user=`dirname $value`/`$BASENAME $value .f` - usersubname=$user.f - elif test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - usersubname=$user.F - elif test ${basefile##*.} = f90 - then - user=`dirname $value`/`$BASENAME $value .f90` - usersubname=$user.f90 - elif test ${basefile##*.} = F90 - then - user=`dirname $value`/`$BASENAME $value .F90` - usersubname=$user.F90 - fi + user=$value case $user in \/*) ;; *) user=`pwd`/$user - usersubname=`pwd`/$usersubname ;; esac - if test ! -f $usersubname - then - if test -f $usersubname.f - then - usersubname=$usersubname.f - elif test -f $usersubname.F - then - usersubname=$usersubname.F - elif test -f $usersubname.f90 - then - usersubname=$usersubname.f90 - elif test -f $usersubname.F90 - then - usersubname=$usersubname.F90 - fi - fi + usernoext=$user + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ;; -obj | -OBJ) objs="$value" @@ -730,19 +715,19 @@ ;; esac ;; - -dl | -DL) - case $value in - y* | Y*) - deletelog=yes - ;; - n* | N*) - deletelog=no - ;; - *) - ;; - esac - - ;; + -dl | -DL) + case $value in + y* | Y*) + deletelog=yes + ;; + n* | N*) + deletelog=no + ;; + *) + ;; + esac + + ;; -at | -AT) att=$value ;; @@ -1190,12 +1175,12 @@ fi fi fi - if test "$usersubname" + if test "$user" then - if test ! -f $usersubname + if test ! -f $user then error="$error -user subroutine file $usersubname not accessible" +user subroutine file $user not accessible" fi fi if test "$objs" @@ -1369,7 +1354,7 @@ else error="$error job id required" - fi +fi fi case $qid in @@ -1514,7 +1499,7 @@ Marc shared lib : $progdll Version type : $mode Job ID : $DIRJID/$jid$extra_job_info -User subroutine name : $usersubname +User subroutine name : $user User objects/libs : $objs Restart file job ID : $rid Substructure file ID : $sid @@ -1545,7 +1530,7 @@ Marc shared lib : $progdll Version type : $mode Job ID : $DIRJID/$jid$extra_job_info -User subroutine name : $usersubname +User subroutine name : $user User objects/libs : $objs Restart file job ID : $rid Substructure file ID : $sid @@ -1668,7 +1653,7 @@ ;; esac fi - $ECHO "User subroutine name ($usersubname)? $ECHOTXT" + $ECHO "User subroutine name ($user)? $ECHOTXT" read value if test "$value" then @@ -1677,50 +1662,19 @@ user= ;; *) - user=`dirname $value`/`$BASENAME $value .f` - usersubname=$user - basefile=`$BASENAME $value` - if test ${basefile##*.} = f - then - user=`dirname $value`/`$BASENAME $value .f` - usersubname=$user.f - elif test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - usersubname=$user.F - elif test ${basefile##*.} = f90 - then - user=`dirname $value`/`$BASENAME $value .f90` - usersubname=$user.f90 - elif test ${basefile##*.} = F90 - then - user=`dirname $value`/`$BASENAME $value .F90` - usersubname=$user.F90 - fi + user=$value case $user in - \/*) - ;; - *) + \/*) + ;; + *) user=`pwd`/$user - usersubname=`pwd`/$usersubname - ;; - esac - if test ! -f $usersubname - then - if test -f $usersubname.f - then - usersubname=$usersubname.f - elif test -f $usersubname.F - then - usersubname=$usersubname.F - elif test -f $usersubname.f90 - then - usersubname=$usersubname.f90 - elif test -f $usersubname.F90 - then - usersubname=$usersubname.F90 - fi - fi + ;; + esac + usernoext=$user + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` + usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` ;; esac fi @@ -2255,11 +2209,12 @@ # # user subroutine used # +# add DAMASK options for linking + DAMASK="-lstdc++" if test "$user" then -# program=$user.marc - program=$DIRJOB/`$BASENAME $user .f`.marc + program=$usernoext.marc case $program in \/* | \.\/*) bd= @@ -2372,7 +2327,7 @@ fi if test "$user" then - execpath=$DIRJOB/`$BASENAME $user .f`.marc + execpath=$usernoext.marc usersub=1 fi export execpath @@ -3255,44 +3210,27 @@ echo if test "$user" then - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - + userobj=$usermoext.o fi cat > $jid.runmarcscript << END4 if test "$user" then - if test ${basefile##*.} = f - then - ln -sf "$user.f" "$usersub" - fi if test $MACHINENAME = "CRAY" then - $FORTRAN $usersub || \ + $DFORTRANMP $user || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" exit 1 } /bin/rm $program 2>/dev/null else - $FORTRAN $usersub -o $userobj || \ + $DFORTRANMP $user -o $userobj || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" exit 1 } /bin/rm $program 2>/dev/null fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi fi @@ -3312,10 +3250,11 @@ $TKLIBS \ $MRCLIBS \ $METISLIBS \ - $SFLIB \ + $DAMASK \ + $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" exit 1 @@ -3325,6 +3264,8 @@ prgsav=yes fi /bin/rm $userobj 2>/dev/null +/bin/rm $DIRJOB/*.mod 2>/dev/null +/bin/rm $DIRJOB/*.smod 2>/dev/null # # run marc @@ -3371,7 +3312,7 @@ fi else if test $cpdll = yes; then - filename=`basename $usersubname .f` + filename=$usernoext /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null fi if test $rmdll = yes @@ -3537,7 +3478,7 @@ # first copy over the user sub if local directories if test ${dirstatus[$counter]} = "local" then - $RCP $user.f $i:$DIR1/ + $RCP $user $i:$DIR1/ fi # do the compilation on the other machine if test ${dirstatus[$counter]} = "shared" @@ -3550,21 +3491,21 @@ remoteuser=$DIR1/`$BASENAME $user` $RSH $i /bin/rm $remoteprog 2> /dev/null echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog + $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog # check if successful, the new executable should be there line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` if test "$line" then echo compilation and linking successful on host $i else - echo "$0: compile failed for $user.f on host $i" + echo "$0: compile failed for $user on host $i" echo " $PRODUCT Exit number 3" exit 1 fi # remove the user subroutine on remote machine if test ${dirstatus[$counter]} = "local" then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null + $RSH $i /bin/rm $remoteuser 2> /dev/null fi fi fi @@ -3574,39 +3515,27 @@ if test "$userhost" then echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" + echo "Compiling and linking user subroutine $user on host `hostname`" fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi + userobj=$usernoext.o if test $MACHINENAME = "CRAY" then - $FORTRAN $usersub || \ + $DFORTRANMP $user || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" echo " $PRODUCT Exit number 3" exit 1 } /bin/rm $program 2>/dev/null else - $FORTRAN $usersub -o $userobj || \ + $DFORTRANMP $user -o $userobj || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" echo " $PRODUCT Exit number 3" exit 1 } /bin/rm $program 2>/dev/null fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi fi # if test $user @@ -3626,10 +3555,11 @@ $TKLIBS \ $MRCLIBS \ $METISLIBS \ - $SFLIB \ + $DAMASK \ + $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" echo " $PRODUCT Exit number 3" @@ -3667,6 +3597,8 @@ prgsav=yes fi # if test $link /bin/rm $userobj 2>/dev/null +/bin/rm $DIRJOB/*.mod 2>/dev/null +/bin/rm $DIRJOB/*.smod 2>/dev/null # # run marc @@ -3725,42 +3657,42 @@ counter=0 if test -f "$host_filt" then - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost + for i in `$AWK -v n=$numfield '{print $n}' $host_filt` + do + ibase=${i%%.*} + if test $ibase != $thishost + then + counter=$((counter+1)) + DIR1=$DIRJOB + line=`grep -v '^#' $userhost | grep "^$ibase "` + workdir=`echo $line | $AWK '{print $3}'` + if test -n "$workdir" then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi + DIR1=$workdir fi - done - fi + # if an incompatible host uses shared directory, + # then the root machine deletes the executable + if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" + then + hname=_$ibase + /bin/rm ${execname}$hname + fi + # if local directory used, the remote machine + # deletes the executable + if test ${dirstatus[$counter]} = "local" + then + $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null + fi + fi + done fi fi +fi fi else #dllrun >0 if test $cpdll = yes; then - filename=`basename $usersubname .f` + filename=$usernoext /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null fi if test $rmdll = yes;then @@ -3885,7 +3817,7 @@ # first copy over the user sub if local directories if test ${dirstatus[$counter]} = "local" then - $RCP $user.f $i:$DIR1/ + $RCP $user $i:$DIR1/ fi # do the compilation on the other machine if test ${dirstatus[$counter]} = "shared" @@ -3898,20 +3830,20 @@ remoteuser=$DIR1/`$BASENAME $user` $RSH $i /bin/rm $remoteprog 2> /dev/null echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog + $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog # check if successful, the new executable should be there line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` if test "$line" then echo compilation and linking successful on host $i else - echo "$0: compile failed for $user.f on host $i" + echo "$0: compile failed for $user on host $i" exit 1 fi # remove the user subroutine on remote machine if test ${dirstatus[$counter]} = "local" then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null + $RSH $i /bin/rm $remoteuser 2> /dev/null fi fi fi @@ -3921,37 +3853,25 @@ if test "$userhost" then echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" + echo "Compiling and linking user subroutine $user on host `hostname`" fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi + userobj=$usernoext.o if test $MACHINENAME = "CRAY" then - $FORTRAN $usersub || \ + $DFORTRANMP $user || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" exit 1 } /bin/rm $program 2>/dev/null else - $FORTRAN $usersub -o $userobj || \ + $DFORTRANMP $user -o $userobj || \ { - echo "$0: compile failed for $user.f" + echo "$0: compile failed for $user" exit 1 } /bin/rm $program 2>/dev/null fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi fi # if test $user @@ -3971,10 +3891,11 @@ $TKLIBS \ $MRCLIBS \ $METISLIBS \ + $DAMASK \ $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" exit 1 @@ -4011,7 +3932,8 @@ prgsav=yes fi # if test $link /bin/rm $userobj 2>/dev/null - +/bin/rm $DIRJOB/*.mod 2>/dev/null +/bin/rm $DIRJOB/*.smod 2>/dev/null # done if no job id given if test -z "$jid" then @@ -4051,7 +3973,7 @@ RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " fi -$RUN_JOB + $RUN_JOB if test $nprocd -gt 1 then @@ -4095,42 +4017,42 @@ counter=0 if test -f "$host_filt" then - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost + for i in `$AWK -v n=$numfield '{print $n}' $host_filt` + do + ibase=${i%%.*} + if test $ibase != $thishost + then + counter=$((counter+1)) + DIR1=$DIRJOB + line=`grep -v '^#' $userhost | grep "^$ibase "` + workdir=`echo $line | $AWK '{print $3}'` + if test -n "$workdir" then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi + DIR1=$workdir fi - done - fi + # if an incompatible host uses shared directory, + # then the root machine deletes the executable + if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" + then + hname=_$ibase + /bin/rm ${execname}$hname + fi + # if local directory used, the remote machine + # deletes the executable + if test ${dirstatus[$counter]} = "local" + then + $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null + fi + fi + done fi fi +fi fi else #dllrun >0 if test $cpdll = yes; then - filename=`basename $usersubname .f` + filename=$usernoext /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null fi if test $rmdll = yes;then