1 |
#!/bin/bash |
2 |
# |
3 |
#PBS -q four-twelve |
4 |
#PBS -N tst_adm |
5 |
#PBS -l nodes=2:ppn=2 |
6 |
#PBS -e /home/jmc/test_aces/output/tst_adm.stderr |
7 |
#PBS -o /home/jmc/test_aces/output/tst_adm.stdout |
8 |
|
9 |
# $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/aces_test_adm_mpi,v 1.16 2012/03/12 20:46:02 jmc Exp $ |
10 |
# $Name: $ |
11 |
|
12 |
# ACES-grid PBS-batch script for Adjoint MPI test using ifort (default=v8) & mpich |
13 |
|
14 |
if test -f /etc/profile.d/modules.sh ; then |
15 |
. /etc/profile.d/modules.sh |
16 |
fi |
17 |
# Note: added "ulimit -s unlimited" in file "~/.bashrc" |
18 |
# to pass big test (the 2 fizhi-cs-* test & adjoint tests) with MPI |
19 |
|
20 |
dNam='aces' |
21 |
TST_DIR="$HOME/test_$dNam" |
22 |
echo "start from TST_DIR='$TST_DIR' at: "`date` |
23 |
|
24 |
umask 0022 |
25 |
#- to get case insensitive "ls" (and order of tested experiments) |
26 |
export LC_ALL="en_US.UTF-8" |
27 |
|
28 |
HERE=$TST_DIR/output |
29 |
sfx='adm' |
30 |
module add mpich/intel |
31 |
module add netcdf/3.6.1/icc |
32 |
export MPI_INC_DIR='/usr/local/pkg/mpich/mpich-intel/include' |
33 |
OPTFILE="../tools/build_options/linux_ia32_ifort" |
34 |
#OPTFILE="$HERE/linux_ia32_ifort+mpi_aces" |
35 |
options="-adm -do -MPI 4 -mf $PBS_NODEFILE -devel" |
36 |
EXE="mpirun -machinefile TR_MFILE -v -np TR_NPROC ./mitgcmuv_ad" |
37 |
#- need this to get "staf": |
38 |
export PATH="$PATH:$HOME/bin" |
39 |
|
40 |
#- keep a copy of MPI_MFILE: |
41 |
cp -p $PBS_NODEFILE $HERE"/mf_"$sfx |
42 |
|
43 |
checkOut=1 |
44 |
#options="$options -nc" ; checkOut=0 |
45 |
#options="$options -q" ; checkOut=0 |
46 |
|
47 |
gcmDIR="MITgcm_$sfx" |
48 |
cd $TST_DIR |
49 |
#- check for disk space: |
50 |
#dsp=`df -P . | tail -1 | awk '{print $5}' | sed 's/%$//'` |
51 |
#if [ $dsp -gt 99 ] ; then |
52 |
dsp=`df -P . | tail -1 | awk '{print $4}'` |
53 |
if [ $dsp -le 1000000 ] ; then |
54 |
echo 'Not enough space on this disk => do not run testreport.' |
55 |
df . |
56 |
exit |
57 |
fi |
58 |
if [ $checkOut -eq 1 ] ; then |
59 |
if test -d $gcmDIR/CVS ; then |
60 |
#- remove previous output tar files and tar & remove previous output-dir |
61 |
/bin/rm -f $gcmDIR/verification/??_${dNam}-${sfx}_????????_?.tar.gz |
62 |
( cd $gcmDIR/verification |
63 |
listD=`ls -1 -d ??_${dNam}-${sfx}_????????_?` |
64 |
for dd in $listD |
65 |
do |
66 |
if test -d $dd ; then |
67 |
tar -cf ${dd}".tar" $dd > /dev/null 2>&1 && gzip ${dd}".tar" && /bin/rm -rf $dd |
68 |
RETVAL=$? |
69 |
if test "x$RETVAL" != x0 ; then |
70 |
echo "ERROR in tar+gzip prev outp-dir: $dd" |
71 |
echo " on '"`hostname`"' (return val=$RETVAL) but continue" |
72 |
fi |
73 |
fi |
74 |
done ) |
75 |
# ( cd $gcmDIR/verification ; ../tools/do_tst_2+2 -clean ) |
76 |
echo "cvs update of dir $gcmDIR :" |
77 |
( cd $gcmDIR ; cvs -q -d :pserver:cvsanon@mitgcm.org:/u/gcmpack update -P -d ) 2>&1 |
78 |
RETVAL=$? |
79 |
if test "x$RETVAL" != x0 ; then |
80 |
echo "cvs update on '"`hostname`"' fail (return val=$RETVAL) => exit" |
81 |
exit |
82 |
fi |
83 |
else |
84 |
echo "no dir: $gcmDIR/CVS => try a fresh check-out" |
85 |
checkOut=2 |
86 |
fi |
87 |
fi |
88 |
if [ $checkOut -eq 2 ] ; then |
89 |
if test -e $gcmDIR ; then |
90 |
rm -rf $gcmDIR |
91 |
fi |
92 |
# cvs co MITgcm |
93 |
cvs -d :pserver:cvsanon@mitgcm.org:/u/gcmpack co -P -d $gcmDIR MITgcm > /dev/null 2>&1 |
94 |
/usr/bin/find $gcmDIR -type d | xargs chmod g+rxs |
95 |
/usr/bin/find $gcmDIR -type f | xargs chmod g+r |
96 |
fi |
97 |
|
98 |
#- change dir to $gcmDIR/verification dir: |
99 |
if test -e $gcmDIR/verification ; then |
100 |
if [ $checkOut -lt 2 ] ; then |
101 |
echo " dir $gcmDIR/verification exist" ; fi |
102 |
cd $gcmDIR/verification |
103 |
else |
104 |
echo "no dir: $gcmDIR/verification => exit" |
105 |
exit |
106 |
fi |
107 |
|
108 |
echo ./testreport $options -of $OPTFILE -command \"$EXE\" -odir ${dNam}-$sfx |
109 |
./testreport $options -of $OPTFILE -command "$EXE" -odir ${dNam}-$sfx |