DAMASK_EICMD/install/MarcMentat/2022.1/Marc_tools/run_damask_hmp.patch

711 lines
22 KiB
Diff
Raw Normal View History

2022-05-04 18:26:50 +05:30
---
+++
@@ -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
+
#
#
@@ -405,7 +421,7 @@ sid=
did=
vid=
user=
-usersubname=
+usernoext=
objs=
qid=background
cpu=
@@ -573,7 +589,7 @@ do
justlist=yes
;;
-fe* | -FE*)
- feature=$value
+ feature=$value
;;
-pr* | -PR*)
@@ -676,50 +692,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"
@@ -739,19 +724,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
;;
@@ -1207,12 +1192,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"
@@ -1386,7 +1371,7 @@ else
else
error="$error
job id required"
- fi
+fi
fi
case $qid in
@@ -1531,7 +1516,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
@@ -1564,7 +1549,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
@@ -1687,7 +1672,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
@@ -1696,50 +1681,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
@@ -2274,11 +2228,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=
@@ -2391,7 +2346,7 @@ fi
fi
if test "$user"
then
- execpath=$DIRJOB/`$BASENAME $user .f`.marc
+ execpath=$usernoext.marc
usersub=1
fi
export execpath
@@ -3274,44 +3229,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
@@ -3331,10 +3269,11 @@ then
$TKLIBS \
$MRCLIBS \
$METISLIBS \
- $SFLIB \
+ $DAMASK \
+ $SFLIB \
$OPENSSL_LIB \
$SYSLIBS \
- $SECLIBS || \
+ $SECLIBS || \
{
echo "$0: link failed for ${user:+$userobj }$objs"
exit 1
@@ -3344,6 +3283,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
@@ -3390,7 +3332,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
@@ -3556,7 +3498,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"
@@ -3569,21 +3511,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
@@ -3593,39 +3535,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
@@ -3645,10 +3575,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"
@@ -3686,6 +3617,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
@@ -3744,42 +3678,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
@@ -3904,7 +3838,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"
@@ -3917,20 +3851,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
@@ -3940,37 +3874,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
@@ -3990,10 +3912,11 @@ then
$TKLIBS \
$MRCLIBS \
$METISLIBS \
+ $DAMASK \
$SFLIB \
$OPENSSL_LIB \
$SYSLIBS \
- $SECLIBS || \
+ $SECLIBS || \
{
echo "$0: link failed for ${user:+$userobj }$objs"
exit 1
@@ -4030,7 +3953,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
@@ -4070,7 +3995,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
@@ -4114,42 +4039,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