add libargon2 and suitesparse (#654)
* update openblas * improve bullet3 * update libsndfile * support libiconv on msys2 * add libargon2 * add suitesparse * improve formatpull/655/head
parent
c55474e23c
commit
a4b95529d9
8 changed files with 343 additions and 19 deletions
@ -0,0 +1,40 @@ |
||||
package("libargon2") |
||||
|
||||
set_homepage("https://github.com/P-H-C/phc-winner-argon2") |
||||
set_description("The password hash Argon2, winner of PHC") |
||||
|
||||
add_urls("https://github.com/P-H-C/phc-winner-argon2/archive/refs/tags/$(version).zip", |
||||
"https://github.com/P-H-C/phc-winner-argon2.git") |
||||
add_versions("20190702", "506a80b90ac3ca8407636f3b26b7fed87a55f2f1275cde850cd6698903c4f008") |
||||
|
||||
if is_plat("linux") then |
||||
add_syslinks("pthread") |
||||
end |
||||
on_install("windows", "macosx", "linux", "mingw", function (package) |
||||
if not package:config("shared") then |
||||
io.replace("include/argon2.h", "__declspec(dllexport)", "", {plain = true}) |
||||
end |
||||
io.writefile("xmake.lua", [[ |
||||
add_rules("mode.debug", "mode.release") |
||||
target("argon2") |
||||
set_kind("$(kind)") |
||||
add_files("src/core.c", "src/argon2.c", "src/thread.c", "src/encoding.c", "src/blake2/blake2b.c", "src/opt.c") |
||||
add_includedirs("include", "src") |
||||
add_headerfiles("include/argon2.h") |
||||
if not is_plat("windows") then |
||||
add_defines("A2_VISCTL") |
||||
add_cflags("-march=native") |
||||
end |
||||
if is_plat("linux") then |
||||
add_syslinks("pthread") |
||||
end |
||||
]]) |
||||
import("package.tools.xmake").install(package) |
||||
if package:config("shared") then |
||||
io.replace(path.join(package:installdir("include"), "argon2.h"), "__declspec(dllexport)", "__declspec(dllimport)", {plain = true}) |
||||
end |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("argon2_error_message", {includes = "argon2.h"})) |
||||
end) |
@ -0,0 +1,52 @@ |
||||
diff --git a/GPUQREngine/Include/GPUQREngine_BucketList.hpp b/GPUQREngine/Include/GPUQREngine_BucketList.hpp
|
||||
index f37e3ecf..6f141a99 100644
|
||||
--- a/GPUQREngine/Include/GPUQREngine_BucketList.hpp
|
||||
+++ b/GPUQREngine/Include/GPUQREngine_BucketList.hpp
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
int VThead; // Index of the first available entry in VTlist
|
||||
|
||||
// Constructors
|
||||
- void *operator new(long unsigned int, BucketList* p)
|
||||
+ void *operator new(size_t, BucketList* p)
|
||||
{
|
||||
return p;
|
||||
}
|
||||
diff --git a/GPUQREngine/Include/GPUQREngine_Front.hpp b/GPUQREngine/Include/GPUQREngine_Front.hpp
|
||||
index 02d4208b..8517b2c2 100644
|
||||
--- a/GPUQREngine/Include/GPUQREngine_Front.hpp
|
||||
+++ b/GPUQREngine/Include/GPUQREngine_Front.hpp
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
/* Debug Fields */
|
||||
bool printMe;
|
||||
|
||||
- void* operator new(long unsigned int reqMem, Front* ptr){ return ptr; }
|
||||
+ void* operator new(size_t reqMem, Front* ptr){ return ptr; }
|
||||
|
||||
Front(
|
||||
Int fids_arg, // the front identifier
|
||||
diff --git a/GPUQREngine/Include/GPUQREngine_LLBundle.hpp b/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
|
||||
index 93bd3212..fc347143 100644
|
||||
--- a/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
|
||||
+++ b/GPUQREngine/Include/GPUQREngine_LLBundle.hpp
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
|
||||
TaskType CurrentTask;
|
||||
|
||||
- void *operator new(long unsigned int, LLBundle* p){ return p; }
|
||||
+ void *operator new(size_t, LLBundle* p){ return p; }
|
||||
LLBundle(BucketList *buckets, Int panelSize, Int nativeBucket);
|
||||
|
||||
// empty LLBundle constructor (currently used, kept for possible future use
|
||||
diff --git a/GPUQREngine/Include/GPUQREngine_Scheduler.hpp b/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
|
||||
index aa3781d5..069b01a5 100644
|
||||
--- a/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
|
||||
+++ b/GPUQREngine/Include/GPUQREngine_Scheduler.hpp
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
cudaStream_t memoryStreamD2H;
|
||||
|
||||
/* Scheduler.cpp */
|
||||
- void *operator new(long unsigned int, Scheduler* p){ return p; }
|
||||
+ void *operator new(size_t, Scheduler* p){ return p; }
|
||||
Scheduler(Front *fronts, Int numFronts, size_t gpuMemorySize);
|
||||
~Scheduler();
|
||||
|
@ -0,0 +1,189 @@ |
||||
set_project("SuiteSparse") |
||||
set_xmakever("2.5.6") |
||||
set_languages("cxx14") |
||||
|
||||
add_rules("mode.debug", "mode.release") |
||||
|
||||
-- initialize options |
||||
option("with_cuda", {default = false, showmenu = true, description = "Build with CUDA support."}) |
||||
option("with_blas", {default = "mkl", showmenu = true, description = "Choose BLAS vendor.", values={"mkl", "openblas"}}) |
||||
option("complex", {default = false, showmenu = true, description = "Build with complex number support."}) |
||||
option("graphblas", {default = false, showmenu = true, description = "Build GraphBLAS module."}) |
||||
|
||||
-- set dependencies |
||||
add_requires("metis") |
||||
add_requires(get_config("with_blas")) |
||||
if has_config("with_cuda") then |
||||
add_requires("cuda", {system = true, configs = {utils = {"cublas"}}}) |
||||
add_defines("GPU_BLAS") |
||||
end |
||||
if not has_config("complex") then |
||||
add_defines("NCOMPLEX") |
||||
end |
||||
|
||||
-- export config files for cmake |
||||
add_rules("utils.install.cmake_importfiles") |
||||
|
||||
-- export symbols for windows |
||||
if is_plat("windows") and is_kind("shared") then |
||||
add_rules("utils.symbols.export_all") |
||||
end |
||||
|
||||
-- rule for compiling source files with multiple definitions |
||||
rule("c.def_gen") |
||||
set_extensions(".c") |
||||
on_buildcmd_file(function (target, batchcmds, sourcefile, opt) |
||||
local prod_defs = {"none"} |
||||
|
||||
-- get defines from sourcefile |
||||
local fileconfig = target:fileconfig(sourcefile) |
||||
if fileconfig then |
||||
prod_defs = fileconfig.prod_defs |
||||
end |
||||
|
||||
local objectfile |
||||
for _, res in ipairs(prod_defs) do |
||||
local rootdir = path.join(target:autogendir(), "rules", "def_gen") |
||||
local filename = table.concat(table.join({path.basename(sourcefile)}, res), "_") .. ".c" |
||||
local sourcefile_cx = target:autogenfile(sourcefile, {rootdir = rootdir, filename = filename}) |
||||
|
||||
-- add objectfile |
||||
objectfile = target:objectfile(sourcefile_cx) |
||||
table.insert(target:objectfiles(), objectfile) |
||||
|
||||
-- add commands |
||||
if res ~= "none" then |
||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s with define %s", get_config("mode"), sourcefile, res) |
||||
batchcmds:compile(sourcefile, objectfile, {configs = {defines = res}}) |
||||
else |
||||
batchcmds:show_progress(opt.progress, "${color.build.object}compiling.%s %s with no defines", get_config("mode"), sourcefile) |
||||
batchcmds:compile(sourcefile, objectfile) |
||||
end |
||||
end |
||||
|
||||
-- add deps |
||||
batchcmds:add_depfiles(sourcefile) |
||||
batchcmds:set_depmtime(os.mtime(objectfile)) |
||||
batchcmds:set_depcache(target:dependfile(objectfile)) |
||||
end) |
||||
rule_end() |
||||
|
||||
add_rules("c.def_gen", {override = true}) |
||||
|
||||
target("SuiteSparse_config") |
||||
set_kind("$(kind)") |
||||
add_files("SuiteSparse_config/SuiteSparse_config.c") |
||||
add_headerfiles("SuiteSparse_config/SuiteSparse_config.h") |
||||
add_includedirs("SuiteSparse_config", {public = true}) |
||||
target_end() |
||||
|
||||
for _, libname in ipairs({"AMD", "BTF", "CAMD", "CCOLAMD", "COLAMD"}) do |
||||
target(libname) |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_files(libname .. "/Source/*.c", {prod_defs = {"none", "DLONG"}}) |
||||
add_includedirs(libname .. "/Include", {public = true}) |
||||
add_headerfiles(libname .. "/Include/*.h") |
||||
target_end() |
||||
end |
||||
|
||||
target("CHOLMOD") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_deps("AMD", "CAMD", "COLAMD", "CCOLAMD") |
||||
for _, module in ipairs({"Core", "Check", "Cholesky", "MatrixOps", "Partition", "Modify", "Supernodal"}) do |
||||
add_files("CHOLMOD/" .. module .. "/cholmod*.c", {prod_defs = {"none", "DLONG"}}) |
||||
end |
||||
add_includedirs("CHOLMOD/Include", {public = true}) |
||||
add_headerfiles("CHOLMOD/Include/*.h") |
||||
add_packages("metis") |
||||
add_packages(get_config("with_blas")) |
||||
if has_config("with_cuda") then |
||||
add_files("CHOLMOD/GPU/cholmod*.cu") |
||||
add_files("CHOLMOD/GPU/cholmod*.c", {prod_defs = {"none", "DLONG"}}) |
||||
add_packages("cuda", {public = true}) |
||||
end |
||||
target_end() |
||||
|
||||
target("CXSparse") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_files("CXSparse/Source/*.c|cs_convert.c", {prod_defs = {"none", "CS_LONG"}}) |
||||
add_includedirs("CXSparse/Include", {public = true}) |
||||
add_headerfiles("CXSparse/Include/*.h") |
||||
target_end() |
||||
|
||||
target("KLU") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_deps("AMD", "COLAMD", "BTF") |
||||
add_files("KLU/Source/*.c", {prod_defs = {"none", "DLONG"}}) |
||||
add_includedirs("KLU/Include", {public = true}) |
||||
add_headerfiles("KLU/Include/*.h") |
||||
target_end() |
||||
|
||||
target("LDL") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_files("LDL/Source/*.c", {prod_defs = {"none", "LDL_LONG"}}) |
||||
add_includedirs("LDL/Include", {public = true}) |
||||
add_headerfiles("LDL/Include/*.h") |
||||
target_end() |
||||
|
||||
target("UMFPACK") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_deps("AMD", "CHOLMOD") |
||||
add_files("UMFPACK/Source/umfpack_timer.c", "UMFPACK/Source/umfpack_tictoc.c") |
||||
local doubledefs = {"umf_analyze.c", "umf_apply_order.c", "umf_cholmod.c", "umf_colamd.c", "umf_free.c", "umf_fsize.c", "umf_is_permutation.c", "umf_malloc.c", "umf_realloc.c", "umf_report_perm.c", "umf_singletons.c"} |
||||
for _, file in ipairs(doubledefs) do |
||||
add_files("UMFPACK/Source/" .. file, {prod_defs = {"DINT", "DLONG"}}) |
||||
end |
||||
add_files("UMFPACK/Source/*.c|umfpack_timer.c|umfpack_tictoc.c|" .. table.concat(doubledefs, "|"), {prod_defs = {"DINT", "DLONG", "ZINT", "ZLONG"}}) |
||||
add_includedirs("UMFPACK/Include", {public = true}) |
||||
add_headerfiles("UMFPACK/Include/*.h") |
||||
add_packages(get_config("with_blas"), "metis") |
||||
target_end() |
||||
|
||||
target("SPQR") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_deps("CHOLMOD") |
||||
add_files("SPQR/Source/*.cpp") |
||||
add_includedirs("SPQR/Include", {public = true}) |
||||
add_headerfiles("SPQR/Include/*.h", "SPQR/Include/*.hpp") |
||||
add_packages(get_config("with_blas"), "metis") |
||||
if has_config("with_cuda") then |
||||
add_deps("GPUQREngine") |
||||
add_packages("cuda") |
||||
add_files("SPQR/SPQRGPU/*.cpp") |
||||
end |
||||
target_end() |
||||
|
||||
if has_config("graphblas") then |
||||
target("GraphBLAS") |
||||
set_kind("$(kind)") |
||||
add_files("GraphBLAS/Source/*.c", "GraphBLAS/Source/Generated/*.c") |
||||
add_includedirs("GraphBLAS/Include", "GraphBLAS/Source", "GraphBLAS/Source/Template", "GraphBLAS/Source/Generated") |
||||
add_headerfiles("GraphBLAS/Include/*.h") |
||||
target_end() |
||||
end |
||||
|
||||
if has_config("with_cuda") then |
||||
target("SuiteSparse_GPURuntime") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config") |
||||
add_packages("cuda") |
||||
add_files("SuiteSparse_GPURuntime/Source/*.cpp") |
||||
add_includedirs("SuiteSparse_GPURuntime/Include", {public = true}) |
||||
add_headerfiles("SuiteSparse_GPURuntime/Include/*.hpp") |
||||
target_end() |
||||
|
||||
target("GPUQREngine") |
||||
set_kind("$(kind)") |
||||
add_deps("SuiteSparse_config", "SuiteSparse_GPURuntime") |
||||
add_files("GPUQREngine/Source/**.cpp", "GPUQREngine/Source/*.cu") |
||||
add_includedirs("GPUQREngine/Include", {public = true}) |
||||
add_headerfiles("GPUQREngine/Include/(**.hpp)", "GPUQREngine/Include/(**.cu)") |
||||
target_end() |
||||
end |
@ -0,0 +1,46 @@ |
||||
package("suitesparse") |
||||
|
||||
set_homepage("https://people.engr.tamu.edu/davis/suitesparse.html") |
||||
set_description("SuiteSparse is a suite of sparse matrix algorithms") |
||||
|
||||
add_urls("https://github.com/DrTimothyAldenDavis/SuiteSparse/archive/refs/tags/$(version).tar.gz", |
||||
"https://github.com/DrTimothyAldenDavis/SuiteSparse.git") |
||||
add_versions("v5.10.1", "acb4d1045f48a237e70294b950153e48dce5b5f9ca8190e86c2b8c54ce00a7ee") |
||||
|
||||
add_patches("v5.10.1", path.join(os.scriptdir(), "patches", "5.10.1", "msvc.patch"), "8ac61e9acfaa864a2528a14d3a7e6e86f6e6877de2fe93fdc87876737af5bf31") |
||||
|
||||
add_configs("cuda", {description = "Enable CUDA support.", default = false, type = "boolean"}) |
||||
add_configs("blas", {description = "Set BLAS vendor.", default = "openblas", type = "string", values = {"mkl", "openblas"}}) |
||||
add_configs("graphblas", {description = "Enable GraphBLAS module.", default = false, type = "boolean"}) |
||||
|
||||
add_deps("metis") |
||||
if is_plat("linux") then |
||||
add_syslinks("m", "rt") |
||||
end |
||||
on_load("windows", "macosx", "linux", function (package) |
||||
if package:config("cuda") then |
||||
package:add("deps", "cuda", {system = true, configs = {utils = {"cublas"}}}) |
||||
package:add("links", "GPUQREngine") |
||||
package:add("links", "SuiteSparse_GPURuntime") |
||||
end |
||||
if package:config("graphblas") then |
||||
package:add("links", "GraphBLAS") |
||||
end |
||||
package:add("deps", package:config("blas")) |
||||
for _, lib in ipairs({"SPQR", "UMFPACK", "LDL", "KLU", "CXSparse", "CHOLMOD", "COLAMD", "CCOLAMD", "CAMD", "BTF", "AMD", "SuiteSparse_config"}) do |
||||
package:add("links", lib) |
||||
end |
||||
end) |
||||
|
||||
on_install("windows", "macosx", "linux", function (package) |
||||
os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua") |
||||
local configs = {} |
||||
configs.with_blas = package:config("blas") |
||||
configs.with_cuda = package:config("cuda") |
||||
configs.graphblas = package:config("graphblas") |
||||
import("package.tools.xmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("SuiteSparse_start", {includes = "SuiteSparse_config.h"})) |
||||
end) |
Loading…
Reference in new issue