cb-geo / mpm

CB-Geo High-Performance Material Point Method
https://www.cb-geo.com/research/mpm
Other
235 stars 82 forks source link

Compile the 'MPM' issue #732

Closed yy54787803 closed 1 year ago

yy54787803 commented 1 year ago

Describe the bug The compile with ‘MPM’ has an issue based on the current documentation.

To Reproduce the command 'sudo cmake -DCMAKE_CXX_COMPILER=g++ ..' will give issue as following :

-- The CXX compiler identification is GNU 11.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: filesystem system -- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") -- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") -- Found MPI: TRUE (found version "3.1")
-- The C compiler identification is GNU 9.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- HDF5: Using hdf5 compiler wrapper to determine CXX configuration -- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7") found components: CXX HL -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
-- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR) -- Checking for package 'KaHIP' -- Performing Test KAHIP_TEST_RUNS CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: PARHIP_LIBRARY linked by target "cmTC_421d1" in directory /home/yue/mpm/build/CMakeFiles/CMakeTmp

CMake Error at /usr/share/cmake-3.22/Modules/Internal/CheckSourceRuns.cmake:94 (try_run): Failed to generate test project build system. Call Stack (most recent call first): /usr/share/cmake-3.22/Modules/CheckCXXSourceRuns.cmake:76 (cmake_check_source_runs) cmake/FindKaHIP.cmake:92 (check_cxx_source_runs) CMakeLists.txt:106 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/yue/mpm/build/CMakeFiles/CMakeOutput.log".

jgiven100 commented 1 year ago

Hi @yy54787803

Please be sure to include details about your OS, steps to reproduce the error, etc. in issues.

This error (from above) indicates that KaHIP is not correctly installed/compiled

-- Performing Test KAHIP_TEST_RUNS
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
PARHIP_LIBRARY

Easiest option would be to compile without KaHIP via

cmake -DNO_KAHIP=True -DCMAKE_CXX_COMPILER=g++ ..

as described in the docs.

yy54787803 commented 1 year ago

thanks for replying @jgiven100

I try to follow the 'CB-Geo MPM Documentation' to compile the 'KaHIP':

'cd ~/workspace/ && git clone https://github.com/schulzchristian/KaHIP && \cd KaHIP && sh ./compile_withcmake.sh'

after finish, I go to the mpm folder, and complie 'mkdir build && cd build && cmake -DCMAKE_CXX_COMPILER=g++ ..'

and the terminal get the error that:

-- The CXX compiler identification is GNU 11.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/g++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: filesystem system -- Found Eigen3: /usr/include/eigen3 (Required is at least version "2.91.0") -- Found MPI_CXX: /usr/lib/x86_64-linux-gnu/openmpi/lib/libmpi_cxx.so (found version "3.1") -- Found MPI: TRUE (found version "3.1")
-- The C compiler identification is GNU 9.5.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- HDF5: Using hdf5 compiler wrapper to determine CXX configuration -- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.10.7") found components: CXX HL -- Found OpenMP_C: -fopenmp (found version "4.5") -- Found OpenMP_CXX: -fopenmp (found version "4.5") -- Found OpenMP: TRUE (found version "4.5")
-- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE
-- Could NOT find MKL (missing: MKL_INCLUDE_DIR) -- Checking for package 'KaHIP' CMake Error at cmake/FindPackageHandleStandardArgs.cmake:137 (message): KaHIP could not be found/configured. (missing: KAHIP_LIBRARIES KAHIP_INCLUDE_DIRS KAHIP_TEST_RUNS) Call Stack (most recent call first): cmake/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE) cmake/FindKaHIP.cmake:140 (find_package_handle_standard_args) CMakeLists.txt:106 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/yue/mpm/build/CMakeFiles/CMakeOutput.log".

then I tried the CMake build method in KaHIP folder: 'cd build', 'sudo cmake ..', 'sudo make', 'sudo make install', and I get the iusse errors.

Could you tell me the problem solution

jgiven100 commented 1 year ago

Hi @yy54787803,

I see slightly different instruction to compile KaHIP in the CB-Geo docs, but I'm not sure it matters here.

image

git clone https://github.com/kahip/kahip && cd kahip
sh ./compile_withcmake.sh

If everything is compiled correctly and the

CMake Error at cmake/FindPackageHandleStandardArgs.cmake:137 (message):
KaHIP could not be found/configured. (missing: KAHIP_LIBRARIES
KAHIP_INCLUDE_DIRS KAHIP_TEST_RUNS)

error persists. You are able to explicitly tell cmake where KaHIP is located. There is some more details in the cmake doc.

I was able to get a "fresh" install of CB-Geo MPM to compile on my machine (Ubuntu 20.04) with the following commands

~$ mkdir temp 
~$ cd temp
~/temp$ git clone https://github.com/kahip/kahip
~/temp$ cd kahip
~/temp/kahip$ sh ./compile_withcmake.sh
~/temp/kahip$ cd ..
~/temp$ git clone https://github.com/cb-geo/mpm.git
~/temp$ cd mpm/ 
~/temp/mpm$ mkdir build/ 
~/temp/mpm$ cd build/
~/temp/mpm/build$ cmake -DCMAKE_CXX_COMPILER=g++ -DKAHIP_ROOT=~/temp/kahip/ ..

The key here being -> -DKAHIP_ROOT=~/temp/kahip/ tells cmake where to find KaHIP.

yy54787803 commented 1 year ago

thanks @jgiven100, follow you said, I made it

jgiven100 commented 1 year ago

:tada: Great - happy this worked. Closing the issue now.