barbagroup / AmgXWrapper

AmgXWrapper: An interface between PETSc and the NVIDIA AmgX library
MIT License
43 stars 23 forks source link

unable to build the AmgxWrapper #39

Open Dcn303 opened 1 year ago

Dcn303 commented 1 year ago

-- Begin AmgXWrapper configuration
-- Checking for one of the modules 'petsc'
CMake Error at /home/urban/DL-workspace/cmake-3.25.0/share/cmake-3.25/Modules/FindPkgConfig.cmake:894 (message):
  None of the required 'petsc' found
Call Stack (most recent call first):
  CMakeLists.txt:68 (pkg_search_module)

-- Found PETSc version  at
-- Found amgx_c.h at /home/urban/DL-workspace/AMGX-main/include
-- Found amgx_config.h: /home/urban/DL-workspace/AMGX-main/include/amgx_config.h
CMake Error at CMakeLists.txt:80 (find_library):
  Could not find AMGX_LIBRARIES using the following names: amgxsh

-- Configuring incomplete, errors occurred!
See also "/home/urban/DL-workspace/AmgXWrapper-master/build/CMakeFiles/CMakeOutput.log".
See also "/home/urban/DL-workspace/AmgXWrapper-master/build/CMakeFiles/CMakeError.log".

hello everyone i am getting error as shown above i have cuda 11.2 installed cmake version 3.25.0 gcc 9.3.0 openmpi 4.1.1 run the whole amgx by writing in the script file as shown below

#! /bin/bash

##path to the cuda library
export LD_LIBRARY_PATH=/opt/ohpc/pub/cuda/cuda-11.2/lib64:$LD_LIBRARY_PATH
export PATH=/opt/ohpc/pub/cuda/cuda-11.2/bin:$PATH
module load openmpi

export LD_LIBRARY_PATH=/opt/ohpc/pub/compiler/gcc/9.3.0/lib64:$LD_LIBRARY_PATH
export PATH=/opt/ohpc/pub/compiler/gcc/9.3.0/bin:$PATH

export PREFIX_AmgXWrapper="/home/urban/DL-workspace/AmgXWrapper-master"
export PATH_TO_PETSC_DIR="/home/urban/OpenFOAM/ThirdParty-v1912/platforms/linux64GccDPInt32/petsc-3.12.5"
export BUILD_OF_PETSC="arch-linux-c-debug"

export PATH_TO_CUDA="/opt/ohpc/pub/cuda/cuda-11.2"
export PATH_TO_AMGX="/home/urban/DL-workspace/AMGX-main"
export PATH_TO_AMGX_WRAPPER_SOURCE="/home/urban/DL-workspace/AmgXWrapper-master"

cmake \
-D CMAKE_INSTALL_PREFIX=${PREFIX_AmgXWrapper}   \
-D PETSC_DIR=${PATH_TO_PETSC_DIR}  \
-D PETSC_ARCH=${BUILD_OF_PETSC}  \
-D CUDA_DIR=${PATH_TO_CUDA}  \
-D AMGX_DIR=${PATH_TO_AMGX}  \
${PATH_TO_AMGX_WRAPPER_SOURCE} \
  ../

can someone kindly guide me through this error it will be greatly helpful thanks

Dcn303 commented 1 year ago

image i have set up and run the above script got the result as shown below image i give the command make -j 8 then i got the below result image i have loaded the openmpi 4.1.1 already before running anything but i still get this error can someone guide me thanks i used cuda 11.2, gcc 9.3.0 openmpi 4.1.1

piyueh commented 1 year ago

Based on the error message, NVIDIA's AmgX library needs OpenMP. AmgXWrapper does not need OpenMP, however, so the wrapper's linker flags do not contain OpenMP.

Which commit did you use for AmgX? I will try to reproduce it. AmgX on my machine is kind of old. So maybe something has been changed in AmgX itself.

piyueh commented 1 year ago

And if you remember how you built and installed AmgX, please also post the steps here, so I can try to reproduce it.

piyueh commented 1 year ago

