pghysels / STRUMPACK

Structured Matrix Package (LBNL)
http://portal.nersc.gov/project/sparse/strumpack/
Other
167 stars 41 forks source link

macOS: build looks for MPICH even when it is disabled and then fails to configure #125

Open barracuda156 opened 1 week ago

barracuda156 commented 1 week ago

Any idea why it does not respect disabling MPICH?

--->  Configuring strumpack
        (using ccache)
Executing:  cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_math_strumpack/strumpack/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DBUILD_SHARED_LIBS=ON -DSTRUMPACK_COUNT_FLOPS=OFF -DSTRUMPACK_MESSAGE_COUNTER=OFF -DSTRUMPACK_TASK_TIMERS=OFF -DSTRUMPACK_USE_BLAS64=OFF -DSTRUMPACK_USE_CUDA=OFF -DSTRUMPACK_USE_GETOPT=ON -DSTRUMPACK_USE_HIP=OFF -DSTRUMPACK_USE_MPI=OFF -DSTRUMPACK_USE_OPENMP=ON -DSTRUMPACK_USE_SYCL=OFF -DTPL_ENABLE_BPACK=OFF -DTPL_ENABLE_COMBBLAS=OFF -DTPL_ENABLE_KBLAS=OFF -DTPL_ENABLE_MAGMA=OFF -DTPL_ENABLE_MATLAB=OFF -DTPL_ENABLE_PAPI=OFF -DTPL_ENABLE_PARMETIS=OFF -DTPL_ENABLE_PTSCOTCH=OFF -DTPL_ENABLE_SCOTCH=ON -DTPL_ENABLE_SLATE=OFF -DTPL_ENABLE_SZ3=OFF -DTPL_ENABLE_ZFP=OFF -DTPL_METIS_PREFIX=/opt/local -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" -DTPL_BLAS_LIBRARIES=/opt/local/lib/libopenblas.dylib -DTPL_LAPACK_LIBRARIES=/opt/local/lib/libopenblas.dylib /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_math_strumpack/strumpack/work/STRUMPACK-8.0.0 
-- The CXX compiler identification is Clang 18.1.8
-- The C compiler identification is Clang 18.1.8
-- The Fortran compiler identification is GNU 14.2.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/local/bin/clang++-mp-18 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/local/bin/clang-mp-18 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Checking whether Fortran compiler has -isysroot
-- Checking whether Fortran compiler has -isysroot - yes
-- Checking whether Fortran compiler supports OSX deployment target flag
-- Checking whether Fortran compiler supports OSX deployment target flag - yes
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: /opt/local/bin/gfortran-mp-14 - skipped
-- Detecting Fortran/C Interface
-- Detecting Fortran/C Interface - Found GLOBAL and MODULE mangling
-- Verifying Fortran/CXX Compiler Compatibility
-- Verifying Fortran/CXX Compiler Compatibility - Success
-- Found OpenMP_C: -fopenmp=libomp (found version "5.1")
-- Found OpenMP_CXX: -fopenmp=libomp (found version "5.1")
-- Found OpenMP_Fortran: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "5.1")
-- Support for OpenMP task depend/priority: TRUE
-- Support for OpenMP taskloop: TRUE
-- Using BLAS from TPL_BLAS_LIBRARIES (/opt/local/lib/libopenblas.dylib)
-- Using LAPACK from TPL_LAPACK_LIBRARIES (/opt/local/lib/libopenblas.dylib)
-- Found METIS: /opt/local/lib/libmetis.dylib (found version "5.2.1")
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Checking for module 'mpi-c'
--   No package 'mpi-c' found
-- Could NOT find MPI_C (missing: MPI_C_LIB_NAMES MPI_C_HEADER_DIR MPI_C_WORKS) 
-- Checking for module 'mpi-cxx'
--   No package 'mpi-cxx' found
-- Could NOT find MPI_CXX (missing: MPI_CXX_LIB_NAMES MPI_CXX_HEADER_DIR MPI_CXX_WORKS) 
-- Checking for module 'mpi-fort'
--   No package 'mpi-fort' found
-- Could NOT find MPI_Fortran (missing: MPI_Fortran_LIB_NAMES MPI_Fortran_F77_HEADER_DIR MPI_Fortran_MODULE_DIR MPI_Fortran_WORKS) 
CMake Error at /opt/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find MPI (missing: MPI_C_FOUND MPI_CXX_FOUND MPI_Fortran_FOUND)
Call Stack (most recent call first):
  /opt/local/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /opt/local/share/cmake-3.29/Modules/FindMPI.cmake:1837 (find_package_handle_standard_args)
  /opt/local/share/cmake-3.29/Modules/CMakeFindDependencyMacro.cmake:76 (find_package)
  /opt/local/lib/cmake/scotch/SCOTCHConfig.cmake:86 (find_dependency)
  CMakeLists.txt:449 (find_package)

