--- +++ @@ -302,7 +302,23 @@ fi . "$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 @@ sid= did= vid= user= -usersubname= +usernoext= objs= qid=background cpu= @@ -571,7 +587,7 @@ do justlist=yes ;; -fe* | -FE*) - feature=$value + feature=$value ;; -pr* | -PR*) @@ -674,50 +690,19 @@ do 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" @@ -737,19 +722,19 @@ do ;; 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 ;; @@ -1205,12 +1190,12 @@ post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 or $DIRPID/$pid.h5 not accessible 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" @@ -1384,7 +1369,7 @@ else else error="$error job id required" - fi +fi fi case $qid in @@ -1529,7 +1514,7 @@ Program name : $prog 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 @@ -1562,7 +1547,7 @@ Program name : $prog 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 @@ -1685,7 +1670,7 @@ Program name ($prog)? $ECHOTXT" ;; esac fi - $ECHO "User subroutine name ($usersubname)? $ECHOTXT" + $ECHO "User subroutine name ($user)? $ECHOTXT" read value if test "$value" then @@ -1694,50 +1679,19 @@ Program name ($prog)? $ECHOTXT" 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 @@ -2272,11 +2226,12 @@ fi # # 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= @@ -2389,7 +2344,7 @@ fi fi if test "$user" then - execpath=$DIRJOB/`$BASENAME $user .f`.marc + execpath=$usernoext.marc usersub=1 fi export execpath @@ -3272,44 +3227,27 @@ then 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 || \ + $DFORTHIGHMP $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 || \ + $DFORTHIGHMP $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 @@ -3329,10 +3267,11 @@ then $TKLIBS \ $MRCLIBS \ $METISLIBS \ - $SFLIB \ + $DAMASK \ + $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" exit 1 @@ -3342,6 +3281,9 @@ else prgsav=yes fi /bin/rm $userobj 2>/dev/null +/bin/rm $DIRJOB/*.mod 2>/dev/null +/bin/rm $DIRJOB/*.smod 2>/dev/null +/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null # # run marc @@ -3388,7 +3330,7 @@ if test $dllrun -eq 0; then 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 @@ -3554,7 +3496,7 @@ then # 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" @@ -3567,21 +3509,21 @@ then 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_hmp $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 @@ -3591,39 +3533,27 @@ then if test "$userhost" then echo - echo "Compiling and linking user subroutine $user.f 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 + echo "Compiling and linking user subroutine $user on host `hostname`" fi + userobj=$usernoext.o if test $MACHINENAME = "CRAY" then - $FORTRAN $usersub || \ + $DFORTHIGHMP $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 || \ + $DFORTHIGHMP $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 @@ -3643,10 +3573,11 @@ then $TKLIBS \ $MRCLIBS \ $METISLIBS \ - $SFLIB \ + $DAMASK \ + $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" echo " $PRODUCT Exit number 3" @@ -3684,6 +3615,9 @@ else # if test $link 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 +/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null # # run marc @@ -3742,42 +3676,42 @@ then 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 @@ -3902,7 +3836,7 @@ then # 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" @@ -3915,20 +3849,20 @@ then 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_hmp $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 @@ -3938,37 +3872,25 @@ then if test "$userhost" then echo - echo "Compiling and linking user subroutine $user.f 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 + echo "Compiling and linking user subroutine $user on host `hostname`" fi + userobj=$usernoext.o if test $MACHINENAME = "CRAY" then - $FORTRAN $usersub || \ + $DFORTHIGHMP $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 || \ + $DFORTHIGHMP $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 @@ -3988,10 +3910,11 @@ then $TKLIBS \ $MRCLIBS \ $METISLIBS \ + $DAMASK \ $SFLIB \ $OPENSSL_LIB \ $SYSLIBS \ - $SECLIBS || \ + $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" exit 1 @@ -4028,7 +3951,9 @@ else # if test $link 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 +/bin/rm $DIRJOB/*_genmod.f90 2>/dev/null # done if no job id given if test -z "$jid" then @@ -4068,7 +3993,7 @@ if test $ddm_arc -gt 0; then RUN_JOB="$BINDIR/exeddm $RUN_JOB -ddm $ddm_arc " fi -$RUN_JOB + $RUN_JOB if test $nprocd -gt 1 then @@ -4112,42 +4037,42 @@ then 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