source: branches/libIGCM_CESMEP/ins_job @ 1564

Last change on this file since 1564 was 1564, checked in by ssenesi, 19 months ago

fix on commit done for r1563, forgot to commit ins_job

  • Property svn:executable set to *
  • Property svn:keywords set to Revision Author Date
File size: 23.3 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Jacques Belier
5# Contact:
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13#---------------------------------------------------------------------
14#- Installation of jobs according to environment
15#---------------------------------------------------------------------
16function ins_job_Usage
17{
18print - "
19ins_job installs the jobs in the directories
20which contain a file config.card
21
22ins_job must be launched on the host
23on which the job will be submitted
24
25Usage :
26  ${b_n} [-h] [-v] [-e]
27  or on irene/TGCC :
28  ${b_n} [-h] [-v] [-e] [-p project] [-q type_of_node] [-c number of cores]
29  or on ada /IDRIS
30  ${b_n} [-h] [-v] [-e] [-m MPI environment]
31Options :
32  -h                  : help
33  -v                  : verbose mode
34  -e                  : turn on ensemble mode (hindcast/forecast or date restart)
35  -f                  : ins_job is force to create jobs even if they already exist
36on irene only :
37  -p project          : add default project on irene
38  -q type_of_node     : add default type of nodes for postprocessing on irene skylake/xlarge
39  -c number of cores  : add default number of cores for postprocessing on irene 1-112
40on ada only :
41  - m MPI environment : add default MPI environment (Intel MPI or IBM MPI)
42  -t wall time        : change default wall time
43"
44}
45function ins_job_Warning
46{
47   [[ ${x_v} = 'verbose' ]] && print - "\n############### WARNING ###############";
48   [[ ${x_v} = 'verbose' ]] && print - "File ${n_f} already exists\nin directory ${j}";
49   [[ ${x_v} = 'verbose' ]] && print - "You must delete this file to update !";
50}
51
52function ins_job_Check_JobName
53{
54  verif=${JobName##[a-zA-Z]*(?([.\-])[a-zA-Z0-9])}
55
56  if [ ${#verif} -ne 0 ] ; then
57    echo "################ ERROR ################"
58    echo "${JobName} is invalid."
59    echo "- JobName can only contain alphanumeric characters, \".\" and \"-\""
60    echo "- JobName must start with a letter"
61
62    ((NbErr=NbErr+1))
63
64    Status=1
65  else
66    Status=0
67  fi
68
69  return ${Status}
70}
71
72#-
73#     dirname     and      basename
74#-
75d_n=$(dirname ${0}); b_n=$(basename ${0});
76#-
77# Retrieving and validation of the options
78#-
79x_v='silencious';
80x_e=false;
81x_f=false;
82x_p=false;
83x_q=false;
84x_c=false;
85x_m=false;
86x_t=false;
87while getopts :hvefc:p:m:q:s:t: V ; do
88  case $V in
89  (h)  ins_job_Usage; exit 0;;
90  (v)  x_v='verbose';;
91  (e)  x_e=true;;
92  (f)  x_f=true;;
93  (p)  x_p=true
94       ProjectID=${OPTARG} ;;
95  (q)  x_q=true
96       ProjectNode=${OPTARG} ;;
97  (c)  x_c=true
98       ProjectCore=${OPTARG} ;;
99  (m)  x_m=true
100       MPIEnvironment=${OPTARG} ;;
101  (t)  x_t=true
102       WallTime=${OPTARG} ;;
103  (:)  echo ${b_n}" : -"${OPTARG}" option : missing value" 1>&2;
104       exit 2;;
105  (\?) echo ${b_n}" : -"${OPTARG}" option : not supported" 1>&2;
106       exit 2;;
107  esac
108done
109[ ${x_v} = 'silencious' ] && export DEBUG_sys=false
110shift $(($OPTIND-1));
111#-
112# Define working files
113#-
114F_MOD=$(cd ${d_n}'/..';/bin/pwd;)
115# [[ ${F_MOD##*/} != 'modipsl' ]] && \
116#  { print - "directory 'modipsl' unreachable"; exit 3; }
117W_W=${d_n}'/../libIGCM'
118[[ ! -d ${W_W} ]] && { print - "${W_W} unreachable"; exit 3; }
119libIGCM=$(cd ${W_W};/bin/pwd;)
120F_JOB=${libIGCM}'/AA_job';
121[[ ! -f ${F_JOB} ]] && { print - "${F_JOB} unreachable"; exit 3; }
122F_RCI=${libIGCM}'/run.card.init';
123[[ ! -f ${F_RCI} ]] && { print - "${F_RCI} unreachable"; exit 3; }
124#-
125# Accessing to functions (without stack)
126#-
127# No verbosity (0, 1, 2, 3)
128Verbosity=0
129# No de debug
130DEBUG_debug=false
131# Dont move libIGCM
132MirrorlibIGCM=false
133# Behave like computing job
134TaskType=computing
135# Source libIGCM
136. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
137. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
138. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
139. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
140. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
141if [ $x_e = 'true' ] ; then
142  . ${libIGCM}/libIGCM_ensemble/libIGCM_ensemble.ksh
143fi
144
145#-
146[[ ${x_v} = 'verbose' ]] && \
147 {
148  print - "";
149  print - '--- Host        : '${SYSTEM};
150  print - '--- modipsl     : '${F_MOD};
151  print - '--- libIGCM     : '${libIGCM};
152  print - '--- basic job   : '${F_JOB};
153  print - '--- basic card  : '${F_RCI};
154 }
155#-
156[[ ${x_v} = 'verbose' ]] && print - "\nInstallation of jobs for '${SYSTEM}'";
157#-
158
159NbErr=0
160
161#-
162# Define Project parameters to set up jobs header for Irene (TGCC)
163# on Irene define ProjectID and ProjectCore : option or answer
164# on Irene ProjectNode default projectnode set to xlarge since 17/10/2018
165#-
166
167
168if [ X"${SYSTEM}" == "Xirene" ] ; then
169
170  #- set ProjectID if required
171  if ( ! ${x_p} ) ; then
172    print - "Wait for the next question ..."
173    #- default ProjectID
174    ProjectID=$( ccc_myproject | grep -i irene |grep -i skylake | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | sort -u | grep -v gencmip6 | head -n 1 )
175    answer=""
176    print - "Hit Enter or give project ID (default is ${ProjectID}), possible projects are $( echo $( ccc_myproject | grep -i irene | grep -i skylake | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | grep -v gencmip6 | sort -u ) ) or other xxxcmip6 : $(for i in $(groups) ; do echo $i|grep -v gencmip6|grep .cmip6 1>/dev/null 2>&1 && echo -n $i " " ; done ; echo ) "
177    read answer
178
179    if [ "X${answer}" != "X" ] ; then
180      ProjectID=${answer}
181    fi
182
183  fi # if ( ! ${x_p} )
184
185  echo  ProjectID is ${ProjectID} at Irene
186
187
188  # set ProjectNode if required
189  if ( ! ${x_q} ) ; then 
190     #- default ProjectNode
191     ProjectNode="xlarge"
192     #- is xlarge possible for ${ProjectID} ?
193     echo $(ccc_myproject | grep -i irene | grep -i xlarge | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | grep -v gencmip6 | sort -u) $(for i in $(groups) ; do echo $i|grep -v gencmip6|grep .cmip6 1>/dev/null 2>&1 && echo -n $i " " ; done ) | grep ${ProjectID} >/dev/null 2>&1  || ProjectNode="xlarge"
194
195     if [ "X${ProjectNode}" == "Xxlarge" ] ; then
196       answerOK=false
197 
198       while ( ! ${answerOK} ) ; do
199         answer="" 
200         print - "Hit Enter or give TYPE OF NODE required for post-processing (default is \"${ProjectNode}\"), possible types of nodes are \"skylake\" or \"xlarge\" : " 
201         read answer
202         [ "X${answer}" == "X" ] || [ "X${answer}" == "Xskylake" ] || [ "X${answer}" == "Xxlarge" ] && answerOK=true
203       done
204 
205       if [ "X${answer}" != "X" ] ; then
206         ProjectNode=${answer} 
207       fi
208
209     else
210       print - "PostProcessing will be done on ${ProjectNode}"
211     fi
212 
213  fi # if ( ! ${x_q} )
214  echo ProjectNode for post-processing is ${ProjectNode} at Irene
215
216  #- ProjectNode is known (option or answer) set ProjectCoreMax
217  [ "${ProjectNode}" = "xlarge" ] && ProjectCoreMax="112" || ProjectCoreMax="48" 
218  #- ProjectCoreMax is 48 for standard and 112 for xlarge
219
220  if ( ! ${x_c} ) ; then
221    #- ProjectNode is known (option or answer), set ProjectCore default
222    [ "${ProjectNode}" = "xlarge" ] && ProjectCore="8" || ProjectCore="4" 
223
224    # let check minimum/maximum value 1/${ProjectCoreMax}
225
226    answerOK=false
227
228    while ( ! ${answerOK} ) ; do
229      answer=""
230      print - "possible numbers of cores are \"1\" to \"${ProjectCoreMax}\" for ${ProjectNode} : "
231      print - "Hit Enter or give NUMBER OF CORES required for post-processing (default is \"${ProjectCore}\")"
232      read answer
233      [ "X${answer}" == "X" ] || [ ${answer} -ge 1 -a ${answer} -le ${ProjectCoreMax} ] && answerOK=true
234    done
235
236    if [ "X${answer}" != "X" ] ; then
237      ProjectCore=${answer}
238    fi
239
240  fi # if ( ! ${x_c} )
241
242  echo ProjectCore for post-processing is ${ProjectCore}
243  #- ProjectCore is set (option or answer)
244
245  #- set WallTime if required
246  if ( ! ${x_t} ) ; then
247    #- default WallTime 1800 s
248    WallTime=1800
249    answer=""
250    print - "Hit Enter or give required wall time in seconds for computing job (default is \"${WallTime}\" seconds, maximum is 86400 seconds) "
251    read answer
252
253    if [ "X${answer}" != "X" ] ; then
254      WallTime=${answer}
255    fi
256
257  fi # if ( ! ${x_t} )
258   
259  echo Wall time limit is ${WallTime} seconds
260
261elif [ X"${SYSTEM}" == "Xirene-amd" ] ; then
262
263  #- set ProjectID if required
264  if ( ! ${x_p} ) ; then
265    print - "Wait for the next question ..."
266    #- default ProjectID
267    ProjectID=$( ccc_myproject | grep -i irene |grep -i rome | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | sort -u | grep -v gencmip6 | head -n 1 )
268    answer=""
269    print - "Hit Enter or give project ID (default is ${ProjectID}), possible projects are $( echo $( ccc_myproject | grep -i irene | grep -i rome | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | grep -v gencmip6 | sort -u ) ) or other xxxcmip6 : $(for i in $(groups) ; do echo $i|grep -v gencmip6|grep .cmip6 1>/dev/null 2>&1 && echo -n $i " " ; done ; echo ) "
270    read answer
271
272    if [ "X${answer}" != "X" ] ; then
273      ProjectID=${answer}
274    fi
275
276  fi # if ( ! ${x_p} )
277
278  echo  ProjectID is ${ProjectID} at Irene-amd
279
280  # set ProjectNode if required
281  if ( ! ${x_q} ) ; then 
282     #- default ProjectNode
283     ProjectNode="rome"
284     #- is xlarge possible for ${ProjectID} ?
285     echo $(ccc_myproject | grep -i irene | grep -i xlarge | gawk '{ if ( $3 ~ /^project$/ && $4 !~ /^tgcc/ ) { print $4 } }' | grep -v gencmip6 | sort -u) $(for i in $(groups) ; do echo $i|grep -v gencmip6|grep .cmip6 1>/dev/null 2>&1 && echo -n $i " " ; done ) | grep ${ProjectID} >/dev/null 2>&1  || ProjectNode="rome"
286
287     if [ "X${ProjectNode}" == "Xxlarge" ] ; then
288       answerOK=false
289 
290       while ( ! ${answerOK} ) ; do
291         answer="" 
292         print - "Hit Enter or give TYPE OF NODE required for post-processing (default is \"${ProjectNode}\"), possible types of nodes are \"rome\"  : " 
293         read answer
294         [ "X${answer}" == "X" ] || [ "X${answer}" == "Xrome" ] && answerOK=true
295       done
296 
297       if [ "X${answer}" != "X" ] ; then
298         ProjectNode=${answer} 
299       fi
300
301     else
302       print - "PostProcessing will be done on ${ProjectNode}"
303     fi
304 
305  fi # if ( ! ${x_q} )
306  echo ProjectNode for post-processing is ${ProjectNode} at Irene-amd
307
308  #- ProjectNode is known (option or answer) set ProjectCoreMax
309  [ "${ProjectNode}" = "xlarge" ] && ProjectCoreMax="112" || ProjectCoreMax="48" 
310  #- ProjectCoreMax is 48 for standard and 112 for xlarge
311
312  if ( ! ${x_c} ) ; then
313    #- ProjectNode is known (option or answer), set ProjectCore default
314    [ "${ProjectNode}" = "xlarge" ] && ProjectCore="8" || ProjectCore="4" 
315
316    # let check minimum/maximum value 1/${ProjectCoreMax}
317
318    answerOK=false
319
320    while ( ! ${answerOK} ) ; do
321      answer=""
322      print - "possible numbers of cores are \"1\" to \"${ProjectCoreMax}\" for ${ProjectNode} : "
323      print - "Hit Enter or give NUMBER OF CORES required for post-processing (default is \"${ProjectCore}\")"
324      read answer
325      [ "X${answer}" == "X" ] || [ ${answer} -ge 1 -a ${answer} -le ${ProjectCoreMax} ] && answerOK=true
326    done
327
328    if [ "X${answer}" != "X" ] ; then
329      ProjectCore=${answer}
330    fi
331
332  fi # if ( ! ${x_c} )
333
334  echo ProjectCore for post-processing is ${ProjectCore}
335  #- ProjectCore is set (option or answer)
336
337  #- set WallTime if required
338  if ( ! ${x_t} ) ; then
339    #- default WallTime 1800 s
340    WallTime=1800
341    answer=""
342    print - "Hit Enter or give required wall time in seconds for computing job (default is \"${WallTime}\" seconds, maximum is 86400 seconds) "
343    read answer
344
345    if [ "X${answer}" != "X" ] ; then
346      WallTime=${answer}
347    fi
348
349  fi # if ( ! ${x_t} )
350   
351  echo Wall time limit is ${WallTime} seconds
352
353elif [ X"${SYSTEM}" == "Xjeanzay" ] ; then
354
355  #- set ProjectID if required
356  if ( ! ${x_p} ) ; then
357    print - "Wait for the next question ..."
358    #- default ProjectID
359    ProjectID=$( echo $IDRPROJ )
360    answer=""
361    print - "Hit Enter or give project ID (default is ${ProjectID}), possible projects are: $( groups ; echo ) "
362    read answer
363
364    if [ "X${answer}" != "X" ] ; then
365      ProjectID=${answer}
366    fi
367
368  fi # if ( ! ${x_p} )
369
370  echo  ProjectID is ${ProjectID} at Jean-Zay
371
372  #- set WallTime if required
373  if ( ! ${x_t} ) ; then
374    #- default WallTime 30 minutes
375    WallTime=30
376    answer=""
377    print - "Hit Enter or give required wall time in minutes for computing job (default is \"${WallTime}\" minutes, maximum is 1200 minutes) "
378    read answer
379
380    if [ "X${answer}" != "X" ] ; then
381      WallTime=${answer}
382    fi
383
384  fi # if ( ! ${x_t} )
385   
386  echo Wall time limit is ${WallTime} minutes
387
388elif [ X"${SYSTEM}" == "Xada" ] ; then
389  if ( ! ${x_m} ) ; then
390    MPIEnvironment=IBM
391    # Intel MPI Environment.
392    answerOK=false     
393    while ( ! ${answerOK} ) ; do
394      answer=""
395      print - "Hit Enter or give MPI Environement (default is ${MPIEnvironment}), possible MPI environments are IBM (MPI IBM) and Intel (MPI Intel) :"
396      read answer
397      [ "X${answer}" == "X" ] || [ "X${answer}" == "XIBM" ] || [ "X${answer}" == "XIntel" ] && answerOK=true
398    done
399
400    if [ "X${answer}" != "X" ] ; then
401      MPIEnvironment=${answer}
402    fi
403  fi # if ( ! ${x_pm} )
404  echo MPIEnvironment is ${MPIEnvironment}
405
406elif [ X"${SYSTEM}" == "Xlxiv8" ] || [ X"${SYSTEM}" == "Xifort_CICLAD" ] ; then
407  # obelix, ciclad, climserv
408  echo ""
409  echo "You need to check and maybe adapt headers in the main job especially the line: "
410  echo "  #PBS -l nodes=x:ppn=y "
411  echo "where x is the number of nodes, y the number of cores per node and x*y is the total number of cores for the job. "
412  echo "y must not be bigger than the maximum numer of cores per node on the machine (often 8 or 16)."
413fi # if [ X"${SYSTEM}" == "Xirene" ]
414
415#-
416# Define the pattern string to substitute
417#-
418W_P='#-Q- '; W_W=${W_P}${SYSTEM}' ';
419#-
420# Extract list of 'config.card' files
421# and create jobs with AA_job
422#-
423F_CFG='config.card';
424F_CFG_ENS='ensemble.card';
425SUBMIT_DIR_ENS=$( pwd )
426for i in $( pwd )/config.card
427do
428  if [ ! -f $i ] ; then
429    echo ""
430    echo "################## WARNING ##################"
431    echo "No config.card available in current directory"
432    echo ""
433    continue
434  fi
435
436
437  j=$(cd ${i%/*};/bin/pwd;)
438  n_f=${F_RCI##*/};
439
440  if [ ! X$( echo ${j} | grep EXPERIMENTS ) = X ] ; then
441    # Do not treat config.card if it is in sub-directory of EXPERIMENTS
442    # Continue to next config.card
443    continue
444  else
445    [[ ${x_v} = 'verbose' ]] && print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}";
446  fi
447
448  # Find out if new structure and set .resol filename
449  if [ -d ${j}/EXPERIMENTS ] && [ -d ${j}/GENERAL ] ; then
450    # New Structure
451    [[ ${x_v} = 'verbose' ]] && echo "This is new configuration structure"
452    new_struct=yes
453    resolfile=$j/.resol
454  else
455    # Old Structure
456    new_struct=no
457    resolfile=$j/../.resol
458  fi
459
460  # Get all variables declared in section UserChoices in config.card
461  IGCM_card_DefineArrayFromSection ${j}'/'${F_CFG} UserChoices
462  # Set default values
463  config_UserChoices_ExpType=""
464  RESOL_ATM_3D=this_is_a_test_string
465  RESOL=this_is_another_test_string
466  ResolAtm=this_is_a_new_another_test
467  typeset option
468  for option in ${config_UserChoices[*]} ; do
469    IGCM_card_DefineVariableFromOption ${j}'/'${F_CFG} UserChoices ${option}
470  done
471
472  # Find the JobName : JobName might contain the variable RESOL_ATM_3D that will be replaced by what is in .resol file
473  if [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL_ATM_3D} ) = X ] ; then
474    TRUERESOL=$( tail -1 $resolfile | awk "-F=" '{print $2}' )
475    echo TRUERESOL = $TRUERESOL
476    JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL_ATM_3D}/${TRUERESOL}/" )
477    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName}
478  elif [ ! X$( echo ${config_UserChoices_JobName} | grep ${RESOL} ) = X ] ; then
479    TRUERESOL=$( head -1 $resolfile  )
480    JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${RESOL}/${TRUERESOL}/" )
481    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName}
482  elif [ ! X$( echo ${config_UserChoices_JobName} | grep ${ResolAtm} ) = X ] ; then
483    TRUERESOL=${config_UserChoices_ResolAtm}
484    JobName=$( echo ${config_UserChoices_JobName} | sed -e "s/${ResolAtm}/${TRUERESOL}/" )
485    IGCM_card_WriteOption ${j}'/'${F_CFG} UserChoices JobName ${JobName}
486  else
487    JobName=${config_UserChoices_JobName}
488  fi
489
490  # Check JobName validity : only alphanumerical characters, "-" and "." are authorized
491  ins_job_Check_JobName
492  RetCode=$?
493  [[ $RetCode -gt 0 ]] && continue
494
495  [[ ${x_v} = 'verbose' ]] && echo "JobName=${JobName}"
496
497  # Add specific treatment for new type of directory structure
498  if [ ${new_struct} == yes ] ; then
499
500    if [ "X${config_UserChoices_ExpType}" = X ] ; then
501      echo "\nERROR in ${j}/config.card"
502      echo "ins_job stops here"
503      echo "=> The variable ExpType must be added in config.card in section UserChoices"
504      echo "=> ExpType gives the directory for the .card configuration files for the wanted experiement. For exemple ExpType=IPSLCM5/historical"
505      exit 4
506    else
507      [[ ${x_v} = 'verbose' ]] && echo "ExpType= ${config_UserChoices_ExpType}"
508    fi
509
510    if [ -d ${j}/${JobName} ] ; then
511      echo "Directory ${j}/${JobName} exists already. It will not be overwritten."
512      echo "Remove the existing directory or change JobName before relaunching ins_job."
513      #continue
514      exit 
515    fi
516    echo "=> Submit directory ${JobName} will be created with cards from EXPERIMENTS/${config_UserChoices_ExpType}"
517    cp -r ${j}/EXPERIMENTS/${config_UserChoices_ExpType} ${j}/${JobName}
518    cp -r ${j}/GENERAL/* ${j}/${JobName}/.
519    cp -f ${j}/${F_CFG}  ${j}/${JobName}/.
520    if [ -f ${F_CFG_ENS} ] ; then
521      cp -f ${j}/${F_CFG_ENS}  ${j}/${JobName}/.
522      SUBMIT_DIR_ENS=${j}/${JobName}
523    fi
524    rm -f ${j}/${F_CFG}
525    # rm -f ${j}/${F_CFG_ENS}
526    rm -f ${j}/${F_CFG}.bak
527    j=${j}/${JobName}
528    [[ ${x_v} = 'verbose' ]] && echo new j=$j
529  fi
530  # end specific treatment for new type directory structure
531
532  [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; } || \
533   {
534    [[ ${x_v} = 'verbose' ]] && print - "\nCopying file ${F_RCI}\nin directory ${j}";
535    \cp ${F_RCI} ${j};
536   }
537
538  #==================================
539  # Read ListOfComponents section:
540  #echo
541  #IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents"
542
543  IGCM_card_DefineArrayFromSection  ${j}'/'${F_CFG} ListOfComponents
544  for comp in ${config_ListOfComponents[*]} ; do
545    IGCM_card_DefineArrayFromOption  ${j}'/'${F_CFG} ListOfComponents ${comp}
546  done
547  #IGCM_debug_Print 3 ${config_ListOfComponents[*]}
548
549  #==================================
550  # Read Executable section:
551  IGCM_card_DefineArrayFromSection ${j}'/'${F_CFG} Executable
552
553  # Define the execution context (MPMD, SPMD, MPI/OMP ...)
554  IGCM_config_ConfigureExecution ${j}'/'${F_CFG}
555
556  # coreNumber    : TOTAL NUMBER OF CORES
557  # mpiTasks      : TOTAL NUMBER OF MPI TASKS
558  # openMPthreads : NUMBER OF OpenMP THREADS
559
560  # File name for Job
561  n_f='Job_'${JobName};
562  [[ ${x_f} = 'false' ]] && [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; }
563  [[ ${x_v} = 'verbose' ]] && print - "\nWorking with file ${F_CFG}\nin directory ${j}\nfor ${n_f}";
564  sed -e "/^${W_W} */ s///" \
565      -e "/^${W_P}/d"       \
566      -e "s%::modipsl::%${F_MOD}%" \
567      -e "s/::Jobname::/${JobName}/" \
568      -e "s/::default_project::/${ProjectID}/" \
569      -e "s/::WallTime::/${WallTime}/" \
570      ${F_JOB} > ${j}'/'${n_f}
571  chmod u+x ${j}'/'${n_f}
572
573  # update Headers so that ressources description are accurate (MPMD/SPMD/...)
574  IGCM_sys_updateHeaders ${j}'/'${n_f}
575done
576
577#-
578# Extract list of AA_* files in libIGCM
579# and create jobs (for all except AA_job)
580#-
581for i in $(find ${libIGCM} -maxdepth 1 -name "AA_*" -print)
582do
583  i_f=${i##*/};
584  [[ ${i_f} = 'AA_job' ]] && { continue; }
585  j=${i%/*}; n_f=${i_f#AA_}'.job';
586  [[ ${x_f} = 'false' ]] && [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; }
587  [[ ${x_v} = 'verbose' ]] && print - "\nIn directory ${j}\n${i_f} -> ${n_f}"
588  sed -e "/^${W_W} */ s///" \
589      -e "s%::modipsl::%${F_MOD}%" \
590      -e "/^${W_P}/d"       \
591      -e "s/::default_node::/${ProjectNode}/" \
592      -e "s/::default_core::/${ProjectCore}/" \
593      -e "s/::default_project::/${ProjectID}/" \
594      -e "s/::default_post_project::/${ProjectID}/" \
595      ${i} > ${j}'/'${n_f}
596  chmod u+x ${j}'/'${n_f}
597done
598#-
599# set default_project in libIGCM_sys_irene and libIGCM_sys_jeanzay.
600#-
601if [ X"${SYSTEM}" == "Xirene" ] ; then
602  i=${libIGCM}/libIGCM_sys/libIGCM_sys_irene.ksh
603  sed -i -e "s/::default_project::/${ProjectID}/" ${i}
604elif [ X"${SYSTEM}" == "Xirene-amd" ] ; then
605  i=${libIGCM}/libIGCM_sys/libIGCM_sys_irene-amd.ksh
606  sed -i -e "s/::default_project::/${ProjectID}/" ${i}
607elif [ X"${SYSTEM}" == "Xjeanzay" ] ; then
608  i=${libIGCM}/libIGCM_sys/libIGCM_sys_jeanzay.ksh
609  sed -i -e "s/::default_project::/${ProjectID}/" ${i}
610fi
611#-
612# Limited to hindcast/forecast and date restart Ensemble for the time being
613if [ ${x_e} = 'true' ] ; then
614    if [ ! -f ${F_CFG_ENS} ] ; then
615       echo ""
616       echo "################## WARNING ##################"
617       echo "No ensemble.card available in current directory"
618       echo ""
619       exit
620      #  continue
621   fi
622
623  #.. Read input data from ensemble.card ..
624  SUBMIT_DIR=${SUBMIT_DIR_ENS}
625  RUN_DIR="${CCCWORKDIR}/ENSEMBLE_TMP"
626  #
627  # Copy initial things around and define variables (hindcast/forecast case)
628  IGCM_sys_Cd ${SUBMIT_DIR}
629  IGCM_ensemble_Init
630
631  if [[ ${ensemble_Ens_DATE_active} = 'y' ]] ; then
632    IGCM_sys_Cd ${SUBMIT_DIR}
633    IGCM_ensemble_DateInit
634    # As it says
635    IGCM_sys_Cd ${SUBMIT_DIR}
636    IGCM_ensemble_DateNonPeriodicStarts
637  fi
638
639  if [[ ${ensemble_Ens_PERTURB_active} = 'y' ]] ; then
640    IGCM_sys_Cd ${SUBMIT_DIR}
641    IGCM_ensemble_CastInit
642    # As it says
643    IGCM_sys_Cd ${SUBMIT_DIR}
644    IGCM_ensemble_CastPeriodicStarts
645    # As it says
646    #IGCM_sys_Cd ${SUBMIT_DIR}
647    #IGCM_ensemble_CastMemberList
648  fi
649  # Done
650  IGCM_sys_Cd ${SUBMIT_DIR}
651  # Clean
652  IGCM_sys_Rm -rf ${RUN_DIR}
653 
654fi
655#
656# Install a light copy of C-ESM-EP in SUBMIT_DIR/Cesmep and create a
657# C-ESM-EP launch script there.
658#
659[ ${new_struct?} == yes ] && prefix="$JobName/" 
660IGCM_card_DefineVariableFromOption ${prefix}config.card Post Cesmep
661
662if [ ${config_Post_Cesmep} != FALSE ]; then
663    IGCM_config_CommonConfiguration ${prefix}config.card
664    # Compute mail adress - inspired by libIGCM_post.ksh - should be turned in a function
665    if [ ! -z ${config_UserChoices_MailName} ] ; then
666        MailAdress=${config_UserChoices_MailName}
667    elif [ -f ~/.forward ] ; then
668        MailAdress=$( cat ~/.forward )
669    else
670        MailAdress=${USER}
671    fi
672    #
673    components=","
674    for comp in ${config_ListOfComponents[*]} ; do
675        components=${components}${comp}, ;
676    done
677    if [ X"${SYSTEM}" == "Xirene" ] || [ X"${SYSTEM}" == "Xirene-amd" ] ; then
678        IGCM_card_DefineVariableFromOption ${prefix}config.card UserChoices DateBegin
679        ${config_Post_CesmepCode}/libIGCM_install.sh $(pwd)/${prefix} \
680                   ${config_Post_CesmepComparison} $JobName ${R_SAVE} ${ProjectID} \
681                   ${MailAdress} ${config_UserChoices_DateBegin//-/} \
682                   ${config_Post_Cesmep} ${CesmepPeriod} ${config_Post_CesmepSlices} $components
683   else
684       echo -e "\nERROR Cannot (yet) handle CESMEP atlas on this computer system"
685       echo "=> Variable Cesmep in config.card's section Post must be set to FALSE"
686       exit 5
687   fi
688fi
689#-
690[[ ${x_v} = 'verbose' ]] && print - "";
691#-
692# That's all folks
693#-
694
695if [ ${NbErr} -ne 0 ] ; then
696  echo "################ ERROR ################"
697  echo "${NbErr} invalid JobName(s) found, check the log"
698fi
699
700
701exit 0;
Note: See TracBrowser for help on using the repository browser.