-- Configuring incomplete, errors occurred!
Command failed:  cd "/opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_math_strumpack/strumpack/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=MacPorts -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON -DCMAKE_INSTALL_RPATH="/opt/local/lib" -Wno-dev -DBUILD_SHARED_LIBS=ON -DSTRUMPACK_COUNT_FLOPS=OFF -DSTRUMPACK_MESSAGE_COUNTER=OFF -DSTRUMPACK_TASK_TIMERS=OFF -DSTRUMPACK_USE_BLAS64=OFF -DSTRUMPACK_USE_CUDA=OFF -DSTRUMPACK_USE_GETOPT=ON -DSTRUMPACK_USE_HIP=OFF -DSTRUMPACK_USE_MPI=OFF -DSTRUMPACK_USE_OPENMP=ON -DSTRUMPACK_USE_SYCL=OFF -DTPL_ENABLE_BPACK=OFF -DTPL_ENABLE_COMBBLAS=OFF -DTPL_ENABLE_KBLAS=OFF -DTPL_ENABLE_MAGMA=OFF -DTPL_ENABLE_MATLAB=OFF -DTPL_ENABLE_PAPI=OFF -DTPL_ENABLE_PARMETIS=OFF -DTPL_ENABLE_PTSCOTCH=OFF -DTPL_ENABLE_SCOTCH=ON -DTPL_ENABLE_SLATE=OFF -DTPL_ENABLE_SZ3=OFF -DTPL_ENABLE_ZFP=OFF -DTPL_METIS_PREFIX=/opt/local -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" -DTPL_BLAS_LIBRARIES=/opt/local/lib/libopenblas.dylib -DTPL_LAPACK_LIBRARIES=/opt/local/lib/libopenblas.dylib /opt/local/var/macports/build/_opt_svacchanda_SonomaPorts_math_strumpack/strumpack/work/STRUMPACK-8.0.0 
Exit code: 1
barracuda156 commented 1 week ago

@pghysels 7.2.0 configures normally on the same system, so it is not something broken in MacPorts set-up. 8.0.0 fails both locally on Sonoma and on CI.

pghysels commented 1 week ago

It looks like Scotch is searching for MPI. Can you try disabing Scotch (besides PT-Scotch)

barracuda156 commented 1 week ago

It looks like Scotch is searching for MPI

This is what I thought, but 7.2.0 has the same config settings, and everything works with the same version of scotch.

7.2.0: https://github.com/macports/macports-ports/blob/962f38384d582875b5504b7daa73cc4168db6d95/math/strumpack/Portfile And this is 8.0.0 update: https://github.com/macports/macports-ports/pull/26456/commits/54391705aedfccef9d484f414f957b6c8239e9cd

P. S. Yeah, we could probably disable scotch or make MPICH required, but it seems there is a regression here, otherwise I cannot explain why 7.2.0 works with the same scotch, Clang and CMake.

pghysels commented 1 week ago

There are some changes here related to Scotch, which now uses CMake: https://github.com/pghysels/STRUMPACK/commit/099e3503de64dec98652553ec4a79536e4e6b1b0 What version of scotch are you using, was scotch compiled with MPI?

barracuda156 commented 1 week ago

Yes, scotch is built with MPICH. I just updated it few days ago to 7.0.5: https://github.com/macports/macports-ports/commit/f0a0bbbfc3237d7f2ada673ea7cc3f857b3ca763

barracuda156 commented 1 week ago

There are some changes here related to Scotch, which now uses CMake

Ok, so looks like CMake module does not respect configure argument and just forces MPI. Does it work for you if you disable MPI in strumpack, but build scotch with MPI?

If it is a bug in CMake, I can open an issue with its upstream.

pghysels commented 1 week ago

The check for MPI is in /opt/local/lib/cmake/scotch/SCOTCHConfig.cmake, because your Scotch was build with MPI. Looks like there is no way around that.

barracuda156 commented 1 week ago

@pghysels Do you know if it is actually required though? If not, then it should be fixed in CMake, if possible. Or maybe restore a local module here, which worked fine.

pghysels commented 1 week ago

You can reinstall Scotch without MPI. Or build STRUMPACK with MPI (looks like you have MPI). Or you can report it to Scotch. If you build Scotch with MPI then @BUILD_PTSCOTCH@ here: https://gitlab.inria.fr/scotch/scotch/-/blob/master/cmake/SCOTCHConfig.cmake.in?ref_type=heads#L61 will be ON. Maybe Scotch can split their SCOTCHConfig.cmake into sequential Scotch and distributed PT-Scotch?