xmake.lua 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package("ginkgo")
  2. set_homepage("https://ginkgo-project.github.io/")
  3. set_description("Ginkgo is a high-performance linear algebra library for manycore systems, with a focus on solution of sparse linear systems.")
  4. set_license("BSD-3-Clause")
  5. add_urls("https://github.com/ginkgo-project/ginkgo/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/ginkgo-project/ginkgo.git")
  7. add_versions("v1.9.0", "18271e99f81a89cf27102f9d4e84653ae7a0cc745fcda9a7ed486c455553780b")
  8. add_versions("v1.8.0", "421efaed1be2ef11d230b79fc68bcf7e264a2c57ae52aff6dec7bd90f8d4ae30")
  9. add_versions("v1.7.0", "f4b362bcb046bc53fbe2e578662b939222d0c44b96449101829e73ecce02bcb3")
  10. add_configs("openmp", {description = "Compile OpenMP kernels for CPU.", default = false, type = "boolean"})
  11. add_configs("cuda", {description = "Compile kernels for NVIDIA GPUs.", default = false, type = "boolean"})
  12. add_configs("hip", {description = "Compile kernels for AMD or NVIDIA GPUs.", default = false, type = "boolean"})
  13. add_configs("sycl", {description = "Compile SYCL kernels for Intel GPUs or other SYCL enabled hardware.", default = false, type = "boolean"})
  14. add_configs("jacobi_full", {description = "Use all the optimizations for the CUDA Jacobi algorithm.", default = false, type = "boolean"})
  15. set_policy("package.cmake_generator.ninja", false)
  16. add_deps("cmake")
  17. on_load("windows", "macosx", "linux", function (package)
  18. if package:config("openmp") then
  19. package:add("deps", "openmp")
  20. end
  21. if package:config("cuda") then
  22. package:add("deps", "cuda", {configs = {utils = {"cublas", "cusparse"}}})
  23. end
  24. if not (package:is_plat("windows") and package:config("shared")) then
  25. package:add("deps", "ninja")
  26. end
  27. -- TODO: add hip and sycl
  28. end)
  29. on_install("windows", "macosx", "linux", function (package)
  30. local configs = {"-DGINKGO_BUILD_TESTS=OFF", "-DGINKGO_BUILD_EXAMPLES=OFF", "-DGINKGO_BUILD_BENCHMARKS=OFF", "-DGINKGO_BUILD_REFERENCE=ON", "-DGINKGO_BUILD_MPI=OFF"}
  31. table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
  32. table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
  33. table.insert(configs, "-DGINKGO_BUILD_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
  34. table.insert(configs, "-DGINKGO_BUILD_HIP=" .. (package:config("hip") and "ON" or "OFF"))
  35. table.insert(configs, "-DGINKGO_BUILD_SYCL=" .. (package:config("sycl") and "ON" or "OFF"))
  36. table.insert(configs, "-DGINKGO_BUILD_OMP=" .. (package:config("openmp") and "ON" or "OFF"))
  37. table.insert(configs, "-DGINKGO_JACOBI_FULL_OPTIMIZATIONS=" .. (package:config("jacobi_full") and "ON" or "OFF"))
  38. local opt = {}
  39. if not (package:is_plat("windows") and package:config("shared")) then
  40. opt.cmake_generator = "Ninja"
  41. end
  42. import("package.tools.cmake").install(package, configs, opt)
  43. end)
  44. on_test(function (package)
  45. assert(package:check_cxxsnippets({test = [[
  46. #include <ginkgo/ginkgo.hpp>
  47. void test() {
  48. const auto exec = gko::ReferenceExecutor::create();
  49. }
  50. ]]}, {configs = {languages = "c++17"}}))
  51. end)