source: trunk/libIGCM/ins_job @ 1547

Last change on this file since 1547 was 1547, checked in by rpennel, 3 years ago

correct ins_job wall time for TGCC (seconds instead of minutes)

  • Property svn:executable set to *
  • Property svn:keywords set to Revision Author Date
File size: 22.0 KB
RevLine 
[1164]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 :
[1274]26  ${b_n} [-h] [-v] [-e]
[1468]27  or on irene/TGCC :
[1471]28  ${b_n} [-h] [-v] [-e] [-p project] [-q type_of_node] [-c number of cores]
[1305]29  or on ada /IDRIS
30  ${b_n} [-h] [-v] [-e] [-m MPI environment]
[1164]31Options :
[1274]32  -h                  : help
33  -v                  : verbose mode
34  -e                  : turn on ensemble mode (hindcast/forecast or date restart)
[1401]35  -f                  : ins_job is force to create jobs even if they already exist
[1468]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
[1305]40on ada only :
41  - m MPI environment : add default MPI environment (Intel MPI or IBM MPI)
[1536]42  -t wall time        : change default wall time
[1164]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;
[1401]81x_f=false;
[1164]82x_p=false;
[1468]83x_q=false;
[1274]84x_c=false;
[1305]85x_m=false;
[1536]86x_t=false;
87while getopts :hvefc:p:m:q:s:t: V ; do
[1164]88  case $V in
89  (h)  ins_job_Usage; exit 0;;
90  (v)  x_v='verbose';;
91  (e)  x_e=true;;
[1401]92  (f)  x_f=true;;
[1164]93  (p)  x_p=true
94       ProjectID=${OPTARG} ;;
[1468]95  (q)  x_q=true
96       ProjectNode=${OPTARG} ;;
[1274]97  (c)  x_c=true
98       ProjectCore=${OPTARG} ;;
[1305]99  (m)  x_m=true
100       MPIEnvironment=${OPTARG} ;;
[1536]101  (t)  x_t=true
102       WallTime=${OPTARG} ;;
[1164]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#-
[1249]127# No verbosity (0, 1, 2, 3)
128Verbosity=0
129# No de debug
[1164]130DEBUG_debug=false
[1249]131# Dont move libIGCM
[1164]132MirrorlibIGCM=false
[1249]133# Behave like computing job
[1164]134TaskType=computing
[1249]135# Source libIGCM
[1164]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
[1242]140. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
[1164]141if [ $x_e = 'true' ] ; then
142  . ${libIGCM}/libIGCM_ensemble/libIGCM_ensemble.ksh
143fi
144
[1172]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
[1164]159NbErr=0
160
161#-
[1470]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
[1164]165#-
[1274]166
[1164]167
[1470]168if [ X"${SYSTEM}" == "Xirene" ] ; then
[1322]169
[1470]170  #- set ProjectID if required
[1437]171  if ( ! ${x_p} ) ; then
[1471]172    print - "Wait for the next question ..."
[1470]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 )
[1437]175    answer=""
[1470]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 ) "
[1437]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
[1465]187
[1470]188  # set ProjectNode if required
[1468]189  if ( ! ${x_q} ) ; then 
[1470]190     #- default ProjectNode
191     ProjectNode="xlarge"
[1471]192     #- is xlarge possible for ${ProjectID} ?
[1533]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"
[1471]194
195     if [ "X${ProjectNode}" == "Xxlarge" ] ; then
196       answerOK=false
[1468]197 
[1471]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
[1468]204 
[1471]205       if [ "X${answer}" != "X" ] ; then
206         ProjectNode=${answer} 
207       fi
208
209     else
210       print - "PostProcessing will be done on ${ProjectNode}"
211     fi
[1468]212 
213  fi # if ( ! ${x_q} )
[1470]214  echo ProjectNode for post-processing is ${ProjectNode} at Irene
[1465]215
[1468]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
[1465]220  if ( ! ${x_c} ) ; then
[1468]221    #- ProjectNode is known (option or answer), set ProjectCore default
222    [ "${ProjectNode}" = "xlarge" ] && ProjectCore="8" || ProjectCore="4" 
[1470]223
224    # let check minimum/maximum value 1/${ProjectCoreMax}
225
[1465]226    answerOK=false
227
228    while ( ! ${answerOK} ) ; do
229      answer=""
[1471]230      print - "possible numbers of cores are \"1\" to \"${ProjectCoreMax}\" for ${ProjectNode} : "
[1468]231      print - "Hit Enter or give NUMBER OF CORES required for post-processing (default is \"${ProjectCore}\")"
[1465]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
[1470]242  echo ProjectCore for post-processing is ${ProjectCore}
[1465]243  #- ProjectCore is set (option or answer)
244
[1536]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   
[1547]259  echo Wall time limit is ${WallTime} seconds
[1536]260
[1518]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
[1529]283     ProjectNode="rome"
[1518]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="" 
[1529]292         print - "Hit Enter or give TYPE OF NODE required for post-processing (default is \"${ProjectNode}\"), possible types of nodes are \"rome\"  : " 
[1518]293         read answer
[1529]294         [ "X${answer}" == "X" ] || [ "X${answer}" == "Xrome" ] && answerOK=true
[1518]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
[1536]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   
[1547]351  echo Wall time limit is ${WallTime} seconds
[1536]352
[1490]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
[1536]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
[1305]388elif [ X"${SYSTEM}" == "Xada" ] ; then
[1316]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
[1305]399
[1316]400    if [ "X${answer}" != "X" ] ; then
401      MPIEnvironment=${answer}
402    fi
403  fi # if ( ! ${x_pm} )
404  echo MPIEnvironment is ${MPIEnvironment}
[1470]405
[1391]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)."
[1472]413fi # if [ X"${SYSTEM}" == "Xirene" ]
[1164]414
415#-
416# Define the pattern string to substitute
417#-
[1522]418W_P='#-Q- '; W_W=${W_P}${SYSTEM}' ';
[1164]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 )
[1271]426for i in $( pwd )/config.card
[1164]427do
[1271]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
[1164]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
[1543]466  ResolAtm=this_is_a_new_another_test
[1164]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}
[1543]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}
[1164]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"
[1238]504      echo "=> ExpType gives the directory for the .card configuration files for the wanted experiement. For exemple ExpType=IPSLCM5/historical"
[1164]505      exit 4
506    else
507      [[ ${x_v} = 'verbose' ]] && echo "ExpType= ${config_UserChoices_ExpType}"
508    fi
509
510    if [ -d ${j}/${JobName} ] ; then
[1359]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."
[1489]513      #continue
514      exit 
[1164]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}
[1489]525    # rm -f ${j}/${F_CFG_ENS}
[1164]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   }
[1242]537
[1238]538  #==================================
[1242]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  #==================================
[1238]550  # Read Executable section:
[1242]551  IGCM_card_DefineArrayFromSection ${j}'/'${F_CFG} Executable
[1164]552
[1238]553  # Define the execution context (MPMD, SPMD, MPI/OMP ...)
[1242]554  IGCM_config_ConfigureExecution ${j}'/'${F_CFG}
[1238]555
556  # coreNumber    : TOTAL NUMBER OF CORES
557  # mpiTasks      : TOTAL NUMBER OF MPI TASKS
558  # openMPthreads : NUMBER OF OpenMP THREADS
559
[1164]560  # File name for Job
561  n_f='Job_'${JobName};
[1401]562  [[ ${x_f} = 'false' ]] && [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; }
[1164]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}/" \
[1536]569      -e "s/::WallTime::/${WallTime}/" \
[1164]570      ${F_JOB} > ${j}'/'${n_f}
571  chmod u+x ${j}'/'${n_f}
[1238]572
573  # update Headers so that ressources description are accurate (MPMD/SPMD/...)
574  IGCM_sys_updateHeaders ${j}'/'${n_f}
[1164]575done
[1238]576
[1164]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';
[1401]586  [[ ${x_f} = 'false' ]] && [[ -f ${j}'/'${n_f} ]] && { ins_job_Warning; continue; }
[1164]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}/" \
[1274]592      -e "s/::default_core::/${ProjectCore}/" \
[1164]593      -e "s/::default_project::/${ProjectID}/" \
[1471]594      -e "s/::default_post_project::/${ProjectID}/" \
[1164]595      ${i} > ${j}'/'${n_f}
596  chmod u+x ${j}'/'${n_f}
597done
598#-
[1490]599# set default_project in libIGCM_sys_irene and libIGCM_sys_jeanzay.
[1164]600#-
[1472]601if [ X"${SYSTEM}" == "Xirene" ] ; then
[1473]602  i=${libIGCM}/libIGCM_sys/libIGCM_sys_irene.ksh
[1164]603  sed -i -e "s/::default_project::/${ProjectID}/" ${i}
[1518]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}
[1490]607elif [ X"${SYSTEM}" == "Xjeanzay" ] ; then
608  i=${libIGCM}/libIGCM_sys/libIGCM_sys_jeanzay.ksh
609  sed -i -e "s/::default_project::/${ProjectID}/" ${i}
[1164]610fi
611#-
612# Limited to hindcast/forecast and date restart Ensemble for the time being
613if [ ${x_e} = 'true' ] ; then
[1489]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
[1164]623  #.. Read input data from ensemble.card ..
624  SUBMIT_DIR=${SUBMIT_DIR_ENS}
[1475]625  RUN_DIR="${CCCWORKDIR}/ENSEMBLE_TMP"
[1164]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
[1489]646    #IGCM_sys_Cd ${SUBMIT_DIR}
647    #IGCM_ensemble_CastMemberList
[1164]648  fi
[1489]649  # Done
650  IGCM_sys_Cd ${SUBMIT_DIR}
651  # Clean
652  IGCM_sys_Rm -rf ${RUN_DIR}
653 
[1164]654fi
655#-
656[[ ${x_v} = 'verbose' ]] && print - "";
657#-
658# That's all folks
659#-
660
661if [ ${NbErr} -ne 0 ] ; then
662  echo "################ ERROR ################"
663  echo "${NbErr} invalid JobName(s) found, check the log"
664fi
665
666
667exit 0;
Note: See TracBrowser for help on using the repository browser.