Up to Installation and compilation
Hello all, I'm trying to compile OASIS using GCC. I got a problem when compiling mod_oasis_load_balancing.F90: /gpfs/softs/easybuild/software/OpenMPI/4.1.4-GCC-11.3.0/bin/mpif90 -march=native -fdefault-real-8 -O2 -fallow-argument-mismatch -funroll-all-loops -fcray-pointer -ffree-line-length-none -march=native -I/gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/INSTALL_OASIS/include -Duse_netCDF -Duse_comm_MPI1 -D__VERBOSE -DTREAT_OVERLAY -I/gpfs/softs/easybuild/software/netCDF/4.9.0-gompi-2022a/include -I/gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/lib/psmile/include -I/gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/INSTALL_OASIS/build-static/lib/mct -I/gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/INSTALL_OASIS/build-static/lib/scrip -c /gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/lib/psmile/src/mod_oasis_load_balancing.F90 /gpfs/home/acad/ulg-topoclim/dmaure/models/oasis3-mct/lib/psmile/src/mod_oasis_load_balancing.F90:32:8: 32 | USE netcdf | 1 Fatal Error: Cannot open module file 'netcdf.mod' for reading at (1): No such file or directory compilation terminated. gmake[2]: *** [Makefile:43: mod_oasis_load_balancing.o] Error 1 I understand the mistake, the message is explicit but I don't know how to solve it. Using intel on another supercomputer, I only provided the netcdf library (not netcdf-Fortran) and intel found the netcdf module while not in this case with GCC. The header examples sometimes have two NETCDF_INCLUDE to include netCDF-Fortran (where I indeed found netcdf.mod). I tried something similar (see below with NETCDF_INCLUDE2). It still stops the compilation for the same module but this time there are no error. It just stops. I guess there is something wrong in the way I specify both netcdf, or maybe I shouldn't specify both? Thanks for your help. I hope I haven't wasted too much of your time on a silly mistake. :s Here is my make; (NB the OASIS version is not the latest one, ~one year old)) and I add the loaded module at the end if it provides more information. MPIDIR = /gpfs/softs/easybuild/software/OpenMPI/4.1.4-GCC-11.3.0 MPIBIN = $(MPIDIR)/bin MPI_INCLUDE = $(MPIDIR)/include MPILIB = -L$(MPIDIR)/lib MPIRUN = $(MPIBIN)/mpirun # # NETCDF library NETCDF_INCLUDE =/gpfs/softs/easybuild/software/netCDF/4.9.0-gompi-2022a/include NETCDF_INCLUDE2 =/gpfs/softs/easybuild/software/netCDF-Fortran/4.6.0-gompi-2022a/include NETCDF_LIBRARY = -Wl,-rpath,/gpfs/softs/easybuild/software/netCDF/4.9.0-gompi-2022a/lib -L/gpfs/softs/easybuild/software/netCDF/4.9.0-gompi-2022a/lib -lnetcdff -lnetcdf # # Compiling and other commands MAKE = gmake F90 = $(MPIBIN)/mpif90 -march=native F = $(F90) f90 = $(F90) f = $(F90) CC = $(MPIBIN)/mpicc -I$(MPI_INCLUDE) LD = $(MPIBIN)/mpif90 $(MPILIB) DYNOPT = -fPIC LDDYNOPT = -shared AR = ar ARFLAGS = -ruv # Fortran libraries for C linking F2C_LIBS = -lifcore -lifcoremt -lifport -limf # # CPP keys and compiler options # CPPDEF = -Duse_netCDF -Duse_comm_$(CHAN) -D__VERBOSE -DTREAT_OVERLAY # # -g is necessary in F90FLAGS and LDFLAGS for pgf90 versions lower than 6.1 # FCBASEFLAGS = -fdefault-real-8 -O2 -fallow-argument-mismatch -funroll-all-loops -fcray-pointer -ffree-line-length-none -march=native #FCBASEFLAGS = -g -traceback -fpe0 -O0 -check all -check noarg_temp_created -I. -assume byterecl -mt_mpi -qopenmp #CCBASEFLAGS = -O2 -qopenmp -march=core-avx2 CCBASEFLAGS = -O0 -fcommon # # INC_DIR : includes all *mod for each library INC_DIR = -I$(ARCHDIR)/include # FLIBS : for toys when linking in local Makefile FLIBS=${NETCDF_LIBRARY} ################### # F90FLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) -I$(NETCDF_INCLUDE2) f90FLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) -I$(NETCDF_INCLUDE2) FFLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) -I$(NETCDF_INCLUDE2) fFLAGS = $(FCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) -I$(NETCDF_INCLUDE2) CCFLAGS = $(CCBASEFLAGS) $(INC_DIR) $(CPPDEF) -I$(NETCDF_INCLUDE) -I$(NETCDF_INCLUDE2) LDFLAGS = $(FCBASEFLAGS) F2C_LDFLAGS = $(F2C_LIBS) # Currently Loaded Modules: 1) GCCcore/11.3.0 9) hwloc/.2.7.1-GCCcore-11.3.0 (H) 17) Szip/.2.1.1-GCCcore-11.3.0 (H) 25) netCDF/4.9.0-gompi-2022a 33) Boost/1.79.0-GCC-11.3.0 41) METIS/5.1.0-GCCcore-11.3.0 2) zlib/.1.2.12-GCCcore-11.3.0 (H) 10) OpenSSL/.1.1 (H) 18) cURL/.7.83.0-GCCcore-11.3.0 (H) 26) HDF5/1.12.2-gompi-2022a 34) GCC/11.3.0 42) GMP/.6.2.1-GCCcore-11.3.0 (H) 3) binutils/.2.38-GCCcore-11.3.0 (H) 11) libevent/.2.1.12-GCCcore-11.3.0 (H) 19) gzip/.1.12-GCCcore-11.3.0 (H) 27) expat/.2.4.8-GCCcore-11.3.0 (H) 35) OpenBLAS/0.3.20-GCC-11.3.0 43) MPFR/.4.1.0-GCCcore-11.3.0 (H) 4) intel-compilers/2022.1.0 12) UCX/1.12.1-GCCcore-11.3.0 20) lz4/.1.9.3-GCCcore-11.3.0 (H) 28) ncurses/.6.3-GCCcore-11.3.0 (H) 36) FlexiBLAS/3.2.0-GCC-11.3.0 44) SuiteSparse/5.13.0-foss-2022a-METIS-5.1.0 5) numactl/.2.0.14-GCCcore-11.3.0 (H) 13) libfabric/1.15.1-GCCcore-11.3.0 21) zstd/.1.5.2-GCCcore-11.3.0 (H) 29) libreadline/.8.1.2-GCCcore-11.3.0 (H) 37) ScaLAPACK/2.2.0-gompi-2022a-fb 6) XZ/.5.2.5-GCCcore-11.3.0 (H) 14) PMIx/4.1.2-GCCcore-11.3.0 22) bzip2/.1.0.8-GCCcore-11.3.0 (H) 30) DB/.18.1.40-GCCcore-11.3.0 (H) 38) FFTW/3.3.10-GCC-11.3.0 7) libxml2/.2.9.13-GCCcore-11.3.0 (H) 15) UCC/.1.0.0-GCCcore-11.3.0 (H) 23) gompi/2022a 31) Perl/.5.34.1-GCCcore-11.3.0 (H) 39) FFTW.MPI/3.3.10-gompi-2022a 8) libpciaccess/.0.16-GCCcore-11.3.0 (H) 16) OpenMPI/4.1.4-GCC-11.3.0 24) netCDF-Fortran/4.6.0-gompi-2022a 32) ICU/.71.1-GCCcore-11.3.0 (H) 40) foss/2022a
For GCC compilation, I specify a NETCDF_MOD directory (the include directory). This might explain your error. So for example I have: # NETCDF library NETCDF_INCLUDE = /home/nheavens/.conda/envs/ukcm_nheavens_test2/include # The include directory for your netCDF version NETCDF_MOD = /home/nheavens/.conda/envs/ukcm_nheavens_test2/include #Your netCDF include directory should have .mod files, but they are sometimes installed elsewhere. Adjust the directory accordingly. NETCDF_LIBRARY = -L/home/nheavens/.conda/envs/ukcm_nheavens_test2/lib -lnetcdff - lnetcdf # The library directory for your netCDF version Nick
Yes, I think this is right. But then you have to add "-I$(NETCDF_MOD)" in the makefile flags (F90FLAGS, f90FLAGS, FFLAGS, fFLAGS, CCFLAGS, ...), see for example util/make_dir/make.gfortran7.3.1_openmpi4.0.5_cerfacs (on the OASIS3-MCT_5.0 branch) Hoping this helps, let us know ... Sophie
Dear Nick and Sophie, Thanks for your answer! I'll try your suggestions when the maintenance of our supercomputer is over. Best, Christoph Kittel