source: CPL/oasis3-mct/branches/OASIS3-MCT_5.0_branch/examples/spoc/spoc_communication/run_spoc @ 6331

Last change on this file since 6331 was 6331, checked in by aclsce, 17 months ago

Moved oasis-mct_5.0 in oasis3-mct/branches directory.

  • Property svn:executable set to *
File size: 5.3 KB
Line 
1#!/bin/ksh
2#set -xv
3######################################################################
4#
5host=`uname -n`
6user=`whoami`
7#
8## - Define paths
9srcdir=`pwd`
10datadir=$srcdir/data_spoc
11casename=`basename $srcdir`
12#
13## - Name of the executables
14    exe1=ocean
15    exe2=atmos
16#
17############### User's section #######################################
18#
19## - Define architecture and coupler
20arch=pgi_openmpi_openmp_linux  # training, belenos, nemo_lenovo, mac
21             # kraken , gfortran_openmpi_openmp_linux,
22             # pgi_openmpi_openmp_linux,
23             # pgi20.4_openmpi_openmp_linux (not work with 4.0)
24             # gnu1020_openmpi_openmp_linux (not work with 4.0)
25#
26# - Define number of processes to run each executable
27    nproc_exe1=4
28    nproc_exe2=4
29#
30############### End of user's section ################################
31#
32# - Define rundir
33    rundir=${srcdir}/work_${casename}_${nproc_exe1}_${nproc_exe2}
34#
35echo '*****************************************************************'
36echo '*** '$casename' : '$run
37echo ''
38echo 'Rundir       :' $rundir
39echo 'Architecture :' $arch
40echo 'Host         : '$host
41echo 'User         : '$user
42echo ''
43echo $exe1' runs on '$nproc_exe1 'processes'
44echo $exe2' runs on '$nproc_exe2 'processes'
45echo ''
46######################################################################
47### 1. Create rundir and copy everything needed
48#
49\rm -fr $rundir
50mkdir -p $rundir
51cp -f $datadir/*nc  $rundir/.
52cp -f $srcdir/$exe1 $rundir/.
53cp -f $srcdir/$exe2 $rundir/.
54cp -f $datadir/namcouple $rundir/.
55cd $rundir
56######################################################################
57### 2. Definition of mpirun command and batch script
58#
59if [ $arch == training ]; then
60    MPIRUN=/usr/local/intel/impi/2018.1.163/bin64/mpirun
61elif [ $arch == gfortran_openmpi_openmp_linux ]; then
62    MPIRUN=/usr/lib64/openmpi/bin/mpirun
63elif [ $arch == pgi_openmpi_openmp_linux ]; then
64    MPIRUN=/usr/local/pgi/linux86-64/18.7/mpi/openmpi-2.1.2/bin/mpirun
65elif [ $arch == gnu1020_openmpi_openmp_linux ]; then
66    MPIRUN=/usr/local/openmpi/4.1.0_gcc1020/bin/mpirun
67elif [ $arch == pgi20.4_openmpi_openmp_linux ]; then
68    MPIRUN=/usr/local/pgi/linux86-64/20.4/mpi/openmpi-3.1.3/bin/mpirun
69elif [ $arch == belenos ] ; then
70   (( nproc = $nproc_exe1 + $nproc_exe2 ))
71  cat <<EOF > $rundir/run_$casename.$arch
72#!/bin/bash
73#SBATCH --exclusive
74#SBATCH --partition=normal256
75#SBATCH --time=00:10:00
76#SBATCH --job-name=spoc     # job name
77#SBATCH -N 1                # number of nodes
78#SBATCH -n $nproc                # number of procs
79#SBATCH -o $rundir/$casename.o
80#SBATCH -e $rundir/$casename.e
81ulimit -s unlimited
82cd $rundir
83module load intelmpi/2018.5.274
84module load intel/2018.5.274
85module load netcdf-fortran/4.5.2_V2
86#
87export KMP_STACKSIZE=1GB
88export I_MPI_WAIT_MODE=enable
89#
90# Activate next line to run in standalone mode
91time mpirun -np $nproc_exe1 ./$exe1
92time mpirun -np $nproc_exe2 ./$exe2
93#
94EOF
95#
96elif [ ${arch} == nemo_lenovo ] ; then
97  MPIRUN=mpirun
98  (( nproc = $nproc_exe1 + $nproc_exe2 ))
99  cat <<EOF > $rundir/run_$casename.$arch
100#!/bin/bash -l
101# Nom du job
102#SBATCH --job-name spoc
103# Temps limite du job
104#SBATCH --time=00:10:00
105#SBATCH --partition debug
106#SBATCH --output=$rundir/$casename.o
107#SBATCH --error=$rundir/$casename.e
108# Nombre de noeuds et de processus
109#SBATCH --nodes=1 --ntasks-per-node=$nproc
110#SBATCH --distribution cyclic
111cd $rundir
112ulimit -s unlimited
113#SPOC module purge
114#SPOC module -s load compiler/intel/2015.2.164 mkl/2015.2.164 mpi/intelmpi/5.0.3.048
115#
116time $MPIRUN -np $nproc_exe1 ./$exe1
117time $MPIRUN -np $nproc_exe2 ./$exe2
118#
119EOF
120
121elif [ ${arch} == kraken ] ; then
122  (( nproc = $nproc_exe1 + $nproc_exe2 ))
123  cat <<EOF > $rundir/run_$casename.$arch
124#!/bin/bash -l
125#SBATCH --partition prod
126# Nom du job
127#SBATCH --job-name spoc
128# Temps limite du job
129#SBATCH --time=00:10:00
130#SBATCH --output=$rundir/$casename.o
131#SBATCH --error=$rundir/$casename.e
132# Nombre de noeuds et de processus
133#SBATCH --nodes=1 --ntasks-per-node=$nproc
134#SBATCH --distribution cyclic
135
136cd $rundir
137
138ulimit -s unlimited
139module purge
140module load compiler/intel/18.0.1.163
141module load mpi/intelmpi/2018.1.163
142module load lib/netcdf-fortran/4.4.4_impi
143module load lib/phdf5/1.8.20_impi
144time mpirun -np $nproc_exe1 ./$exe1
145time mpirun -np $nproc_exe2 ./$exe2
146EOF
147fi 
148 
149######################################################################
150### 3. Model execution or batch submission
151#
152if [ $arch == training ] || [ $arch == gfortran_openmpi_openmp_linux ] || [ $arch == gnu1020_openmpi_openmp_linux ] || [ $arch == pgi_openmpi_openmp_linux ] || [ $arch == pgi20.4_openmpi_openmp_linux ]; then
153    export OMP_NUM_THREADS=1
154    echo 'Executing the model using '$MPIRUN 
155    $MPIRUN -oversubscribe -np $nproc_exe1 ./$exe1
156    $MPIRUN -oversubscribe -np $nproc_exe2 ./$exe2
157elif [ $arch == belenos ]; then
158    echo 'Submitting the job to queue using sbatch'
159    sbatch $rundir/run_$casename.$arch
160    squeue -u $user
161elif [ ${arch} == nemo_lenovo ] || [ ${arch} == kraken ]; then
162    echo 'Submitting the job to queue using sbatch'
163    sbatch $rundir/run_$casename.$arch
164    squeue -u $user
165elif [ ${arch} == mac ]; then
166    echo 'Executing the model using mpirun'
167    mpirun --oversubscribe -np $nproc_exe1 ./$exe1
168    mpirun --oversubscribe -np $nproc_exe2 ./$exe2
169fi
170echo $casename 'is executed or submitted to queue.'
171echo 'Results are found in rundir : '$rundir 
172#
173######################################################################
Note: See TracBrowser for help on using the repository browser.