Also, if you would like to play around with it in the mean time, try to add -D CMAKE_SHARED_LINKER_FLAGS='-fopenmp' to your cmake command. Let me know if it works.

Dcn303 commented 1 year ago

Hi piyueh Thank you so much for your reply i have used openmpi 4.1.1 gcc 8.2.0 cuda 11.2

i have used the Amgx latest version 2.3.0 this one https://github.com/NVIDIA/AMGX unzip it we get the AMGX-main folder inside that we replace the thrust with this thrust https://github.com/NVIDIA/thrust/tree/6a3078c64cab0e2f276340fa5dcafa0d758ed890 and replace the cub inside the thrust/dependencies with this cub https://github.com/NVIDIA/cub/tree/cdaa9558a85e45d849016e5fe7b6e4ee79113f95 then in the CMakeLists.txt i have added the two line to enable the c++14 flag as shown in picture below image in red color

after all this set up i follow mkdir build cd build cmake ../ make -j16 all in this way i ran build the amgx 2.3.0 and it ran the example https://github.com/NVIDIA/AMGX#running-single-gpu-example-from-the-build-directory

then i was trying to build the AmgxWrapper this one https://github.com/barbagroup/AmgXWrapper/archive/refs/heads/master.zip i.e. amgxwrapper v1.6.2 , using petsc-3.16.6 the script file use is shown below image yes by adding-D CMAKE_SHARED_LINKER_FLAGS='-fopenmp' to the above script file i.e. to my cmake of the AmgxWrapper it did build Thanks a lot it meant a lot to me Now i am trying to run poisson example of amgxWrapper to cross verify

Dcn303 commented 1 year ago

Hi i am not able to run the poisson example i have written the script below i am not clear what is PATH_TO_KSP_SETTING_FILE can someone please tell me what value i set it to

#! /bin/bash
module load openmpi
export CASE_NAME="AmgxWrapper_test1"
export PATH_TO_KSP_SETTING_FILE="/home/urban/DL-workspace/AMGX-main/src/solvers"
export NUMBER_OF_CELL_IN_X_DIRECTION=3
export NUMBER_OF_CELL_IN_Y_DIRECTION=4
export NUMBER_OF_CELL_IN_Z_DIRECTION=5
export CUDA_VISIBLE_DEVICES=0
mpiexec -n 4 /home/urban/DL-workspace/AmgXWrapper-master/build/example/poisson/poisson \
        -caseName ${CASE_NAME} \
        -mode AmgX_GPU \
        -cfgFileName ${PATH_TO_KSP_SETTING_FILE} \
        -Nx ${NUMBER_OF_CELL_IN_X_DIRECTION} \
        -Ny ${NUMBER_OF_CELL_IN_Y_DIRECTION} \
        -Nz ${NUMBER_OF_CELL_IN_Z_DIRECTION}
piyueh commented 1 year ago

@Dcn303 When using -mode PETSc, ${PATH_TO_KSP_SETTING_FILE} refers to PETSc linear solver's configuration file. In the Poisson example, we provide two example configurations, and you can pick one to play around with it:

When using -mode AmgX_GPU, ${PATH_TO_KSP_SETTING_FILE} refers to AmgX linear solver's configuration file. We also provide two such example configurations:

These example configurations should already be installed on your machine when you build/install AmgXWrapper.

If you want to learn how to modify/write the configuration from scratch, please refer to NVIDIA AmgX's manual or/and PETSc's manual.

Dcn303 commented 1 year ago

@Dcn303 When using -mode PETSc, ${PATH_TO_KSP_SETTING_FILE} refers to PETSc linear solver's configuration file. In the Poisson example, we provide two example configurations, and you can pick one to play around with it:

When using -mode AmgX_GPU, ${PATH_TO_KSP_SETTING_FILE} refers to AmgX linear solver's configuration file. We also provide two such example configurations:

These example configurations should already be installed on your machine when you build/install AmgXWrapper.

If you want to learn how to modify/write the configuration from scratch, please refer to NVIDIA AmgX's manual or/and PETSc's manual.

Thanks a lot @piyueh for your valuable reply it meant a lot to me, ok i will look into it Thanks alot