I try to install netcdf-c in UBUNTU 20.4 based in the “CMAQ/CMAQ_UG_tutorial_build_library_intel.md at master · USEPA/CMAQ · GitHub” guideline. However, I do not have environmental modules. How can I install that on my system? I want to compile IOAPI and SMOKE with GNU compiler. in that case, should I use GNU compile instead of intel in this guideline?
A few notes:
-
You should use the same compilers and compile-flags for the entire system: netCDF, I/O API, M3Tools, CMAQ, SMOKE
-
The official I/O API build instructions can be found here https://cjcoats.github.io/ioapi/AVAIL.html#build; they include notes on netCDF as item 8 and also at https://cjcoats.github.io/ioapi/AVAIL.html#ncf4
-
The CMAQ-website document you reference has a number of specifics for the UNC supercomuter-clusters, so don’t worry about them. In particular, ignore module commands.
-
All of these documents assume the use of csh or tcsh; to adapt for bash, replace commands of the form setenv foo bar by the equivalent export foo = bar.
The build-system for netCDF (note that you need both netCDF-C and netCDF-Fortran) already assumes that you are using the Gnu compilers gcc and gfortran unless you override it with environment variables CC
and FC
, making your particular installation a little easier.
On the other hand, if your Ubuntu is using gfortran version 10 or later (run the command gfortran -v to find out) you will need either to add
-fallow_argument_mismatch
to the Fortran compile-flags (and also to the compile-flags for CMAQ) or use netCDF-Fortran version 4.5.4 or later, due to gfortran’s idiosyncratic interpretation of the latest version of the Fortran Standard; however, its build system is very different, and also requires that you have installed cmake. For the I/O API and SMOKE, you will need to use compile-type Linux2_x86_64gfort10
– in your case, do the command
export BIN = Linux2_x86_64gfort10.
You do not need the MPI compilers mpicc and mpif90 for netCDF, I/O API, nor SMOKE; however, you do need them for the CMAQ CCTM; you’ll probably want to do the appropriate Ubuntu app get commands for either OpenMPI or MPICH (both of which are available versions of MPI).
Thank you for your help. my gfortran version is 9.3 and my Shell is csh.
Based on your explanation I set my cshrc as follows:
setenv CC gcc
setenv CXX g++
setenv FC gfortran
setenv FCFLAGS -m64
setenv F77 gfortran
setenv FFLAGS -m64
according to install.md file in netcdf-c I should install zlib and HDF5 before installing netcdf-c. However, I did not see this instruction in the guidelines. Should I install these libraries as well? Is the version of these libraries important?
Moreover, I have started to configure netcdf-fortran and although I set CPPFLAGS as it is recommended in CMAQ/CMAQ_UG_tutorial_build_library_intel.md at master · USEPA/CMAQ · GitHub
I faced an error which mentioned “netcdf.h could not be found. Please set CPPFLAGS”
See https://cjcoats.github.io/ioapi/AVAIL.html#ncf4
Life is a lot simpler if you do netCDF’s configure with flags
--disable-netcdf4 --disable-dap
Otherwise you are going to have to modify all the Makefiles for I/O API, SMOKE, CMAQ, etc., to fit the extra libraries you need.