add magma (#2066)
parent
c39a377cfd
commit
ce1f4257cd
2 changed files with 134 additions and 0 deletions
@ -0,0 +1,89 @@ |
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 828911d..244a732 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -635,37 +635,10 @@ add_custom_target( lib DEPENDS magma )
|
||||
# compile lapacktest library
|
||||
# If use fortran, compile only Fortran files, not magma_[sdcz]_no_fortran.cpp
|
||||
# else, compile only C++ files, not Fortran files
|
||||
-if (USE_FORTRAN)
|
||||
- foreach( filename ${liblapacktest_all} )
|
||||
- if (filename MATCHES "\\.(f|f90|F90)$")
|
||||
- list( APPEND liblapacktest_all_f ${filename} )
|
||||
- endif()
|
||||
- endforeach()
|
||||
- add_library( lapacktest ${liblapacktest_all_f} )
|
||||
-else()
|
||||
- # alternatively, use only C/C++/CUDA files, including magma_[sdcz]_no_fortran.cpp
|
||||
- foreach( filename ${liblapacktest_all} )
|
||||
- if (filename MATCHES "\\.(c|cu|cpp)$")
|
||||
- list( APPEND liblapacktest_all_cpp ${filename} )
|
||||
- endif()
|
||||
- endforeach()
|
||||
- add_library( lapacktest ${liblapacktest_all_cpp} )
|
||||
-endif()
|
||||
-target_link_libraries( lapacktest
|
||||
- ${blas_fix}
|
||||
- ${LAPACK_LIBRARIES}
|
||||
-)
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
# compile tester library
|
||||
-add_library( tester ${libtest_all} )
|
||||
-target_link_libraries( tester
|
||||
- magma
|
||||
- lapacktest
|
||||
- ${blas_fix}
|
||||
- ${LAPACK_LIBRARIES}
|
||||
-)
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
@@ -679,7 +652,6 @@ else()
|
||||
include_directories( sparse_hip/include )
|
||||
include_directories( sparse_hip/control )
|
||||
endif()
|
||||
-include_directories( testing )
|
||||
|
||||
if (MAGMA_ENABLE_CUDA)
|
||||
add_library( magma_sparse ${libsparse_all} )
|
||||
@@ -717,20 +689,6 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY testing_lib )
|
||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY testing_lib )
|
||||
|
||||
# skip Fortran testers, which require an extra file from CUDA
|
||||
-foreach( filename ${testing_all} )
|
||||
- if (filename MATCHES "\\.(c|cu|cpp)$")
|
||||
- list( APPEND testing_all_cpp ${filename} )
|
||||
- endif()
|
||||
-endforeach()
|
||||
-foreach( TEST ${testing_all_cpp} )
|
||||
- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
|
||||
- string( REGEX REPLACE "testing/" "" EXE ${EXE} )
|
||||
- #message( "${TEST} --> ${EXE}" )
|
||||
- add_executable( ${EXE} ${TEST} )
|
||||
- target_link_libraries( ${EXE} tester lapacktest magma )
|
||||
- list( APPEND testing ${EXE} )
|
||||
-endforeach()
|
||||
-add_custom_target( testing DEPENDS ${testing} )
|
||||
|
||||
|
||||
# ----------------------------------------
|
||||
@@ -743,17 +701,6 @@ else()
|
||||
endif()
|
||||
|
||||
|
||||
-set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${SPARSE_TEST_DIR}" )
|
||||
-cmake_policy( SET CMP0037 OLD)
|
||||
-foreach( TEST ${sparse_testing_all} )
|
||||
- string( REGEX REPLACE "\\.(cpp|f90|F90)" "" EXE ${TEST} )
|
||||
- string( REGEX REPLACE "${SPARSE_TEST_DIR}/" "" EXE ${EXE} )
|
||||
- #message( "${TEST} --> ${EXE}" )
|
||||
- add_executable( ${EXE} ${TEST} )
|
||||
- target_link_libraries( ${EXE} magma_sparse magma )
|
||||
- list( APPEND sparse-testing ${EXE} )
|
||||
-endforeach()
|
||||
-add_custom_target( sparse-testing DEPENDS ${sparse-testing} )
|
||||
|
||||
|
||||
# ----------------------------------------
|
@ -0,0 +1,45 @@ |
||||
package("magma") |
||||
|
||||
set_homepage("https://icl.utk.edu/magma/") |
||||
set_description("Matrix Algebra on GPU and Multicore Architectures") |
||||
set_license("BSD-3-Clause") |
||||
|
||||
add_urls("http://icl.utk.edu/projectsfiles/magma/downloads/magma-$(version).tar.gz") |
||||
add_versions("2.7.1", "d9c8711c047a38cae16efde74bee2eb3333217fd2711e1e9b8606cbbb4ae1a50") |
||||
|
||||
add_patches("2.7.1", path.join(os.scriptdir(), "patches", "2.7.1", "disable_test.patch"), "a4cc8f7a19d5cce80bf358d69eedfd8642edc0b8a931c792be239b5298519835") |
||||
|
||||
add_configs("fortran", {description = "Enable Fortran support.", default = false, type = "boolean"}) |
||||
add_configs("gpu_target", {description = "GPU architectures to compile for.", default = "sm_50 sm_70", type = "string"}) |
||||
add_configs("blas_vendor", {description = "BLAS vendor to use.", default = "OpenBLAS", type = "string", values = {"OpenBLAS", "Intel10_64lp", "Intel10_64lp_seq", "Intel10_64ilp", "Intel10_64ilp_seq", "Generic"}}) |
||||
|
||||
add_deps("cmake") |
||||
add_deps("cuda", {system = true, configs = {utils = {"cublas", "cusparse"}}}) |
||||
add_links("magma_sparse", "magma") |
||||
-- TODO: add AMD HIP support |
||||
on_load("windows", "linux", function (package) |
||||
local vendor = package:config("blas_vendor") |
||||
if vendor == "OpenBLAS" then |
||||
package:add("deps", "openblas") |
||||
elseif vendor:startswith("Intel") then |
||||
package:add("deps", "mkl") |
||||
end |
||||
end) |
||||
|
||||
on_install("windows", "linux", function (package) |
||||
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")) |
||||
table.insert(configs, "-DUSE_FORTRAN=" .. (package:config("fortran") and "ON" or "OFF")) |
||||
table.insert(configs, "-DGPU_TARGET=" .. package:config("gpu_target")) |
||||
table.insert(configs, "-DBLA_VENDOR=" .. package:config("blas_vendor")) |
||||
if package:is_plat("windows") then |
||||
import("package.tools.cmake").install(package, configs, {cxflags = "/Zc:__cplusplus"}) |
||||
else |
||||
import("package.tools.cmake").install(package, configs) |
||||
end |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("magma_init", {includes = "magma_v2.h"})) |
||||
end) |
Loading…
Reference in new issue