Skip to content

Commit

Permalink
suitesparse-cholmod: proper CUDA support
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed May 6, 2024
1 parent dc0850c commit b598d0c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Reproduces the CUDA dependencies added by https://github.com/DrTimothyAldenDavis/SuiteSparse/blob/v7.7.0/CHOLMOD/GPU/CMakeLists.txt

find_dependency(CUDAToolkit REQUIRED)

target_link_libraries(SuiteSparse::CHOLMOD INTERFACE CUDA::nvrtc CUDA::cudart_static CUDA::cublas)
target_compile_definitions(SuiteSparse::CHOLMOD INTERFACE "CHOLMOD_HAS_CUDA")
11 changes: 10 additions & 1 deletion recipes/suitesparse-cholmod/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ class SuiteSparseCholmodConan(ConanFile):
"cuda": False,
}
options_description = {
"gpl": "Enable GPL-licensed modules",
"gpl": "Enable GPL-licensed modules: MatrixOps, Modify, Supernodal and CUDA",
"cuda": "Enable CUDA acceleration",
}

def export_sources(self):
copy(self, "cholmod-conan-cuda-support.cmake", self.recipe_folder, self.export_sources_folder)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand Down Expand Up @@ -104,6 +107,8 @@ def package(self):
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
rmdir(self, os.path.join(self.package_folder, "share"))
rm(self, "*.pdb", self.package_folder, recursive=True)
if self.options.cuda:
copy(self, "cholmod-conan-cuda-support.cmake", self.export_sources_folder, os.path.join(self.package_folder, "lib", "cmake"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "CHOLMOD")
Expand All @@ -112,6 +117,10 @@ def package_info(self):
self.cpp_info.set_property("cmake_target_aliases", ["SuiteSparse::CHOLMOD_static"])
self.cpp_info.set_property("pkg_config_name", "CHOLMOD")

if self.options.cuda:
self.cpp_info.builddirs.append(os.path.join("lib", "cmake"))
self.cpp_info.set_property("cmake_build_modules", [os.path.join("lib", "cmake", "cholmod-conan-cuda-support.cmake")])

self.cpp_info.libs = ["cholmod"]
self.cpp_info.includedirs.append(os.path.join("include", "suitesparse"))

Expand Down

0 comments on commit b598d0c

Please sign in to comment.