WhatIs: The target architecture ("arch") files : Différence entre versions
(Page créée avec « == 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. T... ») |
|||
Ligne 3 : | Ligne 3 : | ||
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. | 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. | + | In practice, when the [[WhatIs:_The_makelmdz_fcm_script|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''' | '''The arch.env file''' |
Version actuelle en date du 27 septembre 2021 à 10:24
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-gfortran_CICLAD.env" file that contains:
module unload openmpi module load openmpi/1.4.5-gfortran module unload netcdf4 module load netcdf4/4.2.1.1-gfortran export NETCDF_HOME=/opt/netcdf42/gfortran
imposes first running some "module" commands and setting the environment variable "NETCDF_HOME" prior to the compilation.
The arch.path file
This file contains information about the paths (relative to the LMDZ directory) and options concerning libraries (NetCDF, IOIPSL, etc.) required to compile LMDZ. For example the "arch/arch-gfortran_CICLAD.path" contains:
NETCDF_LIBDIR="-L${NETCDF_HOME}/lib -lnetcdf -lnetcdff" NETCDF_INCDIR=-I${NETCDF_HOME}/include IOIPSL_INCDIR=$LMDGCM/../../lib IOIPSL_LIBDIR=$LMDGCM/../../lib ORCH_INCDIR=$LMDGCM/../../lib ORCH_LIBDIR=$LMDGCM/../../lib OASIS_INCDIR=$LMDGCM/../../prism/SX/build/lib/psmile.$couple OASIS_LIBDIR=$LMDGCM/../../prism/SX/lib INCA_LIBDIR=$LMDGCM/../INCA/config/lib INCA_INCDIR=$LMDGCM/../INCA/config/lib XIOS_INCDIR=$LMDGCM/../XIOS/inc XIOS_LIBDIR=$LMDGCM/../XIOS/lib
Here the keywords are quite self-explanatory, for each external library, NetCDF, IOIPSL, XIOS, ... one provide the compiling intructions 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-gfortran_CICLAD.fcm" file contains:
%COMPILER $MPI_BIN/mpif90 %LINK $MPI_BIN/mpif90 %AR ar %ARFLAGS rs %MAKE gmake %FPP_FLAGS -P -traditional %FPP_DEF NC_DOUBLE %BASE_FFLAGS -c -fdefault-real-8 -fcray-pointer -frecursive -ffree-line-length-0 -fno-align-commons %PROD_FFLAGS -O3 %DEV_FFLAGS -O -Wall -fbounds-check %DEBUG_FFLAGS -ffpe-trap=invalid,zero,overflow -Wall -fbounds-check -g3 -O0 -fstack-protector-all -fbacktrace %MPI_FFLAGS %OMP_FFLAGS -fopenmp %BASE_LD -Wl,-rpath=$NETCDF_HOME/lib %MPI_LD %OMP_LD -fopenmp
Implying that the compiler to use is "mpif90", located in "$MPI_BIN/mpif90" (here $MPI_BIN is an environment variable that has been set via the "module load openmpi/1.4.5-gfortran" command from the corresponding arch-gfortran_CICLAD.env file), that compilation will always include the "-c -fdefault-real-8 -fcray-pointer -frecursive ffree-line-length-0 -fno-align-commons" options, etc.
The meaning of the various keywords in the arch.fcm file are:
- %COMPILER: The 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
- %FPP_FLAGS: options to pass to the preprocessor of the Fortan source code
- %FPP_DEF: preprocessing flags to set
- %BASE_FFLAGS: compilation flags to alway include when compiling the 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
- %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
13/05/2020