From 123dab573d72d087dcc7edfd8014abb7fd96c79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Riette?= <sebastien.riette@meteo.fr> Date: Wed, 22 Jun 2022 18:19:36 +0200 Subject: [PATCH] S. Riette 22/06/2022 fcm configuration built from gmkfile Possibility added to build a fcm configuration file from a gmkpack file Inclusion of configuration file for belenos/taranis and CTI computers --- .../with_fcm/arch/arch-MIMPIIFC1805.EPONA.env | 1 + .../with_fcm/arch/arch-MIMPIIFC1805.EPONA.fcm | 25 +++++ .../arch/arch-MPIGFORTRAN920DBL.GMAP.env | 0 .../arch/arch-MPIGFORTRAN920DBL.GMAP.fcm | 25 +++++ build/with_fcm/arch/arch-gnu.fcm | 2 +- build/with_fcm/fcm-make.cfg | 7 +- build/with_fcm/make_fcm.sh | 104 ++++++++++++------ 7 files changed, 129 insertions(+), 35 deletions(-) create mode 100644 build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.env create mode 100644 build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.fcm create mode 100644 build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.env create mode 100644 build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.fcm diff --git a/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.env b/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.env new file mode 100644 index 000000000..8fdefeb29 --- /dev/null +++ b/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.env @@ -0,0 +1 @@ +module load perl/5.30.3 diff --git a/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.fcm b/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.fcm new file mode 100644 index 000000000..444d60327 --- /dev/null +++ b/build/with_fcm/arch/arch-MIMPIIFC1805.EPONA.fcm @@ -0,0 +1,25 @@ +# Compilation +$FCOMPILER = /home/gmap/mrpm/khatib/public/bin/mimpifc-18.0.5.274 +$BASE_FFLAGS = -c -convert big_endian -assume byterecl -align array64byte,all -traceback -fpic -qopenmp -qopenmp-threadprivate compat -fp-model source -qopt-report=5 -qopt-report-phase=vec -ftz -diag-disable=remark,cpu-dispatch -r8 +$PROD_FFLAGS = -g -O2 -march=core-avx2 -finline-functions -finline-limit=500 -Winline -qopt-prefetch=4 -fast-transcendentals -fimf-use-svml -no-fma +$DEV_FFLAGS = -g -O0 +$DEBUG_FFLAGS = -g -O0 -check bounds -init=arrays,snan -fp-stack-check -ftrapuv -fpe0 -fp-speculation=strict -check uninit -check pointers +$CCOMPILER = /home/gmap/mrpm/khatib/public/bin/mimpicc-18.0.5.274 +$BASE_CFLAGS = -c -qopenmp -qopt-report=2 -qopt-report-phase=vec -fpic -malign-double -ftz -fp-model precise -diag-disable=remark,cpu-dispatch +$PROD_CFLAGS = -g -O2 -march=core-avx2 +$DEV_CFLAGS = +$DEBUG_CFLAGS = +$OMP_FFLAGS = + +# Preprocessor +$FPP_FLAGS = LINUX LITTLE_ENDIAN LITTLE ADDRESS64 GRIB_API_1 REPRO48 +$CPP_FLAGS = LINUX LITTLE_ENDIAN LITTLE GRIB_API_1 + +# Linker +$LINK = /home/gmap/mrpm/khatib/public/bin/mimpifc-18.0.5.274 +$BASE_LD = -v -fp-stack-check -qopenmp -qopenmp-threadprivate compat -shared-intel -lrt -lstdc++ +$OMP_LD = +$LD_EXE_TO_SHARED = -shared + +# Other +$AR = /usr/bin/ar diff --git a/build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.env b/build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.env new file mode 100644 index 000000000..e69de29bb diff --git a/build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.fcm b/build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.fcm new file mode 100644 index 000000000..75f2e5a0e --- /dev/null +++ b/build/with_fcm/arch/arch-MPIGFORTRAN920DBL.GMAP.fcm @@ -0,0 +1,25 @@ +# Compilation +$FCOMPILER = mpigfortran.9.2.0 +$BASE_FFLAGS = -c -fconvert=swap -fno-second-underscore -fbacktrace -m64 -fopenmp -ffree-line-length-none -fno-sign-zero -fpic -fno-range-check -g -pipe -fdefault-real-8 +$PROD_FFLAGS = -g -O2 +$DEV_FFLAGS = -g -O0 +$DEBUG_FFLAGS = -g -O0 -fbounds-check -finit-real=snan -ffpe-trap=invalid,zero,overflow +$CCOMPILER = mpigcc.9.2.0 +$BASE_CFLAGS = -c -m64 -fopenmp -fpic -g -pipe +$PROD_CFLAGS = -g -O2 +$DEV_CFLAGS = +$DEBUG_CFLAGS = +$OMP_FFLAGS = + +# Preprocessor +$FPP_FLAGS = LINUX LITTLE_ENDIAN LITTLE REPRO48 +$CPP_FLAGS = LINUX LITTLE_ENDIAN LITTLE + +# Linker +$LINK = mpigfortran.9.2.0 +$BASE_LD = -fopenmp -ffast-math -ldl -lrt +$OMP_LD = +$LD_EXE_TO_SHARED = -shared + +# Other +$AR = ar diff --git a/build/with_fcm/arch/arch-gnu.fcm b/build/with_fcm/arch/arch-gnu.fcm index 92bfee6d9..5bbff8384 100644 --- a/build/with_fcm/arch/arch-gnu.fcm +++ b/build/with_fcm/arch/arch-gnu.fcm @@ -12,7 +12,7 @@ $DEBUG_CFLAGS = -check bounds $OMP_FFLAGS = # Preprocessor -$FPP_FLAGS = LINUX +$FPP_FLAGS = LINUX REPRO48 $CPP_FLAGS = LINUX # Linker diff --git a/build/with_fcm/fcm-make.cfg b/build/with_fcm/fcm-make.cfg index c0a290bb4..b909baed3 100644 --- a/build/with_fcm/fcm-make.cfg +++ b/build/with_fcm/fcm-make.cfg @@ -47,7 +47,7 @@ build.prop{fc.flags-ld} = $LD_FLAGS $LD_EXE_TO_SHARED # 3.2.b dependencies (internal and external) $util = util1 util2 util3 util4 util5 util6 util7 util8 util9 util10 util11 util12 util13 util14 util15 util16 $mpi = mpi2 mpi3 mpi4 mpi5 mpi6 mpi7 mpi8 mpi9 mpi10 mpi11 mpi12 mpi13 mpi14 mpi15 mpi16 mpi17 mpi18 mpi19 -$system = system1 system2 system3 system4 system5 system6 system7 system8 system10 system11 system12 system13 +$system = system1 system2 system3 system4 system5 system6 system7 system8 system10 system11 system12 system13 system14 build.prop{ns-dep.o} = common parkind drhook $util $mpi oml mpl gstats1 $system build.prop{fc.libs} = $LIBS @@ -147,5 +147,6 @@ build.source[system11] = $FIAT/fiat/system/internal/linuxtrbk.c build.source[util17] = $FIAT/fiat/util/internal/raise.h build.source[system12] = $FIAT/fiat/system/getstatm.c build.source[system13] = $FIAT/fiat/system/internal/linux_bind.c - - +build.source[system14] = $FIAT/fiat/system/internal/gentrbk.F90 +#ifcore module is external to fiat (intel) +build.prop{no-dep.f.module}[system14] = ifcore diff --git a/build/with_fcm/make_fcm.sh b/build/with_fcm/make_fcm.sh index c7cc486b6..0b6ed7607 100755 --- a/build/with_fcm/make_fcm.sh +++ b/build/with_fcm/make_fcm.sh @@ -3,24 +3,24 @@ fcm_version=tags/2021.05.0 fiat_version=1295120464c3905e5edcbb887e4921686653eab8 -function parse_args() -{ - # default values - ARCH_PATH=$PWD/arch - ARCH=gnu - # pass unrecognized arguments to fcm - FCM_ARGS="" - - while (($# > 0)) - do - OPTION="$1" ; shift - case "$OPTION" in - "-h") cat <<EOF +function parse_args() { + # default values + ARCH_PATH=$PWD/arch + ARCH= + GMKFILE= + # pass unrecognized arguments to fcm + FCM_ARGS="" + + while (($# > 0)); do + OPTION="$1" ; shift + case "$OPTION" in + "-h") cat <<EOF Usage : $0 [options] --help -h help --arch-path ARCH_PATH directory for architecture specific files (see below) [./arch] --arch ARCH build using arch files $ARCH_PATH/arch-ARCH.* [gnu] +--gmkfile FILE build using a gmkpack configuration file (--arch must be used to give a name to the build dir) Unrecognized options are passed to the fcm build command. Useful options include : --new clean build tree before building @@ -31,20 +31,25 @@ For details on FCM, see http://metomi.github.io/fcm/doc/user_guide/build.html http://metomi.github.io/fcm/doc/user_guide/command_ref.html#fcm-build EOF - exit;; - "--arch") - ARCH=$1 ; shift ;; - "--arch-path") - ARCH_PATH=$1 ; shift ;; - *) - FCM_ARGS="$FCM_ARGS $OPTION" - ;; - esac - done + exit;; + "--arch") + ARCH=$1 ; shift ;; + "--arch-path") + ARCH_PATH=$1 ; shift ;; + "--gmkfile") + GMKFILE=$1 ; shift ;; + *) + FCM_ARGS="$FCM_ARGS $OPTION" ;; + esac + done + [ "$GMKFILE" == "" -a "$ARCH" == "" ] && ARCH=gnu + if [ "$GMKFILE" != "" -a "$ARCH" == "" ]; then + echo "--arch option is mandatory if --gmkfile option is used" + exit 2 + fi } -function check_install_fcm() -{ +function check_install_fcm() { if [ ! -f fcm/bin/fcm ]; then echo "Performing FCM installation..." cd fcm @@ -57,8 +62,7 @@ function check_install_fcm() fi } -function check_install_fiat() -{ +function check_install_fiat() { if [ ! -d fiat/src ]; then echo "Performing fiat cloning..." cd fiat @@ -72,8 +76,39 @@ function check_install_fiat() echo } -function build_compilation_script() -{ +function gmkfile2arch() { + GMKFILE=$1 + ARCHFILE=$2 +cat <<EOF > $ARCHFILE +# Compilation +\$FCOMPILER = $(grep "^FRTNAME =" $GMKFILE | cut -d = -f 2) +\$BASE_FFLAGS = $(grep "^FRTFLAGS =" $GMKFILE | cut -d = -f 2-) $(grep "^GMK_FCFLAGS_PHYEX =" $GMKFILE | cut -d = -f 2-) +\$PROD_FFLAGS = $(grep "^OPT_FRTFLAGS =" $GMKFILE | cut -d = -f 2-) +\$DEV_FFLAGS = $(grep "^DBG_FRTFLAGS =" $GMKFILE | cut -d = -f 2-) +\$DEBUG_FFLAGS = $(grep "^DBG_FRTFLAGS =" $GMKFILE | cut -d = -f 2-) $(grep "^BCD_FRTFLAGS =" $GMKFILE | cut -d = -f 2-) $(grep "^NAN_FRTFLAGS =" $GMKFILE | cut -d = -f 2-) +\$CCOMPILER = $(grep "^VCCNAME =" $GMKFILE | cut -d = -f 2) +\$BASE_CFLAGS = $(grep "^VCCFLAGS =" $GMKFILE | cut -d = -f 2-) +\$PROD_CFLAGS = $(grep "^OPT_VCCFLAGS =" $GMKFILE | cut -d = -f 2-) +\$DEV_CFLAGS = +\$DEBUG_CFLAGS = +\$OMP_FFLAGS = + +# Preprocessor +\$FPP_FLAGS = $(grep "^MACROS_FRT =" $GMKFILE | cut -d = -f 2- | sed 's/-D//g') +\$CPP_FLAGS = $(grep "^MACROS_CC =" $GMKFILE | cut -d = -f 2- | sed 's/-D//g') + +# Linker +\$LINK = $(grep "^LNK_MPI =" $GMKFILE | cut -d = -f 2-) +\$BASE_LD = $(grep "^LNK_FLAGS =" $GMKFILE | cut -d = -f 2-) +\$OMP_LD = +\$LD_EXE_TO_SHARED = $(grep "^LNK_SOLIB =" $GMKFILE | cut -d = -f 2- | sed 's/-o a.out//') + +# Other +\$AR = $(grep "^AR =" $GMKFILE | cut -d = -f 2-) +EOF +} + +function build_compilation_script() { cat <<EOF > compilation.sh #!/bin/bash @@ -135,8 +170,13 @@ if [ -d $builddir ]; then exit 1 fi mkdir $builddir -cp ${ARCH_PATH}/arch-${ARCH}.env $builddir/arch.env -cp ${ARCH_PATH}/arch-${ARCH}.fcm $builddir/arch.fcm +if [ "$GMKFILE" != "" ]; then + touch $builddir/arch.env + gmkfile2arch $GMKFILE $builddir/arch.fcm +else + cp ${ARCH_PATH}/arch-${ARCH}.env $builddir/arch.env + cp ${ARCH_PATH}/arch-${ARCH}.fcm $builddir/arch.fcm +fi cp fcm-make.cfg $builddir cd $builddir mkdir src @@ -157,3 +197,5 @@ ln -s build/bin/libphyex.so . # Check if python can open the resulting shared lib python3 -c "from ctypes import cdll; cdll.LoadLibrary('./libphyex.so')" + +# ldd -r ./libphyex.so should also give interesting results -- GitLab