Building NETCDF by PGI 19.10 compiler

I have NetCdf installed in my Centos using Yum install, which I believe used gfortran /c compiler. But I have built and run CMAQ/CAMx by PGI compiler. And now for post processing I need to install ioapi and amet . To be consistent I want to build NetCDF by using the same compiler.

But I can not find any documents for that.
Please help.

Download netCDF-C and netCDF-Fortran from UCAR: see and un-tar/un-zip the tar-ball they give you.

In the top-level directory of the resulting installation, there is an Read it, as well as the I/O API netCDF-installation notes

Thank you for your reply.
I used,
mkdir /usr/local/netcdf-4.7.4
setenv CFLAGS -I/usr/local/hdf5-1.8.18/include
setenv LDFLAGS -L/usr/local/hdf5-1.8.18/lib
setenv FC pgf90
./configure --prefix=/usr/local/netcdf-4.7.4
make install
And finally applied ‘make check’ command, which was successful. But the ‘nc-config --version’ command still gives me netCDF 4.3.31 that was built by using FC gfortran.

Then I tried to change the --prefix=usr/bin ( because I get olde4.3.3.1 version path by applying ’ which nc-config ’ command /usr/bin/nc-config.
But it is still not updating to the new version 4.7.4.

How can I delete all the files related to older version or is there any other way to make the system recognize the new version 4…7.4?


There should be an nc-config under your /usr/local/netcdf-4.7.4 directory: do the command
find -name nc-config /usr/local/netcdf-4.7
and then use the result to see what that one says (basically, nc-config hard-codes the build-information of the netCDF installation of which it is a part: in the case of /usr/bin/nc-config the vendor’s netCDF not yours.

Thank you so much. After installation, I used
setenv PATH /usr/local/netcdf-4.7.4/bin:$PATH

and Then ‘nc-config --version’ gives me ’ netCDF 4.7.4’. But when I did ’ nc-config --all’, It is still giving me ’ fc gfortran’ (attached log ncconfig.txt (1.8 KB) ). I don’t understand why it is still giving me ‘fc gfortran’ (I used FC pgf90 during installation).

Am I understanding these correctly?


The matching nf-config tells about the Fortran libnetcdff.a

Thank you. I got it now.
I installed netcdf-fortran 4.5.3 by using following commands
cd netcdf-fortran-4.4.4
setenv CPPFLAGS -I/usr/local/netcdf-
setenv LDFLAGS -L/usr/local/netcdf-
setenv LD_LIBRARY_PATH /usr/local/netcdf-
setenv FC pgf90
./configure --prefix=/usr/local/netcdf-
make install

And then
setenv PATH /usr/local/netcdf-4.7.4/bin:$PATH

If I apply nf-config --all ,it gives ’ fc -pgf90’