MESH-Model / MESH-Dev

This repository contains the official MESH development code, which is the basis for the 'tags' listed under the MESH-Releases repository. The same tags are listed under this repository. Legacy branches and utilities have also been ported from the former SVN (Subversion) repository. Future developments must create 'forks' from this repository.
Other
2 stars 3 forks source link

compiling MESH with intel 2023 on Clusters #57

Closed mee067 closed 1 month ago

mee067 commented 2 months ago

It is advantageous to move to intel 2021 or further because they no longer need a license. However, I am not sure if that's appropriate. I have been using intel 2018 - jumping to 2021 worked for both single precision and double precision but intel 2023 gives the following error for double precision (make intel_mpi netcdf double):

icx: error: unknown argument: '-r8'

Seems the option for setting the precision has changed for the new compiler version. Hope somebody would know the new setting. I got overwhelmed trying to figure out the compile option when I searched.

mee067 commented 1 month ago

This was resolved via email communications with @dprincz as follows:

r8 still works but should be specified as an GFLAG rather than an LFLAG:

In this block in makefile, replace ‘LFLAG’ with ‘GFLAG’:

# Override compile options if 'DOUBLE' enabled.
ifdef DOUBLE
ifeq ($(DIST),intel)
GFLAG+=-r8
else
GFLAG+=-fdefault-double-8 -fdefault-real-8
endif
endif

This caused an issue when compiling some SVS code:

mpifort -fpp -free -c -O2 -fp-model precise -r8 -I./LSS_Model/SVS/svs1/changes_to_rpnphy -I./LSS_Model/SVS/svs1/rpnphy_5.8.3_all -I./LSS_Model/SVS/svs1/svs_GEM_v5.8.rc2 -I./Modules/librmn/19.7.0/CUSTOM_INCLUDES -DRUNSVS -I/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/intel2023/netcdf-fortran/4.6.1/include -I/cvmfs/soft.computecanada.ca/easybuild/software/2023/x86-64-v3/Compiler/intel2023/netcdf-fortran/4.6.1/include -DNETCDF -Tf ./LSS_Model/SVS/svs1/src/runsvs_mesh.F90
./LSS_Model/SVS/svs1/src/runsvs_mesh.F90(1009): error #6633: The type of the actual argument differs from the type of the dummy argument.   [BUS]
        call compvirttemp(sigma_t, bus, bussiz)
-----------------------------------^
./LSS_Model/SVS/svs1/src/runsvs_mesh.F90(1010): error #6633: The type of the actual argument differs from the type of the dummy argument.   [BUS]
        if (.not. observed_forcing) call surflayerheight(sigma_u, sigma_t, bus, bussiz)
---------------------------------------------------------------------------^
compilation aborted for ./LSS_Model/SVS/svs1/src/runsvs_mesh.F90 (code 1)
make: *** [makefile:195: runsvs_mesh.o] Error 1

which was resolved by changing the makefile again:

In makefile, update the rule for ftn90 by adding ‘GFLAG’:


%.o: %.ftn90
       $(FC) $(FTN90PP) $(LFLAG) $(GFLAG) $(INC_DIRS) $(DFLAG) $(FTN90PPOPT)$<
mee067 commented 1 month ago

The above changes should still work when compiling with older intel compilers like 2018, and 2021. They do not need to be reversed.