source: flex_extract.git/For_developers/Sphinx/source/Documentation/Input/compilejob.rst @ b1674ed

ctbtodev
Last change on this file since b1674ed was b1674ed, checked in by Anne Philipp <anne.philipp@…>, 4 years ago

updated online documentation FIX for tickets #265 and #262

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[0b00607]1********************************************
2The Compilation Jobscript ``compilejob.ksh``
3********************************************
4
5The compilejob is a Korn-shell script which will be created during the installation process for the application modes **remote** and **gateway** from a template called ``compilejob.template`` in the template directory.
6
7``Flex_extract`` uses the python package `genshi <https://genshi.edgewall.org/>`_ to generate
8the Korn-shell script from the template files by substituting the individual parameters.
9These individual parameters are marked by a doubled ``$`` sign in ``job.temp``.
10
11The jobscript has a number of settings for the batch system which are fixed and differentiates between the *ecgate* and the *cca/ccb* 
12server system to load the necessary modules for the environment when submitted to the batch queue.
13
14The submission is done by the ``ECaccess`` tool from within ``flex_extract`` with the command ``ecaccess-job-submit``.
15
16
17
18What does the compilation script do?
19------------------------------------
20
21 #. It sets necessary batch system parameters
22 #. It prepares the job environment at the ECMWF servers by loading the necessary library modules
23 #. It sets some environment variabels for the single session
24 #. It creates the ``flex_extract`` root directory in the ``$HOME`` path of the user
25 #. It untars the tar-ball into the root directory.
26 #. It compiles the Fortran programs's ``Makefile``.
27 #. At the end it checks if the script returned an error or not and send the log file via email to the user.
28
29
30
31
32
33Example ``compilejob.ksh``
34--------------------------
35 
36.. code-block::  bash
37   
38       
39    #!/bin/ksh
40
41    # ON ECGB:
42    # start with ecaccess-job-submit -queueName ecgb NAME_OF_THIS_FILE  on gateway server
43    # start with sbatch NAME_OF_THIS_FILE directly on machine
44
45    #SBATCH --workdir=/scratch/ms/at/km4a
46    #SBATCH --qos=normal
47    #SBATCH --job-name=flex_ecmwf
48    #SBATCH --output=flex_ecmwf.%j.out
49    #SBATCH --error=flex_ecmwf.%j.out
50    #SBATCH --mail-type=FAIL
51    #SBATCH --time=12:00:00
52
53    ## CRAY specific batch requests
54    ##PBS -N flex_ecmwf
55    ##PBS -q ns
56    ##PBS -S /usr/bin/ksh
57    ##PBS -o /scratch/ms/at/km4a/flex_ecmwf.${Jobname}.${Job_ID}.out
58    # job output is in .ecaccess_DO_NOT_REMOVE
59    ##PBS -j oe
60    ##PBS -V
61    ##PBS -l EC_threads_per_task=1
62    ##PBS -l EC_memory_per_task=3200MB
63
64    set -x
65    export VERSION=7.1
66    case ${HOST} in
67      *ecg*)
68      module unload grib_api
69      module unload eccodes
70      module unload python
71      module unload emos
72      module load python3
73      module load eccodes/2.12.0
74      module load emos/455-r64
75      export FLEXPART_ROOT_SCRIPTS=${HOME}
[b1674ed]76      export MAKEFILE=makefile_ecgate
[0b00607]77      ;;
78      *cca*)
79      module unload python
80      module switch PrgEnv-cray PrgEnv-intel
81      module load python3
82      module load eccodes/2.12.0
83      module load emos
84      echo ${GROUP}
85      echo ${HOME}
86      echo ${HOME} | awk -F / '{print $1, $2, $3, $4}'
87      export GROUP=`echo ${HOME} | awk -F / '{print $4}'`
88      export SCRATCH=/scratch/ms/${GROUP}/${USER}
89      export FLEXPART_ROOT_SCRIPTS=${HOME}
[b1674ed]90      export MAKEFILE=makefile_ecgate
[0b00607]91      ;;
92    esac
93
94    mkdir -p ${FLEXPART_ROOT_SCRIPTS}/flex_extract_v${VERSION}
95    cd ${FLEXPART_ROOT_SCRIPTS}/flex_extract_v${VERSION}   # if FLEXPART_ROOT is not set this means cd to the home directory
96    tar -xvf ${HOME}/flex_extract_v${VERSION}.tar
[b1674ed]97    cd Source/Fortran
98    \rm *.o *.mod calc_etadot
[0b00607]99    make -f ${MAKEFILE} >flexcompile 2>flexcompile
100
[b1674ed]101    ls -l calc_etadot >>flexcompile
[0b00607]102    if [ $? -eq 0 ]; then
103      echo 'SUCCESS!' >>flexcompile
104      mail -s flexcompile.${HOST}.$$ ${USER} <flexcompile
105    else
106      echo Environment: >>flexcompile
107      env >> flexcompile
108      mail -s "ERROR! flexcompile.${HOST}.$$" ${USER} <flexcompile
109    fi
110
111
112   
113
114.. toctree::
115    :hidden:
116    :maxdepth: 2
Note: See TracBrowser for help on using the repository browser.
hosted by ZAMG