add viennacl and blaze (#435)

* add viennacl

* update mkl

* add blaze
pull/438/head
Hoildkv 4 years ago committed by GitHub
parent 51a1598458
commit 5137242adb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 20
      packages/b/blaze/patches/3.8/fix-vm-build.patch
  2. 50
      packages/b/blaze/xmake.lua
  3. 3
      packages/b/boost/xmake.lua
  4. 5
      packages/m/mkl/fetch.lua
  5. 1
      packages/m/mkl/xmake.lua
  6. 27
      packages/v/viennacl/xmake.lua

@ -0,0 +1,20 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e5ab1f460..a23c6dbf5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -145,12 +145,13 @@ if (${BLAZE_CACHE_SIZE_AUTO})
endif (flag EQUAL 0)
endif (APPLE)
- if (flag)
+ string(REGEX MATCH "([0-9][0-9]+)" tmp ${tmp}) # Get a number containing at least 2 digits in the string tmp
+
+ if (flag OR NOT tmp)
message("Cache size not found automatically. Using default value as cache size.")
set(tmp ${BLAZE_CACHE_SIZE_DEFAULT})
endif (flag)
- string(REGEX MATCH "([0-9][0-9]+)" tmp ${tmp}) # Get a number containing at least 2 digits in the string tmp
math(EXPR BLAZE_CACHE_SIZE ${tmp}*1024) # Convert to bytes (assuming that the value is given in kibibytes)
endif (${BLAZE_CACHE_SIZE_AUTO})

@ -0,0 +1,50 @@
package("blaze")
set_homepage("https://bitbucket.org/blaze-lib/blaze/")
set_description("A high performance C++ math library.")
set_license("BSD-3-Clause")
add_urls("https://bitbucket.org/blaze-lib/blaze/downloads/blaze-$(version).tar.gz")
add_versions("3.8", "dfaae1a3a9fea0b3cc92e78c9858dcc6c93301d59f67de5d388a3a41c8a629ae")
add_patches("3.8", path.join(os.scriptdir(), "patches", "3.8", "fix-vm-build.patch"), "d6e98c62279ab4b6a93b297e63312b974551e3fcfcd51f613bfebd05e7421cf1")
add_configs("blas", {description = "Choose BLAS library to use.", default = "mkl", type = "string", values = {"none", "mkl", "openblas"}})
add_deps("cmake")
on_load("windows|x64", "linux", "macosx", function (package)
if package:config("blas") == "mkl" then
package:add("deps", "mkl")
elseif package:config("blas") == "openblas" then
package:add("deps", "openblas")
end
end)
on_install("windows|x64", "linux", "macosx", function (package)
io.replace("CMakeLists.txt", "BLAS REQUIRED", "BLAS", {plain = true})
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("blas") == "none" then
table.insert(configs, "-DUSE_LAPACK=OFF")
table.insert(configs, "-DBLAZE_BLAS_MODE=OFF")
else
table.insert(configs, "-DUSE_LAPACK=OFF")
table.insert(configs, "-DBLAZE_BLAS_MODE=ON")
end
if package:config("blas") == "mkl" then
table.insert(configs, "-DBLAZE_BLAS_INCLUDE_FILE=<mkl_cblas.h>")
end
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
blaze::StaticVector<int,3UL> a{ 4, -2, 5 };
blaze::DynamicVector<int> b( 3UL );
b[2] = -3;
blaze::DynamicVector<int> c = a + b;
}
]]}, {configs = {languages = "c++14"}, includes = "blaze/Math.h"}))
end)

@ -42,7 +42,8 @@ package("boost")
"date_time",
"locale",
"iostreams",
"program_options"}
"program_options",
"test"}
add_configs("all", { description = "Enable all library modules support.", default = false, type = "boolean"})
add_configs("multi", { description = "Enable multi-thread support.", default = true, type = "boolean"})

@ -15,6 +15,11 @@ function _find_package(package, opt)
return
end
table.insert(result.linkdirs, linkinfo.linkdir)
if rdir == "intel64" then
table.insert(result.links, "mkl_lapack95_ilp64")
else
table.insert(result.links, "mkl_lapack95")
end
if rdir == "intel64" then
table.insert(result.links, "mkl_intel_ilp64")
elseif package:is_plat("windows") then

@ -37,6 +37,7 @@ package("mkl")
add_syslinks("pthread", "dl")
end
on_load("windows", "macosx", "linux", function (package)
package:add("links", package:is_arch("x64", "x86_64") and "mkl_lapack95_ilp64" or "mkl_lapack95")
if package:is_plat("windows") then
package:add("links", package:is_arch("x64", "x86_64") and "mkl_intel_ilp64" or "mkl_intel_c")
else

@ -0,0 +1,27 @@
package("viennacl")
set_homepage("http://viennacl.sourceforge.net/")
set_description("ViennaCL is a free open-source linear algebra library for computations on many-core architectures (GPUs, MIC) and multi-core CPUs.")
set_license("MIT")
add_urls("https://sourceforge.net/projects/viennacl/files/$(version).zip", {version = function (version)
return format("%s.%s.x/ViennaCL-%s", version:major(), version:minor(), version)
end})
add_versions("1.7.1", "1e9ffaa9d1dd22202cbd10ec8a8450184bceb41bbd90ebe2effd50be2015a7f6")
add_deps("cmake")
on_install("windows", "macosx", "linux", function (package)
io.replace("CMakeLists.txt", "add_subdirectory", "#", {plain = true})
import("package.tools.cmake").install(package)
end)
on_test(function (package)
assert(package:check_cxxsnippets({test = [[
void test() {
viennacl::vector<float> vec1(4);
viennacl::vector<float> vec2(4);
float res = viennacl::linalg::inner_prod(vec1, vec2);
}
]]}, {configs = {languages = "c++11"},
includes = {"viennacl/vector.hpp", "viennacl/linalg/inner_prod.hpp"}}))
end)
Loading…
Cancel
Save