Add in makenemo a feature to source environment file if available for the chosen architecture
Context
The architecture files used by makenemo
are often specific for different HPC clusters, which often implies using a specific set of libraries compiled on these system.
Thus, to improve the robustness of the compilation environment I would suggest to add and automatic procedure in makenemo
to look for an environment file associated the selected architecture file that will be sourced before compiling the code (similarly to what it is required when compiling XIOS).
This will also make more simple to other users of the code to correctly compile on HPC system.
Proposal
The idea is to have an arch file named arch-X64_ZEUS.fcm
and an associated environment file named arch-X64_ZEUS.env
, where the second one is a set of bash instructions containing instances like module loads, path definitions etc ...
The feature of sourcing an environment (bash code) file in makenemo
could be implemented as (v4.2 example) :
diff --git a/makenemo b/makenemo
index 14caf82..836c605 100755
--- a/makenemo
+++ b/makenemo
@@ -192,6 +192,12 @@ export NEMO_DIR=${MAIN_DIR}/${x_s}
[ "${CMP_NAM}" == 'all' ] && . ${COMPIL_DIR}/Flist_archfile.sh all && exit
+# Load environment if exists
+env_file=`find ${MAIN_DIR}/arch -name arch-${CMP_NAM}.env`
+if [ -f "${env_file}" ] ; then
+ echo "Load environment file arch-${CMP_NAM}.env"
+ . ${env_file}
+fi
## No ref. cfg, demo case, nor remote cfg selected
if [[ -z "${REF_CONF}" && -z "${DEMO_CONF}" && -z "${RMT_CONF}" ]]; then
This feature can be easily implemented in both main
and branch_4.2