hpc / ior

IOR and mdtest
Other
365 stars 161 forks source link

Cannot build with backends other than default ones #421

Open mdorier opened 2 years ago

mdorier commented 2 years ago

I'm trying to build IOR with some backends. So far I tried HDF5, Parallel NetCDF, and AIO, and I don't manage to compile IOR with any of them.

HDF5

I have the hdf5 package installed via spack and loaded, with the +mpi variant.

If I do

$ ../configure --with-hdf5`

The configure process runs without any error, however the make command fails with this error:

Making all in .
  CC       ior-aiori-HDF5.o
../../src/aiori-HDF5.c:25:10: fatal error: hdf5.h: No such file or directory
   25 | #include <hdf5.h>

If I do

$ ../configure --with-hdf5=`spack location -i hdf5`

Then IOR simply doesn't compile ior-aiori-HDF5.c and the HDF5 backend isn't available when running IOR. Note that spack location -i hdf5 correctly gives me the location where HDF5 is installed.

The latter seems normal per the configure.ac file, which has AM_CONDITIONAL([USE_HDF5_AIORI], [test x$with_hdf5 = xyes]), so it doesn't expect a path, only "yes" or "no" (or just --with-hdf5) however I don't know why it doesn't find HDF5 when it's loaded.

With the former (just passing --with-hdf5, I can see this in the log:

checking for H5Pset_all_coll_metadata_ops... no

which corresponds to this in the configure.ac file:

AM_COND_IF([USE_HDF5_AIORI],[
        AC_DEFINE([USE_HDF5_AIORI], [], [Build HDF5 backend AIORI])
        AC_SEARCH_LIBS([H5Pset_all_coll_metadata_ops], [hdf5])
        AC_CHECK_FUNCS([H5Pset_all_coll_metadata_ops])
])

Yes I can confirm with nm that the installed hdf5 library does have this symbol, and it's in the headers as well.

Parallel NetCDF

I have the parallel-netcdf package install via spack and loaded.

If I do

$ ../configure --with-ncmpi

The configure command fails with this error:

configure: error: --with-ncmpi was given but pnetcdf.h not found

If I do

../configure  --with-ncmpi=`spack location -i parallel-netcdf`

The configure command runs fine, but aiori-NCMPI.c is not compiled and the NetCDF backend isn't available to IOR.

Once again, it seems that the configure.ac file is not expecting a path, and even though Parallel NetCDF is installed, IOR does not find it when passing just --with-ncmpi.

AIO

I have the libaio package installed via spack, and loaded.

If I do

$ ../configure --with-aio

The configure command runs fine, but the make command fails with this error:

../../src/aiori-aio.c:10:10: fatal error: libaio.h: No such file or directory
   10 | #include <libaio.h>

Once again, if I provide the path to libaio as --with-aio=... then configure runs fine but does not compile the AIO backend.

JulianKunkel commented 2 years ago

Can you have a look at ./testing/build-pnetcdf.sh file? That shows how pnetcdf can be compiled -> needs to be run in the top-level dir. Arguably, it does set CFLAGS and LDFLAGS. Still I agree, the auto-detection should be fixed.

mdorier commented 2 years ago

Indeed, this works:

$ ../configure --with-hdf5 CFLAGS=-I`spack location -i hdf5`/include LDFLAGS="-L`spack location -i hdf5`/lib -lhdf5"

I think it would be a good idea to use pkg-config to locate dependencies when possible, or to have a way of specifying the path if pkg-config is not an option.