-
Notifications
You must be signed in to change notification settings - Fork 64
Description
Hello,
Error description
I've built Underworld2 from source on a Cray machine (ARCHER2), but importing fails with an undefined MPI symbol (mpi_pack_):
(uw2pyenv)> python -m "import underworld"
[...rest of stack trace...]
ImportError: /mnt/lustre/a2fs-work2/work/z19/shared/underworld2/uw2pyenv/lib/python3.10/site-packages/underworld/lib/libStgDomain.so: undefined symbol: mpi_pack_
I can see that libStgDomain.so is linked to the correct MPI library (Cray MPICH):
> ldd /mnt/lustre/a2fs-work2/work/z19/shared/underworld2/uw2pyenv/lib/python3.10/site-packages/underworld/lib/libStGermain.so
[...various libs...]
libmpi_gnu_91.so.12 => /opt/cray/pe/lib64/libmpi_gnu_91.so.12 (0x00007f366b200000)
[...various libs...]
This MPI library contains the symbol definition for MPI_Pack:
> nm -a /opt/cray/pe/lib64/libmpi_gnu_91.so.12 | grep -w MPI_Pack
0000000000721e00 W MPI_Pack
but not for for mpi_pack_:
> nm -a /opt/cray/pe/lib64/libmpi_gnu_91.so.12 | grep -w mpi_pack_
>
I think the issue is therefore a case mismatch in the symbol names. Would you be able to advise why libStGermain.so expects mpi_pack_ (all lowercase) rather than MPI_Pack, wether I've overlooked anything and how I might fix this?
Build procedure
My build procedure for Underworld2 was as follows:
Load relevant modules:
module load PrgEnv-gnu
module load petsc
module load cray-hdf5-parallel
module load cray-python
Create virtual environment (based off of cray-python, which provides mpi4py linked to the Cray MPICH library):
python -m venv --system-site-packages ./uw2pyenv
source ./uw2pyenv/bin/activate
Install h5py using the guidance provided for MPI-parallel h5py (note the Cray compiler wrapper cc links to the Cray MPICH library):
CC=cc HDF5_MPI="ON" pip install --no-binary=h5py h5py
Set compilers to be the Cray compiler wrappers:
export MPICC=cc
export MPICXX=CC
export MPIF90=ftn
Make sure cmake can find the LibXml2 and PETSc installs provided by the modules:
export PKG_CONFIG_PATH=$PETSC_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=$LIBXML2_DIR/lib/pkgconfig:$PKG_CONFIG_PATH
Then in src/underworld/libUnderworld/CMakeLists.txt change
pkg_check_modules(PETSc PETSc)
to
pkg_check_modules(PETSc petsc)
Since the pkconfig file in our PETSc install is called petsc.pc not PETSc.pc <--- possibly related to the lowercase/uppercase symbol issue?
Finally pip install, with output shown:
(uw2pyenv)> pip install .
Processing /mnt/lustre/a2fs-work2/work/z19/shared/underworld2/underworld2-2.17.0
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
[...etc...]
Successfully built underworld
Installing collected packages: underworld
Successfully installed underworld-2.17.0
The attempted import of underworld in a python session fails as described above.