SCOREC / omega_h

Simplex mesh adaptivity for HPC
Other
1 stars 9 forks source link

Issue building on RHEL7 with cuda 12.1 and gcc 11.2.0 #49

Closed zhangchonglin closed 1 year ago

zhangchonglin commented 1 year ago

While building with cuda 12.1 and gcc 11.2.0 on a RHEL 7 computer, I encountered the following thrust error:

[  1%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_adapt.cpp.o
[  1%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_align.cpp.o
[  2%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_adj.cpp.o
[  2%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_amr.cpp.o
[  2%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_amr_topology.cpp.o
[  3%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_amr_transfer.cpp.o
[  3%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_any.cpp.o
[  4%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_approach.cpp.o
[  4%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_array.cpp.o
[  5%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_assoc.cpp.o
[  5%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_array_ops.cpp.o
[  6%] Building CXX object src/CMakeFiles/omega_h.dir/Omega_h_base64.cpp.o
/lore/zhangc20/pumi-pic/omega_h/src/Omega_h_reduce.hpp(84): error: namespace "thrust" has no member "device"
    return thrust::transform_reduce(thrust::device, first, last,
                                            ^

1 error detected in the compilation of "/lore/zhangc20/pumi-pic/omega_h/src/Omega_h_array_ops.cpp".
make[2]: *** [src/CMakeFiles/omega_h.dir/Omega_h_array_ops.cpp.o] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/CMakeFiles/omega_h.dir/all] Error 2
make: *** [all] Error 2

The build script:

module unuse /opt/scorec/spack/lmod/linux-rhel7-x86_64/Core                     
module use /opt/scorec/spack/v0181_1/lmod/linux-rhel7-x86_64/Core               
module load gcc/11.2.0                                                          
module load mpich/4.0.2                                                         
module load cmake                                                               

cuda=/usr/local/cuda-12.1                                                       
export PATH=$cuda/bin:$PATH                                                     
export LD_LIBRARY_PATH=$cuda/lib64:$LD_LIBRARY_PATH                             
export installroot=$PWD                                                         
export srcroot=$installroot/../                                                 

# kokkos                                                                        
export kk=$installroot/kokkos/install                                           
export kksrc=$srcroot/kokkos                                                    

# omega_h                                                                       
export oh=$installroot/omega_h/install                                          
export ohsrc=$srcroot/omega_h                                                   

cd $installroot                                                                 
mkdir -p omega_h/build                                                          
cd omega_h/build                                                                
cmake $ohsrc -DCMAKE_BUILD_TYPE=Release \                                       
             -DCMAKE_INSTALL_PREFIX=$oh \                                       
             -DBUILD_SHARED_LIBS=OFF \                                          
             -DOmega_h_USE_Kokkos=ON \                                          
             -DOmega_h_USE_CUDA=on \                                            
             -DOmega_h_CUDA_ARCH=86 \                                           
             -DOmega_h_USE_MPI=on \                                             
             -DOmega_h_USE_OpenMP=OFF \                                         
             -DBUILD_TESTING=ON \                                               
             -DCMAKE_CXX_COMPILER=mpicxx \                                      
             -DCMAKE_C_COMPILER=mpicc \                                         
             -DKokkos_PREFIX=$kk/lib64/cmake                                    
make -j4 install                                                                
ctest
zhangchonglin commented 1 year ago

Looks like there is an easy fix as suggested in the following two github issues:

Basically including the following header file:

#include <thrust/execution_policy.h>
zhangchonglin commented 1 year ago

Fixed by #50.