The Target Architecture ("arch") Files
Contents
A brief description of the architecture files used by the makelmdz_fcm script
The target architecture files are files used by the makelmdz_fcm compilation script. These files contain all the necessary information about the local environment, where libraries are located, which compiler, and compiler options will be used, etc.
In practice, when the makelmdz_fcm is run with "-arch somename", it will look for files "arch-somename.env", "arch-somename.path" and "arch-somename.fcm" (obviously "somename" can be any string, makelmdz_fcm will adapt the arch file names it seeks) in the LMDZ/arch subdirectory. and link these as "arch.env", "arch.path" and "arch.env" in the LMDZ directory. Re-running makelmdz_fcm with a different argument to the "-arch" option will update these links.
The arch.env file
This file is optional. It should contain instructions and declarations related to the environment (e.g. setting up environment variables, or loading modules), necessary prerequisites to compiling LMDZ. For example the "arch/arch-X64_OCCIGEN.env" file that contains:
module purge
module load intel/17.0
module load intelmpi/2017.0.098
module load hdf5/1.8.17
module load netcdf/4.4.0_fortran-4.4.2
imposes first running some "module" commands to set up the adequate environment prior to the compilation.
The arch.path file
This file contains information about the paths (relative to the LMDZ.COMMON directory) and options concerning libraries (NetCDF, IOIPSL, etc.) required to compile the GCM. For example the "arch/arch-X64_OCCIGEN.path" contains:
ROOT=$PWD
NETCDF_LIBDIR="-L${NETCDFF_LIBDIR}"
NETCDF_LIB="-lnetcdff -lnetcdf"
NETCDF_INCDIR="-I${NETCDF_INCDIR}"
IOIPSL_INCDIR="-I$ROOT/ioipsl/modipsl/lib"
IOIPSL_LIBDIR="-L$ROOT/ioipsl/modipsl/lib"
IOIPSL_LIB="-lioipsl"
XIOS_INCDIR="-I$ROOT/../XIOS/inc"
XIOS_LIBDIR="-L$ROOT/../XIOS/lib"
XIOS_LIB="-lxios -lstdc++"
Here the keywords are quite self-explanatory, for each external library, NetCDF, IOIPSL, XIOS, ... one provide the compiling instructions about related "include" directories along with the path to the libraries.
The arch.fcm file
This file contains information about the compiler to use and compiler options to set. Each line starts with a reserved keyword, followed by the appropriate specifications. For example the "arch/arch-X64_OCCIGEN.fcm" file contains:
%COMPILER mpif90
%LINK mpif90
%AR ar
%MAKE gmake
%FPP_FLAGS -P -traditional
%CPP_FLAGS -P
%FPP_DEF NC_DOUBLE LAPACK FFT_MKL
%CPP_DEF LAPACK
%BASE_FFLAGS -i4 -r8 -auto -align all -fp-model strict
%PROD_FFLAGS -O2 -ip -xCORE-AVX2
%DEV_FFLAGS -p -g -O1 -fpe0 -traceback
%DEBUG_FFLAGS -p -g -O0 -fpe-all=0 -ftz -ftrapuv -fp-stack-check -check bounds,format,output_conversion,pointers,uninit -debug -traceback
%C_COMPILER mpicc
%C_OPTIM -O2 -ip -xCORE-AVX2
%MPI_FFLAGS
%OMP_FFLAGS -qopenmp -qopenmp-threadprivate=compat
%BASE_LD -i4 -r8 -auto -shared-intel $MKL_LIBS -lpthread
%MPI_LD
%OMP_LD -qopenmp -qopenmp-threadprivate=compat
Implying that the compiler to use is "mpif90", that compilation will always include the "NC_DOUBLE LAPACK FFT_MKL" preprocessing flags, and "-i4 -r8 -auto -align all -fp-model strict" compiler options, etc.
The meaning of the various keywords that one may specify in the arch.fcm file are:
- %COMPILER: The (Fortran) compiler to use
- %LINK: The linker to use (usually this is the same as the compiler)
- %AR: the archiving tool (to collect objects and build the library, typically "ar")
- %ARFLAGS: options to give to the archiving tool
- %MAKE: the make tool (typically "make" or "gmake")
- %FPP_FLAGS: options to pass to the preprocessor of Fortran source code
- %CPP_FLAGS: options to pass to the preprocessor for C source code
- %FPP_DEF: preprocessing flags to set for Fortran source code
- %CPP_DEF: : options to pass to the preprocessor for C source code
- %BASE_FFLAGS: compilation flags to alway include when compiling Fortran source code
- %PROD_FFLAGS: compilation flags to include if makelmdz_fcm is run with the "-prod" option
- %DEV_FFLAGS: compilation flags to include if makelmdz_fcm is run with the "-dev" option
- %DEBUG_FFLAGS: compilation flags to include if makelmdz_fcm is run with the "-debug" option
- %C_COMPILER: The compiler to use if compiling C source code
- %C_OPTIM: compilation flags to use if compiling C source code
- %MPI_FFLAGS: compilation flags to include if makelmdz_fcm is run with the "-parallel mpi" or "-parallel mpi_omp" options (i.e. to have a code that can run in MPI)
- %OMP_FFLAGS: compilation flags to include if makelmdz_fcm is run with the "-parallel omp" or "-parallel mpi_omp" options (i.e. to have a code that can run in OpenMP)
- %BASE_LD: flags to add when running the linker
- %MPI_LD: flags to add when running the linker when MPI is enabled
- %OMP_LD: flags to add when running the linker when OpenMP is enabled