pyccel / psydac

Python 3 library for isogeometric analysis
https://pyccel.github.io/psydac/
MIT License
52 stars 18 forks source link

Provide alternative shell command for discovering HDF5_DIR #399

Closed kvrigor closed 6 months ago

kvrigor commented 7 months ago

On Ubuntu 22.04, h5pcc -showconfig gives the wrong installation point required by h5py:


            SUMMARY OF THE HDF5 CONFIGURATION
            =================================

General Information:
-------------------
                   HDF5 Version: 1.10.7
                  Configured on: Wed, 08 Dec 2021 23:33:27 +0000
                  Configured by: Debian
                    Host system: x86_64-pc-linux-gnu
              Uname information: Debian
                       Byte sex: little-endian
             Installation point: /usr
                    Flavor name: openmpi

pip3 install h5py will look for libhdf5.so which is at /usr/lib/x86_64-linux-gnu/hdf5/openmpi, not /usr. On Ubuntu/Debian one could directly extract HDF5_DIR with the command

export HDF5_DIR=$(dpkg -L libhdf5-openmpi-dev | grep libhdf5.so | xargs dirname)

I wonder if we should still suggest h5pcc -showconfig which doesn't really work and may trip users (e.g. #219). The command above may look "hacky", but I believe its robust and would still work for future Ubuntu/Debian releases unless libhdf5-openmpi-dev has been renamed—in such case the README has to be updated anyway to change the parallel HDF5 library name for the apt install step.

yguclu commented 6 months ago

@pyccel/psydac-dev If you use a Ubuntu/Debian OS, can you please verify that the new command works for you?

kvrigor commented 6 months ago

If the h5pcc command does not provide the correct information, I suggest that we remove it from the README.

Done 👍

Also I've applied the HDF5_DIR command to continuous-integration.yml. So far it could parse the path correctly.

yguclu commented 6 months ago

If the h5pcc command does not provide the correct information, I suggest that we remove it from the README.

Done 👍

Also I've applied the HDF5_DIR command to continuous-integration.yml. So far it could parse the path correctly.

I have just realized that in the continuous integration we do not use brew info hdf5-mpi on macOS, but rather the command

HDF5_DIR=$((h5pcc -showconfig -echo || true) | grep "Installation point:" | cut -d ":" -f2 | tr -d " ")

which was given by @nhamidn in commit c6e4cf1. Maybe a similar command can be made to work with brew?

kvrigor commented 6 months ago

Maybe a similar command can be made to work with brew?

I've no macOS to test on, but perhaps brew list hdf5-mpi | grep libhdf5.so | xargs dirname may work?

yguclu commented 6 months ago

Maybe a similar command can be made to work with brew?

I've no macOS to test on, but perhaps brew list hdf5-mpi | grep libhdf5.so | xargs dirname may work?

This one seems to work:

brew list hdf5-mpi | grep "libhdf5.dylib" | xargs dirname | xargs dirname
kvrigor commented 6 months ago

HDF5_DIR=$(brew list hdf5-mpi | grep "libhdf5.dylib" | xargs dirname) seems sufficient for h5py; the macOS test passed with this change 👍

I've modified the README once more—removing unnecessary details about the HDF5_DIR. I hope this makes the Installing the library step flow better.