| 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 |  |  | # $Header: /u/gcmpack/MITgcm/tools/example_scripts/ACESgrid/test_aces_gnu_mpi,v 1.10 2012/08/26 18:07:38 jmc Exp $ | 
| 17 |  |  | # $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 |  |  | echo " sfx=$sfx , mpi=$mpi , mth=$mth" | 
| 30 |  |  |  | 
| 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 |  |  | module add gcc | 
| 44 |  |  | if test $mpi = 0 ; then | 
| 45 |  |  | EXE="./mitgcmuv > std_outp" | 
| 46 |  |  | else | 
| 47 |  |  | module add openmpi | 
| 48 |  |  | nn=`cat $PBS_NODEFILE | sort | uniq | wc -l` | 
| 49 |  |  | if [ $nn -gt 1 ] ; then dd=`expr $mpi % $nn` ; else dd=1 ; fi | 
| 50 |  |  | if [ $dd -eq 0 ] ; then | 
| 51 |  |  | npn=`expr $mpi / $nn` | 
| 52 |  |  | echo " Nb of nodes=$nn , nb of process per node=$npn" | 
| 53 |  |  | cat $PBS_NODEFILE | sort | uniq > mf | 
| 54 |  |  | EXE="mpirun -v -hostfile mf -npernode $npn ./mitgcmuv" | 
| 55 |  |  | else | 
| 56 |  |  | EXE="mpirun -v -np $mpi ./mitgcmuv" | 
| 57 |  |  | fi | 
| 58 |  |  | fi | 
| 59 |  |  |  | 
| 60 |  |  | if [ $mth -ge 1 ] ; then | 
| 61 |  |  | export OMP_NUM_THREADS=$mth | 
| 62 |  |  | export GOMP_STACKSIZE=400m | 
| 63 |  |  | fi | 
| 64 |  |  |  | 
| 65 |  |  | echo "list of loaded modules:" | 
| 66 |  |  | module list 2>&1 | 
| 67 |  |  | echo " " | 
| 68 |  |  | echo "run command: $EXE" | 
| 69 |  |  | eval $EXE | 
| 70 |  |  |  | 
| 71 |  |  | echo "" ; echo " run ended at: "`date` |