tSparse
tSparse copied to clipboard
Fix the CMAKE error (mentioned in the README.md)
"error: undefined reference to '__cudaRegisterLinkedBinary_12_spmm_cpp1_ii_handle'"
This error can be fixed by using more recent syntax to write the CMakeLists.txt
.
-
CMakeLists.txt
in theroot
folder:
cmake_minimum_required (VERSION 3.22)
project (tSparse)
set(tSparse_VERSION_MAJOR 0)
set(tSparse_VERSION_MINOR 4)
enable_language(CUDA CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CUDA_STANDARD 17)
set(CMAKE_CUDA_ARCHITECTURES 80)
set(CUDA_SEPARABLE_COMPILATION ON)
set(CUDA_PROPAGATE_HOST_FLAGS ON)
find_package(OpenMP REQUIRED)
find_package(CUDAToolkit REQUIRED)
include_directories( ${CMAKE_SOURCE_DIR}/external )
add_subdirectory(src)
-
CMakeLists.txt
in thesrc
folder:
project (SpGEMM)
add_executable(spmm spmm.cu mm.cu)
# Set compiler options using generator expressions for different configurations
target_compile_options(spmm PRIVATE
$<$<COMPILE_LANGUAGE:CUDA>:
$<$<CONFIG:Debug>:-g -G -O0> # Flags for Debug build
$<$<CONFIG:Release>:-O3> # Flags for Release build
-Xcompiler=-fopenmp # OpenMP flags for CUDA compiler
--extended-lambda
--expt-relaxed-constexpr
-lineinfo
>
)
target_link_libraries(spmm PRIVATE OpenMP::OpenMP_CXX CUDA::cusparse)