1 | #!/bin/ksh |
---|
2 | #set -x |
---|
3 | ###################################################################### |
---|
4 | # |
---|
5 | ############### User's section ####################################### |
---|
6 | # |
---|
7 | ## - Define architecture and coupler |
---|
8 | arch=beaufix #tioman_pgi_mpich/corail/curie(CEA)/jade/neptune_gfortran |
---|
9 | MPILIB=MPI1 #MPI1 |
---|
10 | user=`whoami` |
---|
11 | # |
---|
12 | ## - Define paths |
---|
13 | srcdir=`pwd` |
---|
14 | datadir=$srcdir/data_oasis3 |
---|
15 | casename=`basename $srcdir` |
---|
16 | # |
---|
17 | # - Toy models: Define number of processes to run each executable |
---|
18 | # and name of executables |
---|
19 | # |
---|
20 | #name of the executables |
---|
21 | exe1=ocnice |
---|
22 | # number of processes for each executable |
---|
23 | nproc_exe1=16 |
---|
24 | # |
---|
25 | if [ ${arch} == tioman_pgi_mpich ]; then |
---|
26 | MPIRUN=/usr/local/pgi/linux86-64/2011/mpi/mpich/bin/mpirun |
---|
27 | rundir=${HOME}/oasis3-mct/examples/${casename}/work_${casename} |
---|
28 | elif [ ${arch} == tioman_intel_openmpi ]; then |
---|
29 | MPIRUN=/usr/local_intel12/openmpi143/bin/mpirun |
---|
30 | rundir=/space/${user}/oasis3-mct-examples_buildbot/${casename}/work_${casename} |
---|
31 | elif [ ${arch} == corail ]; then |
---|
32 | rundir=/lustre/globc/${user}/oasis3-mct-examples_buildbot/${casename}/work_${casename} |
---|
33 | elif [ ${arch} == curie ]; then |
---|
34 | rundir=/ccc/work/cont005/pa0490/coquartl/oasis3-mct-examples_buildbot/${casename}/work_${casename} |
---|
35 | elif [ ${arch} == jade ]; then |
---|
36 | rundir=/data/11coqu/oasis3-mct-examples_buildbot/${casename}/work_${casename} |
---|
37 | elif [ ${arch} == neptune_gfortran ]; then |
---|
38 | rundir=/scratch/globc/${user}/oasis3-mct-examples_buildbot/${casename}/work_${casename} |
---|
39 | elif [ ${arch} == ubuntu ]; then |
---|
40 | MPIRUN=mpirun |
---|
41 | rundir=${srcdir}/work_${casename} |
---|
42 | elif [ ${arch} == crayXE6 ]; then |
---|
43 | rundir=/zhome/academic/HLRS/imk/imkbreil/Programme/oasis/oasis3-mct/examples/tutorial/work_${casename} |
---|
44 | elif [ ${arch} == beaufix ]; then |
---|
45 | rundir=/scratch/work/cglo765/trunk_r2348/examples/test_1bin_ocnice/work_${casename} |
---|
46 | MPIRUN=/opt/softs/intel/impi/5.1.2.150/intel64/bin/mpirun |
---|
47 | elif [ ${arch} == ada ]; then |
---|
48 | MPIRUN=/opt/intel/impi/4.1.0.024/intel64/bin/mpirun |
---|
49 | rundir=/workgpfs/rech/ces/rces980/modBRETAGNE/oasis3-mct/examples/tutorial/work_${casename} |
---|
50 | fi |
---|
51 | # |
---|
52 | ############### End of user's section ################################ |
---|
53 | |
---|
54 | echo '' |
---|
55 | echo '*****************************************************************' |
---|
56 | echo '*** '$casename' : '$run |
---|
57 | echo '' |
---|
58 | echo 'Rundir :' $rundir |
---|
59 | echo 'Architecture :' $arch |
---|
60 | echo 'User : '$user |
---|
61 | echo '' |
---|
62 | echo $exe1' runs on '$nproc_exe1 'processes' |
---|
63 | #echo $exe2' runs on '$nproc_exe2 'processes' |
---|
64 | #echo $exe3' runs on '$nproc_exe3 'processes' |
---|
65 | echo '' |
---|
66 | echo '' |
---|
67 | ###################################################################### |
---|
68 | ### |
---|
69 | ### 1. Copy source example directory containing everything needed |
---|
70 | ### into rundir |
---|
71 | |
---|
72 | rm -r -f $rundir |
---|
73 | mkdir -p $rundir |
---|
74 | |
---|
75 | cp -f $datadir/*txt $rundir/. |
---|
76 | cp -f $datadir/*nc $rundir/. |
---|
77 | #cp -f $datadir/*.jnl $rundir/. |
---|
78 | #cp -f $datadir/*.gif $rundir/. |
---|
79 | |
---|
80 | cp -f $srcdir/$exe1 $rundir/. |
---|
81 | #cp -f $srcdir/$exe2 $rundir/. |
---|
82 | #cp -f $srcdir/$exe3 $rundir/. |
---|
83 | |
---|
84 | cp -f $datadir/namcouple $rundir/. |
---|
85 | |
---|
86 | # |
---|
87 | cd $rundir |
---|
88 | # |
---|
89 | ###################################################################### |
---|
90 | ### |
---|
91 | ### 3. Creation of configuration scripts |
---|
92 | |
---|
93 | ###--------------------------------------------------------------------- |
---|
94 | ### Linux + pgi |
---|
95 | ###--------------------------------------------------------------------- |
---|
96 | |
---|
97 | if [ $arch == tioman_pgi_mpich ] ; then |
---|
98 | host=`uname -n` |
---|
99 | if [ $nproc_exe1 == 1 ]; then |
---|
100 | cat <<EOF >> $rundir/appl-linux.conf |
---|
101 | $host 0 $rundir/$exe1 |
---|
102 | EOF |
---|
103 | else |
---|
104 | cat <<EOF >> $rundir/appl-linux.conf |
---|
105 | $host 0 $rundir/$exe1 |
---|
106 | EOF |
---|
107 | |
---|
108 | count=1 |
---|
109 | while [[ $count -lt $nproc_exe1 ]];do |
---|
110 | cat <<EOF >> $rundir/appl-linux.conf |
---|
111 | $host 1 $rundir/$exe1 |
---|
112 | EOF |
---|
113 | (( count += 1 )) |
---|
114 | done |
---|
115 | fi |
---|
116 | |
---|
117 | |
---|
118 | ###--------------------------------------------------------------------- |
---|
119 | ### CORAIL |
---|
120 | ###--------------------------------------------------------------------- |
---|
121 | elif [ $arch == corail ] ; then |
---|
122 | |
---|
123 | cat <<EOF > $rundir/run_$casename.$arch |
---|
124 | # Nom du job |
---|
125 | #PBS -N test_simple |
---|
126 | # Temps limite du job |
---|
127 | #PBS -l walltime=00:20:00 |
---|
128 | # Nombre de processus |
---|
129 | #PBS -l select=1:mpiprocs=24:ncpus=24 |
---|
130 | #PBS -l place=scatter:excl |
---|
131 | # adresse email a utiliser |
---|
132 | ##PBS -M your_email |
---|
133 | # Mail envoye a la fin du job |
---|
134 | #PBS -m ae |
---|
135 | |
---|
136 | cd $rundir |
---|
137 | |
---|
138 | source /usr/local/bin/intelmpi.sh |
---|
139 | ulimit -s unlimited |
---|
140 | # |
---|
141 | # |
---|
142 | #time mpirun -np $nproc_exe1 ./$exe1 : -np $nproc_exe2 ./$exe2 : -np $nproc_exe3 ./$exe3 |
---|
143 | #mpirun -np $nproc_exe1 ./$exe1 : -np $nproc_exe2 ./$exe2 : -np $nproc_exe3 ./$exe3 |
---|
144 | mpirun -np $nproc_exe1 ./$exe1 |
---|
145 | # |
---|
146 | EOF |
---|
147 | |
---|
148 | ###--------------------------------------------------------------------- |
---|
149 | ### BEAUFIX |
---|
150 | ###--------------------------------------------------------------------- |
---|
151 | elif [ $arch == beaufix ] ; then |
---|
152 | |
---|
153 | (( nproc = $nproc_exe1 )) |
---|
154 | |
---|
155 | cat <<EOF > $rundir/run_$casename.$arch |
---|
156 | #!/bin/bash |
---|
157 | #SBATCH --time=01:00:00 |
---|
158 | #SBATCH -p normal64 # partition/queue |
---|
159 | #SBATCH --job-name=toys # job name |
---|
160 | #SBATCH -N 1 # number of nodes |
---|
161 | #SBATCH -n $nproc # number of procs |
---|
162 | #SBATCH -o job.out%j |
---|
163 | #SBATCH -o job.err%j |
---|
164 | #SBATCH --exclusive |
---|
165 | |
---|
166 | ulimit -s unlimited |
---|
167 | # rundir must be in the TMPDIR |
---|
168 | cd $rundir |
---|
169 | module load netcdf/4.4.0 |
---|
170 | # |
---|
171 | # |
---|
172 | # Activate next line to run in coupled mode |
---|
173 | #time mpirun -np $nproc_exe1 ./$exe1 : -np $nproc_exe2 ./$exe2 |
---|
174 | # Activate next two lines to run both models stand alone |
---|
175 | time mpirun -np $nproc_exe1 ./$exe1 |
---|
176 | # |
---|
177 | EOF |
---|
178 | |
---|
179 | ###--------------------------------------------------------------------- |
---|
180 | ### NEPTUNE |
---|
181 | ###--------------------------------------------------------------------- |
---|
182 | elif [ $arch == neptune_gfortran ] ; then |
---|
183 | |
---|
184 | cat <<EOF > $rundir/run_$casename.$arch |
---|
185 | # Nom du job |
---|
186 | #PBS -N tests |
---|
187 | # Temps limite du job |
---|
188 | #PBS -l walltime=0:10:00 |
---|
189 | # Nombre de processus |
---|
190 | #PBS -q debug |
---|
191 | #PBS -l select=2:mpiprocs=16:ncpus=16 |
---|
192 | #PBS -l place=scatter:excl |
---|
193 | |
---|
194 | cd $rundir |
---|
195 | |
---|
196 | # To use Totalview |
---|
197 | #export DISPLAY=tioman.cerfacs.fr:0.0 |
---|
198 | export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH |
---|
199 | ulimit -s unlimited |
---|
200 | # |
---|
201 | # |
---|
202 | # To use Totalview |
---|
203 | #time mpirun -tv -np $nproc_exe1 ./$exe1 : -np $nproc_exe2 ./$exe2 : -np $nproc_exe3 ./$exe3 |
---|
204 | #time mpirun -np $nproc_exe1 ./$exe1 : -np $nproc_exe2 ./$exe2 : -np $nproc_exe3 ./$exe3 |
---|
205 | time mpirun -np $nproc_exe1 ./$exe1 |
---|
206 | # |
---|
207 | EOF |
---|
208 | |
---|
209 | ###--------------------------------------------------------------------- |
---|
210 | ### CURIE (normal nodes) |
---|
211 | ###--------------------------------------------------------------------- |
---|
212 | elif [ $arch == curie ] ; then |
---|
213 | |
---|
214 | cat <<EOF > $rundir/appl-curie.conf |
---|
215 | $nproc_exe1 $rundir/$exe1 |
---|
216 | EOF |
---|
217 | |
---|
218 | (( nproc = $nproc_exe1 )) |
---|
219 | |
---|
220 | cat <<EOF > $rundir/run_$casename.$arch |
---|
221 | #!/bin/bash |
---|
222 | #MSUB -r test_interp # Request name |
---|
223 | #MSUB -q standard # thin/standard nodes |
---|
224 | #MSUB -n $nproc # Number of tasks to use |
---|
225 | #MSUB -T 3600 # Elapsed time limit in seconds |
---|
226 | #MSUB -o $casename_%I.o # Standard output. %I is the job id |
---|
227 | #MSUB -e $casename_%I.e # Error output. %I is the job id |
---|
228 | #MSUB -A ra0982 # Project ID |
---|
229 | set -x |
---|
230 | cd $rundir |
---|
231 | ccc_mprun -f appl-curie.conf |
---|
232 | EOF |
---|
233 | |
---|
234 | ###----------------------------------------------------------------- |
---|
235 | ### JADE - CINES |
---|
236 | ###----------------------------------------------------------------- |
---|
237 | elif [ $arch == jade ] ; then |
---|
238 | (( NNODE = ( $nproc_exe1 ) / 8 )) |
---|
239 | (( RESTE = ( $nproc_exe1 ) - ( $NNODE * 8 ) )) |
---|
240 | if [[ $RESTE -gt 0 ]]; then |
---|
241 | if [[ $RESTE -lt 8 ]]; then |
---|
242 | (( NNODE = $NNODE + 1 )) |
---|
243 | fi |
---|
244 | fi |
---|
245 | |
---|
246 | echo $NNODE |
---|
247 | |
---|
248 | cat << EOF > $rundir/run_$casename.$arch |
---|
249 | #PBS -S /bin/bash |
---|
250 | #PBS -N OASIS |
---|
251 | #PBS -l walltime=00:10:00 |
---|
252 | #PBS -l select=$NNODE:ncpus=8:mpiprocs=8 |
---|
253 | #PBS -o $rundir/out |
---|
254 | #PBS -e $rundir/err |
---|
255 | #PBS -j oe |
---|
256 | # |
---|
257 | set -evx |
---|
258 | module load netcdf |
---|
259 | cd $rundir |
---|
260 | cat $PBS_NODEFILE |
---|
261 | ## Lancement executable |
---|
262 | which mpiexec |
---|
263 | export MPI_GROUP_MAX=100 |
---|
264 | time mpiexec -n $nproc_exe1 ./$exe1 |
---|
265 | |
---|
266 | EOF |
---|
267 | |
---|
268 | ###--------------------------------------------------------------------- |
---|
269 | ### CRAYXE6 |
---|
270 | ###--------------------------------------------------------------------- |
---|
271 | elif [ $arch == crayXE6 ] ; then |
---|
272 | |
---|
273 | (( nproc = $nproc_exe1 + $nproc_exe2 )) |
---|
274 | |
---|
275 | d_aus=lm_aus.log # Ausgabe- u. Fehlerdateien |
---|
276 | d_err=lm_fehler.log |
---|
277 | |
---|
278 | cat <<EOF > $rundir/run_$casename.$arch |
---|
279 | #!/bin/ksh |
---|
280 | # Nom du job |
---|
281 | #PBS -N ${casename} |
---|
282 | # Temps limite du job |
---|
283 | #PBS -l walltime=00:10:00 |
---|
284 | # Nombre de processus |
---|
285 | #PBS -l mppwidth=$nproc |
---|
286 | #PBS -l mppnppn=1 |
---|
287 | #PBS -l mppdepth=1 |
---|
288 | #PBS -o $d_aus |
---|
289 | #PBS -e $d_err |
---|
290 | # |
---|
291 | cd $rundir |
---|
292 | # |
---|
293 | ulimit -c unlimited |
---|
294 | export LIBDWD_FORCE_CONTROLWORDS=1 |
---|
295 | export LIBDWD_BITMAP_TYPE=ASCII |
---|
296 | # |
---|
297 | #export MPICH_GNI_DYNAMIC_CONN=disabled |
---|
298 | export MPICH_ENV_DISPLAY=1 |
---|
299 | export MPICH_GNI_MAX_EAGER_MSG_SIZE=64000 |
---|
300 | export MPICH_ABORT_ON_ERROR=1 |
---|
301 | export MALLOC_MMAP_MAX_=0 |
---|
302 | export MALLOC_TRIM_THRESHOLD_=-1 |
---|
303 | # |
---|
304 | aprun -n $nproc_exe1 ./$exe1 : -n $nproc_exe2 ./$exe2 |
---|
305 | # |
---|
306 | EOF |
---|
307 | |
---|
308 | ###--------------------------------------------------------------------- |
---|
309 | ### ada |
---|
310 | ###--------------------------------------------------------------------- |
---|
311 | elif [ $arch == ada ] ; then |
---|
312 | |
---|
313 | (( nproc = $nproc_exe1 + $nproc_exe2 )) |
---|
314 | |
---|
315 | cat <<EOF > $rundir/run_$casename.$arch |
---|
316 | #!/bin/ksh |
---|
317 | # ###################### |
---|
318 | # ## ADA IDRIS ## |
---|
319 | # ###################### |
---|
320 | # Nom de la requete |
---|
321 | # @ job_name = ${casename} |
---|
322 | # Type de travail |
---|
323 | # @ job_type = parallel |
---|
324 | # Fichier de sortie standard |
---|
325 | # @ output = Script_Output_${casename}.000001 |
---|
326 | # Fichier de sortie erreur (le meme) |
---|
327 | # @ error = Script_Output_${casename}.000001 |
---|
328 | # Nombre de processus demandes |
---|
329 | # @ total_tasks = ${nproc} |
---|
330 | # @ environment = "BATCH_NUM_PROC_TOT=32" |
---|
331 | # Temps CPU max. par processus MPI hh:mm:ss |
---|
332 | # @ wall_clock_limit = 0:30:00 |
---|
333 | # Fin de l entete |
---|
334 | # @ queue |
---|
335 | # |
---|
336 | # pour avoir l'echo des commandes |
---|
337 | set -x |
---|
338 | |
---|
339 | # on se place dans le repertoire rundir |
---|
340 | cd ${rundir} |
---|
341 | |
---|
342 | module load netcdf |
---|
343 | module load hdf5 |
---|
344 | |
---|
345 | # |
---|
346 | export KMP_STACKSIZE=64m |
---|
347 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/smplocal/pub/NetCDF/4.1.3/lib |
---|
348 | |
---|
349 | poe -pgmmodel MPMD -cmdfile run_file |
---|
350 | # |
---|
351 | EOF |
---|
352 | |
---|
353 | fi |
---|
354 | |
---|
355 | ###################################################################### |
---|
356 | ### |
---|
357 | ### 4. Execute the model |
---|
358 | |
---|
359 | if [ $arch == tioman_pgi_mpich ] ; then |
---|
360 | echo 'Executing the model using '$MPIRUN |
---|
361 | $MPIRUN -p4pg appl-linux.conf ./$exe1 > runjob.err |
---|
362 | elif [ $arch == ubuntu ] || [ $arch == tioman_intel_openmpi ] ; then |
---|
363 | echo 'Executing the model using '$MPIRUN |
---|
364 | $MPIRUN -np $nproc_exe1 ./$exe1 > runjob.err |
---|
365 | elif [ $arch == corail ]; then |
---|
366 | echo 'Submitting the job to queue using qsub' |
---|
367 | qsub -q submit $rundir/run_$casename.$arch |
---|
368 | qstat | grep $user |
---|
369 | elif [ $arch == curie ]; then |
---|
370 | ccc_msub $rundir/run_$casename.$arch |
---|
371 | ccc_mpp | grep $user |
---|
372 | elif [ $arch == jade ] ; then |
---|
373 | qsub $rundir/run_$casename.$arch |
---|
374 | qstat -awu $user |
---|
375 | elif [ $arch == neptune_gfortran ]; then |
---|
376 | echo 'Submitting the job to queue using qsub' |
---|
377 | qsub $rundir/run_$casename.$arch |
---|
378 | qstat | grep $user |
---|
379 | elif [ $arch == beaufix ]; then |
---|
380 | echo 'Submitting the job to queue using sbatch' |
---|
381 | sbatch $rundir/run_$casename.$arch |
---|
382 | squeue -u $user |
---|
383 | fi |
---|
384 | |
---|
385 | echo $casename 'is executed or submitted to queue.' |
---|
386 | echo 'Results are found in rundir : '$rundir |
---|
387 | |
---|
388 | ###################################################################### |
---|
389 | |
---|