WARNING : NetCDF is not WORKING!

Hello every one,
I am trying to install abinit.9.4.2 in Ubuntu 20.04 (i7 lenovo laptop).
I followed what is recommended in Ubuntu - abinit
using the follwing settings:
sam.ac9.log (1.9 KB)
at the end I get:
±-----------------------------------------------------------------+
| WARNING : NetCDF is not WORKING ! |
±-----------------------------------------------------------------+
| Please specify the installation directory for NetCDF |
±-----------------------------------------------------------------+

±-----------------------------------------------------------------+
| WARNING : NetCDF Fortran is not WORKING ! |
±-----------------------------------------------------------------+
| Please specify the installation directory for Netcdf-fortran |
±-----------------------------------------------------------------+

±-----------------------------------------------------------------+
| Problems must be solved before continuing |
±-----------------------------------------------------------------+

config.log (176.9 KB)
I attached the config.log as well for you kind consideration.
Many thanks,
Samir

Hi @samabdel! Is it possible to look at your .ac9 file used for the configure? It must be named appropriately with the result of the hostname command ({hostname}.ac9) or you must launch the configure script with the option --with-config-file=your_config_file.ac9. In this .ac9 file you must point out where the netcdf library is installed (you can use the command with_netcdf_fortran=$(nf-config --prefix).

Cheers,

Félix

Hi,

If you have these packages installed ( Ubuntu 20.10 ) :

  • libnetcdf-dev
  • libnetcdff-dev
  • libxc-dev
  • and MPI and HDF5

then this ac9 file should work :

FCFLAGS_EXTRA="-O2 -g -fallow-argument-mismatch"

with_mpi="yes"
enable_mpi_io="yes"

# with openblas
#with_linalg_flavor="openblas"
#LINALG_LIBS="-L/usr/lib/x86_64-linux-gnu -llapack -lblas -lopenblas -lpthread"

with_linalg_flavor="netlib"
LINALG_LIBS="-L/usr/lib/x86_64-linux-gnu -llapack -lblas"

with_fft_flavor="fftw3"
FFTW3_CPPFLAGS="-I/usr/include"
FFTW3_FCFLAGS="-I/usr/include"
FFTW3_LIBS="-L/usr/lib/x86_64-linux -lfftw3 -lfftw3f"

with_libxc="yes"
with_hdf5="yes"
with_netcdf="yes"
with_netcdf_fortran="yes"

Cheers,

jmb

1 Like

hi,

while analyzing your config.log, I noticed that there was, at least, a syntax problem in your sam.ac9 :

NETCDF_FORTRAN_CPPFLAGS="/usr/include"
NETCDF_FORTRAN_FCFLAGS="/usr/include"
NETCDF_CPPFLAGS="/usr/include"
NETCDF_FCFLAGS="/usr/include"
with_netcdf_fortran="/usr/include"

must be ( add -I ) :

NETCDF_FORTRAN_CPPFLAGS="-I /usr/include"
NETCDF_FORTRAN_FCFLAGS="-I /usr/include"
NETCDF_CPPFLAGS="-I /usr/include"
NETCDF_FCFLAGS="-I /usr/include"
with_netcdf_fortran="-I /usr/include"

this is what produces the error in the configure !

we can see it in the config log :

configure:39765: mpicc -o conftest -g -O2 -mtune=native -march=native -std=c99 -std=c99 -I/usr/lib/x86_64-linux-gnu/hdf5/serial/include /usr/include conftest.c -L/usr/lib/x86_64-linux-gnu -lnetcdf -L/usr/lib/x86_64-linux-gnu/hdf5/serial -lhdf5 -lhdf5_hl -L/usr/lib/x86_64-linux-gnu -lfftw3 -lfftw3f -L/usr/lib/x86_64-linux-gnu/openmpi/lib -L/usr/lib/gcc/x86_64-linux-gnu/9 -L/usr/lib/gcc/x86_64-linux-gnu/9/…/…/…/x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/9/…/…/…/…/lib -L/lib/x86_64-linux-gnu -L/lib/…/lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/…/lib -L/usr/lib/gcc/x86_64-linux-gnu/9/…/…/… -lmpi_usempif08 -lmpi_usempi_ignore_tkr -lmpi_mpifh -lmpi -lopen-rte -lopen-pal -lhwloc -ldl -levent -levent_pthreads -lutil -lgfortran -lm -lrt -lz -lquadmath -lpthread >&5
/usr/bin/ld: cannot find /usr/include: file format not recognized

A+

Dear jmbgmx,
Thank you so much…well done! it’s working very well now.
In the build parameters (the attached file), I have:

  • HDF5 enabled : yes (MPI support: no)
    • NetCDF enabled : yes (MPI support: no)
    • NetCDF-F enabled : yes (MPI support: no)
      Does it mean none of the HDF5, NetCDF, and NetCDF-F libraries is parallel?
      I need the parallel HDF5 for another code (the FLAPW Fleur code) to be able to compare the pseudopotential (Abinit) to an all-electron (Fleur) code.
      Many many thanks again,
      A+
      Samirbuild-parameters.log (1.1 KB)

Hi,
Apparently it is not what I thought…even the configuration is successfully finished, this is what I get when making make -j8:
sockets.c: In function ‘open_socket’:
sockets.c:84:23: error: storage size of ‘hints’ isn’t known
84 | struct addrinfo hints, *res;
| ^~~~~
sockets.c:90:24: error: ‘AI_PASSIVE’ undeclared (first use in this function)
90 | hints.ai_flags = AI_PASSIVE;
| ^~~~~~~~~~
sockets.c:90:24: note: each undeclared identifier is reported only once for each function it appears in
sockets.c:93:16: warning: implicit declaration of function ‘getaddrinfo’ [-Wimplicit-function-declaration]
93 | ai_err = getaddrinfo(host, service, &hints, &res);
| ^~~~~~~~~~~
sockets.c:97:26: error: dereferencing pointer to incomplete type ‘struct addrinfo’
97 | sockfd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
| ^~
sockets.c:103:7: warning: implicit declaration of function ‘freeaddrinfo’ [-Wimplicit-function-declaration]
103 | freeaddrinfo(res);
| ^~~~~~~~~~~~
make[5]: *** [Makefile:1224: sockets.o] Error 1
Thanks again,
Samir

I meant to compare Abinit results to FLAPW results.

Hi,

At a minimum, you need to install the :

sudo apt install libc6-dev

you may need more packages…

jmb

Hi,

To get the parallel version of HDF5, you need to install at least :

libhdf5-mpi-dev

and perhaps

libpnetcdf-dev

but it’s not trivial

There have been discussions about this topic ( old versions of abinit ):

Configuring Abinit 8.10 with NetCDF as default - ABINIT Discussion Forums
Configure says HDF5 and netCDF have MPI support but the code doesn't (v9.0.4) - ABINIT Discussion Forums

If I find some time, I’ll try to get a config with HDF5 parallel :wink:

jmb

Hi,
The libc6-dev is already installed in ubuntu.
I still have the same problem.
Do you think that it has to do with -std=c99 option?
Thanks,
Samir

Hi,
This is exactly what I suspected…It turns out that this error is due to the -std=c99 gcc compiling option.
This means that for some reason (and I don’t know which?) abinit does not need gcc -std=c99 to use c99.
Many many thanks again,
and hope that I will be able to install HDF5 parallel too…with your help.
Samir

Hi,
Apparently it is not over yet!!!
This is what I get when I run a parallel abinit:
ERROR
src_file: m_nctk.F90
src_line: 590
mpi_rank: 0
message: |
–netcdf-default is on but netcdf library does not support MPI-IO. Aborting now
#####################
Many thanks,
Samir

Hi,

I don’t understand why you have a compilation problem with socket.c
Can you give me the output of the following 5 commands :

grep c99 shared/common/src/02_clib/Makefile
mpicc -show
env
nc-config --all
nf-config --all

thx
jmb

Hi,

Try to compile with :

enable_netcdf_default="no"

Using

enable_netcdf_default="yes"

means that you want to change the default behaviour of Abinit so that all files are produced with netcdf without having to set iomode 3 in the input file.

This also means that Abinit will use netcdf to write/read the WFK.nc files and IO of these files with paral_kgb =1 requires MPI-IO capabilities.

This is the reason why the code is checking whether your netcdf library supports MPI-IO
in order to avoid runtime errors at end of a big calculation when we try to write the WFK in parallel.

If you don’t need to run big calculations with paral_kgb 1 and netcdf output, I would suggest to avoid using enable_netcdf_default=“yes”.

2 Likes

grep c99 shared/common/src/02_clib/Makefile
CPPFLAGS_HINTS_EXT = -P -std=c99
mpicc -show
gcc -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi -lopen-rte -lopen-pal -lhwloc -ldl -levent -levent_pthreads -lutil -lm -lrt -lz
I attached the following files too:
env.log (5.3 KB)
nc-config.log (1.1 KB)
nf-config.log (524 Bytes)

Hi samabdel,
If you still have problem related to netcdf or netcdf fortran. Then you should try this…

you can go build directory then after this you will go in fallbacks folder and run this command…

./build-abinit-fallbacks.sh
Then you will get path format of netcdf… after this you add this path in your configure file. Then you will go in build and configure this file with this command
…/configure --with-config-file="conf. file"