I'm currently trying to build CESM 1.2.0. The idea is to port a previous project to a new HPC cluster. This compilation protocol has been used for multiple years on different clusters. I discovered however that this compilation process, specifically for the pio library, relied on a hardcoded path of netcdf in the configure file of pio. This is of course not the way we want to work. Digging some further, I discovered that the reason this was originally hardcoded was because of an error that the variable 'NETCDF_PATH' is not declared. This on its turn seems to be declared in the config_compilers.xml file. This file seems to be filled out correctly for our new system, but to be sure this is how it looks (some paths contain 'user_id', which is a replacement for privacy reasons; the name of the cluster is 'wice'; as you might notice, our software packages are installed centrally, using a module system):
<compiler MACH="wice" COMPILER="intel">
<NETCDF_PATH>/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a</NETCDF_PATH>
<NETCDF_DIR>/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a</NETCDF_DIR>
<ADD_SLIBS>$(shell nc-config --flibs) -mkl</ADD_SLIBS>
<PNETCDF_PATH></PNETCDF_PATH>
<MPICC>mpiicc</MPICC>
<MPIFC>mpiifort</MPIFC>
<MPICXX>mpiicpc</MPICXX>
<CONFIG_ARGS></CONFIG_ARGS>
<ESMF_LIBDIR></ESMF_LIBDIR>
<FFLAGS>-I/data/leuven/user_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/build/lib/psmile.MPI1 -I/data/leuvenuser_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/build/lib/mct -I/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a/include -I/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a/include</FFLAGS>
<LDFLAGS>-L/data/leuven/user_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/lib -lpsmile.MPI1 -lscrip -lmct_oasis -lmpeu_oasis -L/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a/lib64/ -lnetcdf -L/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a/lib/ -lnetcdff </LDFLAGS>
<ADD_CPPDEFS> -DCOUP_OAS -DLINUX</ADD_CPPDEFS>-->
</compiler>
From what I've found these compiler settings are then moved to a file called 'Macros' in the CESM build directory. The content of this file does match the content of the compiler settings above.
So my issue now: from here on, I am a bit confused as to how this Macros files leads to a correct declaration of 'NETCDF_PATH' in the pio configure file. Could anyone perhaps give me a clue on how this information uis made available to the configure file? What step loads the variables in the Macros file in the environment, or makes the configure process correctly read this file?
I might have to mention that these files could deviate from the original code. These were originally used for multiple years without any tracing in a repo, and the people that used and adapted these files have long been gone in the meantime. But even an indication of the regular flow in these files could help me a lot.
Many thanks!
<compiler MACH="wice" COMPILER="intel">
<NETCDF_PATH>/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a</NETCDF_PATH>
<NETCDF_DIR>/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a</NETCDF_DIR>
<ADD_SLIBS>$(shell nc-config --flibs) -mkl</ADD_SLIBS>
<PNETCDF_PATH></PNETCDF_PATH>
<MPICC>mpiicc</MPICC>
<MPIFC>mpiifort</MPIFC>
<MPICXX>mpiicpc</MPICXX>
<CONFIG_ARGS></CONFIG_ARGS>
<ESMF_LIBDIR></ESMF_LIBDIR>
<FFLAGS>-I/data/leuven/user_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/build/lib/psmile.MPI1 -I/data/leuvenuser_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/build/lib/mct -I/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a/include -I/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a/include</FFLAGS>
<LDFLAGS>-L/data/leuven/user_id/apps/wice.icelake.2021a/exp_template_paramour/OASIS/lib -lpsmile.MPI1 -lscrip -lmct_oasis -lmpeu_oasis -L/apps/leuven/rocky8/icelake/2021a/software/netCDF/4.8.0-iimpi-2021a/lib64/ -lnetcdf -L/apps/leuven/rocky8/icelake/2021a/software/netCDF-Fortran/4.5.3-iimpi-2021a/lib/ -lnetcdff </LDFLAGS>
<ADD_CPPDEFS> -DCOUP_OAS -DLINUX</ADD_CPPDEFS>-->
</compiler>
From what I've found these compiler settings are then moved to a file called 'Macros' in the CESM build directory. The content of this file does match the content of the compiler settings above.
So my issue now: from here on, I am a bit confused as to how this Macros files leads to a correct declaration of 'NETCDF_PATH' in the pio configure file. Could anyone perhaps give me a clue on how this information uis made available to the configure file? What step loads the variables in the Macros file in the environment, or makes the configure process correctly read this file?
I might have to mention that these files could deviate from the original code. These were originally used for multiple years without any tracing in a repo, and the people that used and adapted these files have long been gone in the meantime. But even an indication of the regular flow in these files could help me a lot.
Many thanks!