1 |
jmc |
1.1 |
#!/bin/bash |
2 |
|
|
# |
3 |
|
|
#PBS -q four-twelve |
4 |
|
|
#PBS -N run_gnu_1 |
5 |
|
|
#PBS -l nodes=1:ppn=12 |
6 |
|
|
#PBS -e run_gnu.stderr |
7 |
|
|
#PBS -o run_gnu.stdout |
8 |
|
|
|
9 |
|
|
#- batch parameters are specified above (lines starting with #PBS); note that after 1rst |
10 |
|
|
# blank line (above), anything folowing "#" character is treated as comments |
11 |
|
|
# |
12 |
|
|
# example of a PBS batch script to run MITgcm on new (x86_64) acesgrid cluster |
13 |
|
|
# using executable compiled with gfortran (and OpenMPI if using MPI) |
14 |
|
|
# and running on /data/ disk(/net/eaps-80-11/data/) |
15 |
|
|
|
16 |
jmc |
1.2 |
# $Header: /u/gcmpack/MITgcm_contrib/jmc_script/run_gnu.pbs,v 1.1 2012/10/25 21:17:10 jmc Exp $ |
17 |
jmc |
1.1 |
# $Name: $ |
18 |
|
|
|
19 |
|
|
sfx=1 # directory suffix |
20 |
|
|
mpi=0 # number of MPI procs (=0 for non MPI run) |
21 |
|
|
mth=0 # number of OMP threads (=0 for non Multi-thread run) |
22 |
|
|
|
23 |
|
|
if test -f /etc/profile.d/modules.sh ; then |
24 |
|
|
. /etc/profile.d/modules.sh |
25 |
|
|
fi |
26 |
|
|
|
27 |
|
|
HERE=`pwd` |
28 |
|
|
echo "start from HERE='$HERE' at: "`date` |
29 |
jmc |
1.2 |
echo " sfx=$sfx , mpi=$mpi , mth=$mth , host="`hostname` |
30 |
jmc |
1.1 |
|
31 |
|
|
#- dir where to run mitgcmuv (batch job starts in home dir; need to "cd" to run dir): |
32 |
|
|
runD="/net/eaps-80-11/data/jm_c/exp/atm_gray/run_$sfx" |
33 |
|
|
echo -n " run in runD='$runD' on nodes: " |
34 |
|
|
cat $PBS_NODEFILE | sort | uniq |
35 |
|
|
cd $runD |
36 |
|
|
echo " sfx=$sfx , mpi=$mpi , mth=$mth" > mf_run |
37 |
|
|
cat $PBS_NODEFILE >> mf_run |
38 |
|
|
|
39 |
|
|
umask 0022 |
40 |
|
|
#- to get case insensitive "ls" (and order of tested experiments) |
41 |
|
|
export LC_ALL="en_US.UTF-8" |
42 |
|
|
|
43 |
jmc |
1.2 |
if [ $mth -ge 1 ] ; then |
44 |
|
|
export OMP_NUM_THREADS=$mth |
45 |
|
|
export GOMP_STACKSIZE=400m |
46 |
|
|
fi |
47 |
|
|
|
48 |
jmc |
1.1 |
module add gcc |
49 |
|
|
if test $mpi = 0 ; then |
50 |
|
|
EXE="./mitgcmuv > std_outp" |
51 |
|
|
else |
52 |
|
|
module add openmpi |
53 |
jmc |
1.2 |
EXE="mpirun -v" |
54 |
|
|
if [ $mth -ge 1 ] ; then EXE="$EXE -x OMP_NUM_THREADS -x GOMP_STACKSIZE" ; fi |
55 |
|
|
#- select which MPI procs to use |
56 |
jmc |
1.1 |
nn=`cat $PBS_NODEFILE | sort | uniq | wc -l` |
57 |
|
|
if [ $nn -gt 1 ] ; then dd=`expr $mpi % $nn` ; else dd=1 ; fi |
58 |
|
|
if [ $dd -eq 0 ] ; then |
59 |
|
|
npn=`expr $mpi / $nn` |
60 |
|
|
echo " Nb of nodes=$nn , nb of process per node=$npn" |
61 |
|
|
cat $PBS_NODEFILE | sort | uniq > mf |
62 |
jmc |
1.2 |
EXE="$EXE -hostfile mf -npernode $npn ./mitgcmuv" |
63 |
jmc |
1.1 |
else |
64 |
jmc |
1.2 |
EXE="$EXE -np $mpi ./mitgcmuv" |
65 |
jmc |
1.1 |
fi |
66 |
|
|
fi |
67 |
|
|
|
68 |
|
|
echo "list of loaded modules:" |
69 |
|
|
module list 2>&1 |
70 |
|
|
echo " " |
71 |
|
|
echo "run command: $EXE" |
72 |
|
|
eval $EXE |
73 |
|
|
|
74 |
|
|
echo "" ; echo " run ended at: "`date` |