Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
technical:recipes:telemac [2021-01-28 18:24] – [Test job] anita | technical:recipes:telemac [2021-04-11 10:29] (current) – [Compilation] anita | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Building and using TELEMAC-MASCARET with VALET integration ====== | ||
+ | <WRAP center round info box 100%> | ||
+ | TELEMAC-MASCARET is an integrated suite of solvers for use in the field of free-surface flow. Having been used in the context of many studies throughout the world, it has become one of the major standards in its field. | ||
+ | </ | ||
+ | |||
+ | The text above appears at the top of the [[http:// | ||
+ | |||
+ | This document describes a tested setup and build procedure for TELEMAC-MASCARET (to be referred to as just //TELEMAC// henceforth) | ||
+ | |||
+ | ====== Build ====== | ||
+ | |||
+ | <WRAP center round important 80%> | ||
+ | Before starting, make sure you are in your **[[abstract: | ||
+ | |||
+ | Please note that the procedures herein will work perfectly well if **not** installing in your workgroup' | ||
+ | </ | ||
+ | |||
+ | |||
+ | Various versions of TELEMAC will coexist under a single parent directory. | ||
+ | |||
+ | <code base> | ||
+ | $ mkdir -p " | ||
+ | $ TELEMAC_PREFIX=" | ||
+ | </ | ||
+ | |||
+ | When this procedure was written, the newest tagged-release of TELEMAC was v8p2r0, so the version being built will be given the version id '' | ||
+ | |||
+ | ===== Python setup ===== | ||
+ | |||
+ | The latest versions of TELEMAC make heavy use of Python scripts. | ||
+ | |||
+ | <code bash> | ||
+ | $ vpkg_require intel-python/ | ||
+ | (base) $ conda create --prefix=" | ||
+ | </ | ||
+ | |||
+ | Ignore the instructions regarding activating the new environment. | ||
+ | |||
+ | ===== Download source ===== | ||
+ | |||
+ | The [[http:// | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ cd " | ||
+ | (base) $ svn co http:// | ||
+ | (base) $ cd src | ||
+ | (base) $ for item in builds configs scripts sources; do \ | ||
+ | svn co http:// | ||
+ | done | ||
+ | </ | ||
+ | |||
+ | ===== Build METIS ===== | ||
+ | |||
+ | The METIS source must be downloaded, built, and installed as part of TELEMAC. | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ cd " | ||
+ | (base) $ wget ' | ||
+ | (base) $ tar -xf metis-5.1.0.tar.gz | ||
+ | (base) $ cd metis-5.1.0 | ||
+ | </ | ||
+ | |||
+ | The only pre-requisite for METIS is the compiler that will be used to build the rest of TELEMAC. | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ vpkg_require openmpi/ | ||
+ | </ | ||
+ | |||
+ | METIS 5.1.0 has a CMake build system present: | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ mkdir build-20210127 ; cd build-20210127 | ||
+ | (base) $ CC=icc CXX=icpc FC=ifort cmake -DCMAKE_INSTALL_PREFIX=" | ||
+ | (base) $ make -j 4 | ||
+ | (base) $ make install | ||
+ | </ | ||
+ | |||
+ | With METIS installed to the base directory ('' | ||
+ | |||
+ | ===== TELEMAC config ===== | ||
+ | |||
+ | The next step is **critical** to the build and usage of this copy of TELEMAC. | ||
+ | |||
+ | The config file presented here contains two configurations: | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ mkdir " | ||
+ | (base) $ cat <<EOT > " | ||
+ | ## | ||
+ | ## Declare what named configurations are present | ||
+ | ## | ||
+ | [Configurations] | ||
+ | configs: interactive batch | ||
+ | |||
+ | ## | ||
+ | ## Baseline options that named configurations can override | ||
+ | ## | ||
+ | [general] | ||
+ | modules: | ||
+ | version: | ||
+ | options: | ||
+ | |||
+ | hash_char: | ||
+ | |||
+ | # language: | ||
+ | language: | ||
+ | |||
+ | mods_all: | ||
+ | |||
+ | sfx_zip: | ||
+ | sfx_lib: | ||
+ | sfx_obj: | ||
+ | sfx_mod: | ||
+ | sfx_exe: | ||
+ | |||
+ | val_root: | ||
+ | |||
+ | # possible val_rank: | ||
+ | val_rank: | ||
+ | |||
+ | # C compiler and flags: | ||
+ | cc: icc | ||
+ | cflags: | ||
+ | |||
+ | # Fortran compiler and flags: | ||
+ | fc: mpifort | ||
+ | fflags: | ||
+ | |||
+ | # command to compile C source to a object code: | ||
+ | cmd_obj_c: | ||
+ | cmd_obj: | ||
+ | cmd_lib: | ||
+ | cmd_exe: | ||
+ | |||
+ | # METIS: | ||
+ | inc_metis: | ||
+ | libs_metis: | ||
+ | |||
+ | # Overall library flags: | ||
+ | incs_all: | ||
+ | libs_all: | ||
+ | |||
+ | ## | ||
+ | ## Deviations from [general] for our configurations: | ||
+ | ## | ||
+ | [interactive] | ||
+ | brief: | ||
+ | |||
+ | [batch] | ||
+ | brief: | ||
+ | options: | ||
+ | |||
+ | # Running the " | ||
+ | par_cmdexec: | ||
+ | |||
+ | # Running an MPI program: | ||
+ | mpi_cmdexec: | ||
+ | |||
+ | # HPC job template: | ||
+ | hpc_stdin: [hash_char]!/ | ||
+ | [hash_char]SBATCH --job-name=< | ||
+ | [hash_char]SBATCH --output=< | ||
+ | [hash_char]SBATCH --error=< | ||
+ | [hash_char]SBATCH --time=< | ||
+ | [hash_char]SBATCH --nodes=< | ||
+ | [hash_char]SBATCH --ntasks-per-node=< | ||
+ | [hash_char]SBATCH --partition=< | ||
+ | [hash_char]SBATCH --export=NONE | ||
+ | vpkg_require telemac/ | ||
+ | . / | ||
+ | < | ||
+ | mpi_rc=\$? | ||
+ | exit \$? | ||
+ | |||
+ | # HPC job submission: | ||
+ | hpc_runcode: | ||
+ | |||
+ | EOT | ||
+ | </ | ||
+ | |||
+ | One major deviation should be evident in the '' | ||
+ | |||
+ | < | ||
+ | hpc_stdin: | ||
+ | #SBATCH --option1 | ||
+ | #SBATCH --option2 | ||
+ | #SBATCH --option3 | ||
+ | mpirun help-me | ||
+ | </ | ||
+ | |||
+ | is parsed as: | ||
+ | |||
+ | <code python> | ||
+ | hpc_stdin = "# | ||
+ | </ | ||
+ | |||
+ | In other words, the batch script template cannot have comments, thus it can have no embedded arguments for the majority of schedulers (PBS, Slurm, SGE). The solution to this problem is to reference a variable that will be replaced with the ''#'' | ||
+ | |||
+ | < | ||
+ | [general] | ||
+ | : | ||
+ | hash_char: | ||
+ | : | ||
+ | hpc_stdin: | ||
+ | [hash_char]SBATCH --option1 | ||
+ | [hash_char]SBATCH --option2 | ||
+ | [hash_char]SBATCH --option3 | ||
+ | mpirun help-me | ||
+ | </ | ||
+ | |||
+ | which after parsing will be | ||
+ | |||
+ | <code python> | ||
+ | hpc_stdin = "# | ||
+ | </ | ||
+ | |||
+ | Hooray! | ||
+ | |||
+ | ===== VALET package definition ===== | ||
+ | |||
+ | Representing this version of TELEMAC in VALET requires several transformations to the environment: | ||
+ | |||
+ | - Addition of '' | ||
+ | - Activation of the Python virtual environment | ||
+ | - Setting of the TELEMAC environment variables (e.g. '' | ||
+ | - Addition of TELEMAC Python library to the '' | ||
+ | |||
+ | The following command creates a new package definition file for this version of TELEMAC; if the '' | ||
+ | |||
+ | <WRAP center round important 80%> | ||
+ | If the installation is not meant to be available to all workgroup users (e.g. installed to '' | ||
+ | </ | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ mkdir --mode=2770 --parents " | ||
+ | (base) $ cat <<EOT > " | ||
+ | telemac: | ||
+ | prefix: $(dirname " | ||
+ | actions: | ||
+ | - action: source | ||
+ | script: | ||
+ | sh: anaconda-activate.sh | ||
+ | order: failure-first | ||
+ | success: 0 | ||
+ | - bindir: \${VALET_PATH_PREFIX}/ | ||
+ | - variable: HOMETEL | ||
+ | value: \${VALET_PATH_PREFIX}/ | ||
+ | action: set | ||
+ | - variable: SYSTELCFG | ||
+ | value: \${VALET_PATH_PREFIX}/ | ||
+ | action: set | ||
+ | - variable: PYTHONUNBUFFERED | ||
+ | value: true | ||
+ | action: set | ||
+ | - variable: PYTHONPATH | ||
+ | value: \${VALET_PATH_PREFIX}/ | ||
+ | action: prepend-path | ||
+ | - variable: METISHOME | ||
+ | value: \${VALET_PATH_PREFIX} | ||
+ | action: set | ||
+ | versions: | ||
+ | " | ||
+ | prefix: v8p2r0 | ||
+ | dependencies: | ||
+ | - openmpi/ | ||
+ | - intel-python/ | ||
+ | actions: | ||
+ | - variable: USETELCFG | ||
+ | value: interactive | ||
+ | action: set | ||
+ | - libdir: \${VALET_PATH_PREFIX}/ | ||
+ | - variable: PYTHONPATH | ||
+ | value: \${VALET_PATH_PREFIX}/ | ||
+ | action: prepend-path | ||
+ | " | ||
+ | prefix: v8p2r0 | ||
+ | dependencies: | ||
+ | - openmpi/ | ||
+ | - intel-python/ | ||
+ | actions: | ||
+ | - variable: USETELCFG | ||
+ | value: batch | ||
+ | action: set | ||
+ | - libdir: \${VALET_PATH_PREFIX}/ | ||
+ | - variable: PYTHONPATH | ||
+ | value: \${VALET_PATH_PREFIX}/ | ||
+ | action: prepend-path | ||
+ | |||
+ | EOT | ||
+ | </ | ||
+ | |||
+ | Two variants of '' | ||
+ | |||
+ | ===== Build TELEMAC ===== | ||
+ | |||
+ | Finally, the TELEMAC libraries and executables can be built! | ||
+ | |||
+ | <code bash> | ||
+ | (base) $ vpkg_rollback all | ||
+ | $ vpkg_require telemac/ | ||
+ | Adding dependency `intel/ | ||
+ | Adding dependency `libfabric/ | ||
+ | Adding dependency `openmpi/ | ||
+ | Adding dependency `intel-python/ | ||
+ | Adding package `telemac/ | ||
+ | (/ | ||
+ | </ | ||
+ | |||
+ | Note that the prompt has changed again, this time showing that the TELEMAC virtual environment created with the '' | ||
+ | |||
+ | The TELEMAC software is built with two commands: | ||
+ | |||
+ | <code bash> | ||
+ | (/ | ||
+ | (/ | ||
+ | </ | ||
+ | |||
+ | The compile may take quite some time. If the commands are successful, then the // | ||
+ | |||
+ | <code bash> | ||
+ | (/ | ||
+ | </ | ||
+ | |||
+ | Think of the // | ||
+ | |||
+ | <WRAP center round important 80%> | ||
+ | Any recompilation of the TELEMAC libraries and executables should be done using the //batch// build. | ||
+ | </ | ||
+ | |||
+ | ===== All done! ===== | ||
+ | |||
+ | That's it. TELEMAC is now built, easily added to a shell using VALET, and ready for work. | ||
+ | |||
+ | ====== Test job ====== | ||
+ | |||
+ | The following test job was furnished by a Caviness user. It uses a set of three Fortran source files implementing a user model. | ||
+ | |||
+ | A job comprises four distinct steps: | ||
+ | |||
+ | - Partition the problem according to the parallelism options | ||
+ | * Number of nodes | ||
+ | * Number of MPI processes per node | ||
+ | - Compile user sources into an executable | ||
+ | * This step may (must) be done of the login node serially | ||
+ | - Run the executable | ||
+ | * Same MPI parameters as in step 1 | ||
+ | - Merge the partitioned results | ||
+ | * Same MPI parameters as in step 1 | ||
+ | |||
+ | We set up a test job directory called '' | ||
+ | |||
+ | ===== Partitioning ===== | ||
+ | |||
+ | Partitioning is done in parallel, and thus should use a compute node and the job scheduler. | ||
+ | |||
+ | <code bash> | ||
+ | $ cd " | ||
+ | $ vpkg_require telemac/ | ||
+ | (/ | ||
+ | --use-link --split --workdirectory $(pwd)/ | ||
+ | --jobname telemac_test-split \ | ||
+ | --ncsize 2 \ | ||
+ | --nctile 2 \ | ||
+ | --ncnode 1 \ | ||
+ | --walltime 1-00:00:00 \ | ||
+ | --queue standard \ | ||
+ | telemac2d -s t2d_bump_FE.cas | ||
+ | </ | ||
+ | |||
+ | A job will be submitted to the job scheduler and the grid et al. will be partitioned into two (2) domains -- since the //ncsize// = //ncnode// * //nctile// is 2((Be sure to get those three flags correct, otherwise TELEMAC may choose unexpected numbers.)). | ||
+ | |||
+ | ===== Compilation ===== | ||
+ | |||
+ | Once the problem is partitioned, | ||
+ | |||
+ | <code bash> | ||
+ | (/ | ||
+ | $ vpkg_require telemac/ | ||
+ | (/ | ||
+ | --use-link --compileonly --workdirectory $(pwd)/ | ||
+ | telemac2d -s t2d_bump_FE.cas | ||
+ | </ | ||
+ | |||
+ | ===== Run ===== | ||
+ | |||
+ | With the problem partitioned and the executable built successfully, | ||
+ | |||
+ | <code bash> | ||
+ | (/ | ||
+ | $ vpkg_require telemac/ | ||
+ | (/ | ||
+ | --use-link --run --workdirectory $(pwd)/ | ||
+ | --jobname telemac_test-run \ | ||
+ | --ncsize 2 \ | ||
+ | --nctile 2 \ | ||
+ | --ncnode 1 \ | ||
+ | --walltime 1-00:00:00 \ | ||
+ | --queue standard \ | ||
+ | telemac2d -s t2d_bump_FE.cas | ||
+ | </ | ||
+ | |||
+ | ===== Merge ===== | ||
+ | |||
+ | If the run is successful, the partitioned results must be merged. | ||
+ | |||
+ | <code bash> | ||
+ | (/ | ||
+ | $ vpkg_require telemac/ | ||
+ | (/ | ||
+ | --use-link --merge --workdirectory $(pwd)/ | ||
+ | --jobname telemac_test-merge \ | ||
+ | --ncsize 2 \ | ||
+ | --nctile 2 \ | ||
+ | --ncnode 1 \ | ||
+ | --walltime 1-00:00:00 \ | ||
+ | --queue standard \ | ||
+ | telemac2d -s t2d_bump_FE.cas | ||
+ | </ | ||
+ | |||
+ | ===== Single-step runs ===== | ||
+ | |||
+ | Clusters that install a full base development environment on all compute nodes do not need to split the run detailed above into 4 steps. | ||
+ | |||
+ | <code bash> | ||
+ | $ vpkg_require telemac/ | ||
+ | (/ | ||
+ | --use-link --workdirectory $(pwd)/ | ||
+ | --jobname telemac_test \ | ||
+ | --ncsize 2 \ | ||
+ | --nctile 2 \ | ||
+ | --ncnode 1 \ | ||
+ | --walltime 1-00:00:00 \ | ||
+ | --queue standard \ | ||
+ | telemac2d -s t2d_bump_FE.cas | ||
+ | </ |