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 4cf90f5
Show file tree
Hide file tree
Showing 2 changed files with 14 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")
9 changes: 8 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,7 @@ 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)
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 +116,9 @@ def package_info(self):
self.cpp_info.set_property("cmake_target_aliases", ["SuiteSparse::CHOLMOD_static"])
self.cpp_info.set_property("pkg_config_name", "CHOLMOD")

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 4cf90f5

Please sign in to comment.