* add kokkos

* add kokkos-kernels

* check clang full log

* fix test

* fix on windows

* improve kokkos config

* fix kokkos config
pull/2141/head
Hoildkv 2 years ago committed by GitHub
parent cb514d2b8d
commit 728bdcd774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .github/workflows/ubuntu_clang.yml
  2. 56
      packages/k/kokkos-kernels/xmake.lua
  3. 45
      packages/k/kokkos/xmake.lua

@ -32,4 +32,4 @@ jobs:
- name: Tests
run: |
xmake l ./scripts/test.lua -D --toolchain=clang -k ${{ matrix.kind }}
xmake l ./scripts/test.lua -vD --toolchain=clang -k ${{ matrix.kind }}

@ -0,0 +1,56 @@
package("kokkos-kernels")
set_homepage("https://github.com/kokkos/kokkos-kernels")
set_description("Kokkos C++ Performance Portability Programming EcoSystem: Math Kernels")
set_license("Apache-2.0")
add_urls("https://github.com/kokkos/kokkos-kernels/archive/refs/tags/$(version).tar.gz",
"https://github.com/kokkos/kokkos-kernels.git")
add_versions("4.0.01", "3f493fcb0244b26858ceb911be64092fbf7785616ad62c81abde0ea1ce86688a")
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
add_deps("cmake")
on_load("windows|x64", "macosx", "linux", function (package)
if package:config("cuda") then
package:add("deps", "cuda")
package:add("deps", "kokkos", {configs = {cuda = true}})
else
package:add("deps", "kokkos")
end
end)
on_install("windows|x64", "macosx", "linux", function (package)
if package:is_plat("windows") then
local vs = import("core.tool.toolchain").load("msvc"):config("vs")
if tonumber(vs) < 2022 then
raise("Your compiler is too old to use this library.")
end
end
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
if package:config("cuda") then
table.insert(configs, "-DKokkosKernels_REQUIRE_DEVICES=CUDA")
end
import("package.tools.cmake").install(package, configs, {buildir = path.join(os.tmpdir(), "kk-build")})
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
#include <Kokkos_Core.hpp>
#include <KokkosSparse_MatrixPrec.hpp>
#include <KokkosSparse_IOUtils.hpp>
void test() {
using EXSP = Kokkos::DefaultExecutionSpace;
using MESP = typename EXSP::memory_space;
using CRS = KokkosSparse::CrsMatrix<double, int, Kokkos::Device<EXSP, MESP>, void, int>;
Kokkos::initialize();
CRS A = KokkosSparse::Impl::kk_generate_diag_matrix<CRS>(1000);
}
]]}, {configs = {languages = "c++17"}}))
end)

@ -0,0 +1,45 @@
package("kokkos")
set_homepage("https://kokkos.github.io/")
set_description("Kokkos C++ Performance Portability Programming EcoSystem: The Programming Model")
set_license("Apache-2.0")
add_urls("https://github.com/kokkos/kokkos/archive/refs/tags/$(version).tar.gz",
"https://github.com/kokkos/kokkos.git")
add_versions("4.0.01", "bb942de8afdd519fd6d5d3974706bfc22b6585a62dd565c12e53bdb82cd154f0")
if is_plat("windows") then
add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true})
end
add_configs("threads", {description = "Enable thread support.", default = true, type = "boolean"})
add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"})
add_configs("arch", {description = "Enable architecture-specific optimizations.", default = (is_plat("macosx", "linux") and "native" or nil), type = "string"})
add_deps("cmake")
add_links("kokkoscontainers", "kokkossimd", "kokkoscore")
on_load("windows|x64", "macosx", "linux", function (package)
if package:config("cuda") then
package:add("deps", "cuda")
end
end)
on_install("windows|x64", "macosx", "linux", function (package)
local configs = {"-DKokkos_ENABLE_SERIAL=ON"}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
table.insert(configs, "-DKokkos_ENABLE_THREADS=" .. (package:config("threads") and "ON" or "OFF"))
table.insert(configs, "-DKokkos_ENABLE_CUDA=" .. (package:config("cuda") and "ON" or "OFF"))
if package:config("arch") ~= nil then
table.insert(configs, "-DKokkos_ARCH_" .. package:config("arch"):upper() .. "=ON")
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test(int argc, char *argv[]) {
Kokkos::initialize(argc, argv);
Kokkos::finalize();
}
]]}, {configs = {languages = "c++17"}, includes = "Kokkos_Core.hpp"}))
end)
Loading…
Cancel
Save