From 83c0ba13d35055ff73620ec7163c6e862a06f805 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Tue, 6 Aug 2019 07:33:47 -0500 Subject: gn: Fix building arrayfire. --- arrayfire-lapack-detection.patch | 277 ++++++++++++++++++++++++++++ arrayfire-newer-boost-compute.patch | 33 ++++ gn/packages/arrayfire.scm | 350 +++++++++++++++++------------------- 3 files changed, 476 insertions(+), 184 deletions(-) create mode 100644 arrayfire-lapack-detection.patch create mode 100644 arrayfire-newer-boost-compute.patch diff --git a/arrayfire-lapack-detection.patch b/arrayfire-lapack-detection.patch new file mode 100644 index 0000000..1925122 --- /dev/null +++ b/arrayfire-lapack-detection.patch @@ -0,0 +1,277 @@ +https://sources.debian.org/data/main/a/arrayfire/3.3.2+dfsg1-4/debian/patches/Fix-LAPACKE-detection.patch + +From: Ghislain Antony Vaillant +Date: Wed, 2 Mar 2016 10:46:50 +0000 +Subject: Fix LAPACKE detection. + +--- + CMakeModules/FindLAPACKE.cmake | 54 +++++++++++++++------------------------ + src/backend/cpu/CMakeLists.txt | 18 ++++++------- + src/backend/cuda/CMakeLists.txt | 11 ++++---- + src/backend/opencl/CMakeLists.txt | 19 +++++++------- + 4 files changed, 45 insertions(+), 57 deletions(-) + +diff --git a/CMakeModules/FindLAPACKE.cmake b/CMakeModules/FindLAPACKE.cmake +index 9251ee9..1a73632 100644 +--- a/CMakeModules/FindLAPACKE.cmake ++++ b/CMakeModules/FindLAPACKE.cmake +@@ -4,13 +4,13 @@ + # FIND_PACKAGE(LAPACKE [REQUIRED] [QUIET] ) + # + # It sets the following variables: +-# LAPACK_FOUND ... true if LAPACKE is found on the system +-# LAPACK_LIBRARIES ... full path to LAPACKE library +-# LAPACK_INCLUDES ... LAPACKE include directory +-# ++# LAPACKE_FOUND ... true if LAPACKE is found on the system ++# LAPACKE_INCLUDE_DIRS ... LAPACKE include directories ++# LAPACKE_LIBRARIES ... path to LAPACKE libraries ++# LAPACKE_LIBRARY_DIRS ... LAPACKE library directories + + SET(LAPACKE_ROOT_DIR CACHE STRING +- "Root directory for custom LAPACK implementation") ++ "Root directory for custom LAPACKE implementation") + + IF (NOT INTEL_MKL_ROOT_DIR) + SET(INTEL_MKL_ROOT_DIR $ENV{INTEL_MKL_ROOT}) +@@ -40,29 +40,20 @@ IF(PKG_CONFIG_FOUND AND NOT LAPACKE_ROOT_DIR) + ENDIF() + + IF(PC_LAPACKE_FOUND) ++ ++ # Verify sanity of LAPACKE pkg-config file. + FOREACH(PC_LIB ${PC_LAPACKE_LIBRARIES}) + FIND_LIBRARY(${PC_LIB}_LIBRARY NAMES ${PC_LIB} HINTS ${PC_LAPACKE_LIBRARY_DIRS} ) + IF (NOT ${PC_LIB}_LIBRARY) + MESSAGE(FATAL_ERROR "Something is wrong in your pkg-config file - lib ${PC_LIB} not found in ${PC_LAPACKE_LIBRARY_DIRS}") + ENDIF (NOT ${PC_LIB}_LIBRARY) +- LIST(APPEND LAPACKE_LIB ${${PC_LIB}_LIBRARY}) + ENDFOREACH(PC_LIB) + +- FIND_PATH( +- LAPACKE_INCLUDES +- NAMES "lapacke.h" +- PATHS +- ${PC_LAPACKE_INCLUDE_DIRS} +- ${INCLUDE_INSTALL_DIR} +- /usr/include +- /usr/local/include +- /sw/include +- /opt/local/include +- DOC "LAPACKE Include Directory" +- ) ++ set(LAPACKE_LIBRARIES ${PC_LAPACKE_LIBRARIES}) ++ set(LAPACKE_LIBRARY_DIRS ${PC_LAPACKE_LIBRARY_DIRS}) + +- FIND_PACKAGE_HANDLE_STANDARD_ARGS(LAPACKE DEFAULT_MSG LAPACKE_LIB) +- MARK_AS_ADVANCED(LAPACKE_INCLUDES LAPACKE_LIB) ++ FIND_PATH(LAPACKE_INCLUDE_DIRS NAMES "lapacke.h" ++ PATHS ${PC_LAPACKE_INCLUDE_DIRS}) + + ELSE(PC_LAPACKE_FOUND) + +@@ -97,7 +88,6 @@ ELSE(PC_LAPACKE_FOUND) + LAPACKE_LIB + NAMES "lapacke" "liblapacke" "openblas" "mkl_rt" + PATHS +- ${PC_LAPACKE_LIBRARY_DIRS} + ${LIB_INSTALL_DIR} + /opt/intel/mkl/lib/ia32 + /opt/intel/mkl/lib/intel64 +@@ -113,7 +103,6 @@ ELSE(PC_LAPACKE_FOUND) + LAPACK_LIB + NAMES "lapack" "liblapack" "openblas" "mkl_rt" + PATHS +- ${PC_LAPACKE_LIBRARY_DIRS} + ${LIB_INSTALL_DIR} + /opt/intel/mkl/lib/ia32 + /opt/intel/mkl/lib/intel64 +@@ -129,7 +118,6 @@ ELSE(PC_LAPACKE_FOUND) + LAPACKE_INCLUDES + NAMES "lapacke.h" "mkl_lapacke.h" + PATHS +- ${PC_LAPACKE_INCLUDE_DIRS} + ${INCLUDE_INSTALL_DIR} + /opt/intel/mkl/include + /usr/include +@@ -141,17 +129,15 @@ ELSE(PC_LAPACKE_FOUND) + lapacke + ) + ENDIF(LAPACKE_ROOT_DIR) ++ SET(LAPACKE_INCLUDE_DIRS ${LAPACKE_INCLUDES}) ++ SET(LAPACKE_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIB}) ++ MARK_AS_ADVANCED(LAPACKE_INCLUDES LAPACKE_LIB LAPACK_LIB) + ENDIF(PC_LAPACKE_FOUND) + +-IF(LAPACKE_LIB AND LAPACK_LIB) +- SET(LAPACK_LIBRARIES ${LAPACKE_LIB} ${LAPACK_LIB}) +-ENDIF() +-IF(LAPACKE_INCLUDES) +- SET(LAPACK_INCLUDE_DIR ${LAPACKE_INCLUDES}) +-ENDIF() +- + INCLUDE(FindPackageHandleStandardArgs) +-FIND_PACKAGE_HANDLE_STANDARD_ARGS(LAPACK DEFAULT_MSG +- LAPACK_INCLUDE_DIR LAPACK_LIBRARIES) +- +-MARK_AS_ADVANCED(LAPACK_INCLUDES LAPACK_LIBRARIES) ++FIND_PACKAGE_HANDLE_STANDARD_ARGS(LAPACKE DEFAULT_MSG ++ LAPACKE_LIBRARIES ++ LAPACKE_INCLUDE_DIRS) ++MARK_AS_ADVANCED(LAPACKE_LIBRARIES ++ LAPACKE_INCLUDE_DIRS ++ LAPACKE_LIBRARY_DIRS) +diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt +index ea57269..efe50a0 100644 +--- a/src/backend/cpu/CMakeLists.txt ++++ b/src/backend/cpu/CMakeLists.txt +@@ -55,7 +55,7 @@ MESSAGE(STATUS "FFTW Library: ${FFTW_LIBRARIES}") + + IF(APPLE) + FIND_PACKAGE(LAPACKE QUIET) # For finding MKL +- IF(NOT LAPACK_FOUND) ++ IF(NOT LAPACKE_FOUND) + # UNSET THE VARIABLES FROM LAPACKE + UNSET(LAPACKE_LIB CACHE) + UNSET(LAPACK_LIB CACHE) +@@ -67,11 +67,10 @@ ELSE(APPLE) # Linux and Windows + FIND_PACKAGE(LAPACKE) + ENDIF(APPLE) + +-IF(NOT LAPACK_FOUND) +- MESSAGE(WARNING "LAPACK not found. Functionality will be disabled") +-ELSE(NOT LAPACK_FOUND) ++IF(NOT LAPACKE_FOUND) ++ MESSAGE(WARNING "LAPACKE not found. Functionality will be disabled") ++ELSE(NOT LAPACKE_FOUND) + ADD_DEFINITIONS(-DWITH_CPU_LINEAR_ALGEBRA) +- MESSAGE(STATUS "LAPACK libraries found: ${LAPACK_LIBRARIES}") + ENDIF() + + IF(NOT UNIX) +@@ -99,8 +98,9 @@ INCLUDE_DIRECTORIES( + ${CBLAS_INCLUDE_DIR} + ) + +-IF(LAPACK_FOUND) +- INCLUDE_DIRECTORIES(${LAPACK_INCLUDE_DIR}) ++IF(LAPACKE_FOUND) ++ INCLUDE_DIRECTORIES(${LAPACKE_INCLUDE_DIRS}) ++ LINK_DIRECTORIES(${LAPACKE_LIBRARY_DIRS}) + ENDIF() + + FILE(GLOB cpu_headers +@@ -213,8 +213,8 @@ IF(FORGE_FOUND AND NOT USE_SYSTEM_FORGE) + ADD_DEPENDENCIES(afcpu forge) + ENDIF() + +-IF(LAPACK_FOUND) +- TARGET_LINK_LIBRARIES(afcpu PRIVATE ${LAPACK_LIBRARIES}) ++IF(LAPACKE_FOUND) ++ TARGET_LINK_LIBRARIES(afcpu PRIVATE ${LAPACKE_LIBRARIES}) + ENDIF() + + IF(FORGE_FOUND) +diff --git a/src/backend/cuda/CMakeLists.txt b/src/backend/cuda/CMakeLists.txt +index 4efb427..24c6544 100644 +--- a/src/backend/cuda/CMakeLists.txt ++++ b/src/backend/cuda/CMakeLists.txt +@@ -105,7 +105,7 @@ ELSE(CUDA_cusolver_LIBRARY) + ## Try to use CPU side lapack + IF(APPLE) + FIND_PACKAGE(LAPACKE QUIET) # For finding MKL +- IF(NOT LAPACK_FOUND) ++ IF(NOT LAPACKE_FOUND) + # UNSET THE VARIABLES FROM LAPACKE + UNSET(LAPACKE_LIB CACHE) + UNSET(LAPACK_LIB CACHE) +@@ -117,9 +117,9 @@ ELSE(CUDA_cusolver_LIBRARY) + FIND_PACKAGE(LAPACKE) + ENDIF(APPLE) + +- IF(NOT LAPACK_FOUND) ++ IF(NOT LAPACKE_FOUND) + MESSAGE(STATUS "CUDA Version ${CUDA_VERSION_STRING} does not contain cusolver library. Linear Algebra will not be available.") +- ELSE(NOT LAPACK_FOUND) ++ ELSE(NOT LAPACKE_FOUND) + MESSAGE(STATUS "CUDA Version ${CUDA_VERSION_STRING} does not contain cusolver library. But CPU LAPACK libraries are available. Will fallback to using host side code.") + ADD_DEFINITIONS(-DWITH_CPU_LINEAR_ALGEBRA) + IF(USE_CUDA_MKL) # Manual MKL Setup +@@ -148,7 +148,8 @@ INCLUDE_DIRECTORIES( + ) + + IF(CUDA_LAPACK_CPU_FALLBACK) +- INCLUDE_DIRECTORIES(${LAPACK_INCLUDE_DIR}) ++ INCLUDE_DIRECTORIES(${LAPACKE_INCLUDE_DIRS}) ++ LINK_DIRECTORIES(${LAPACKE_LIBRARY_DIRS}) + ENDIF() + + FILE(GLOB cuda_headers +@@ -379,7 +380,7 @@ ENDIF() + IF(CUDA_cusolver_LIBRARY) + TARGET_LINK_LIBRARIES(afcuda PRIVATE ${CUDA_cusolver_LIBRARY}) + ELSEIF(CUDA_LAPACK_CPU_FALLBACK) +- TARGET_LINK_LIBRARIES(afcuda PRIVATE ${LAPACK_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(afcuda PRIVATE ${LAPACKE_LIBRARIES}) + ENDIF() + + SET_TARGET_PROPERTIES(afcuda PROPERTIES +diff --git a/src/backend/opencl/CMakeLists.txt b/src/backend/opencl/CMakeLists.txt +index 71247ce..ded53bf 100644 +--- a/src/backend/opencl/CMakeLists.txt ++++ b/src/backend/opencl/CMakeLists.txt +@@ -12,7 +12,7 @@ ENDIF() + + IF(APPLE) + FIND_PACKAGE(LAPACKE QUIET) # For finding MKL +- IF(NOT LAPACK_FOUND) ++ IF(NOT LAPACKE_FOUND) + # UNSET THE VARIABLES FROM LAPACKE + UNSET(LAPACKE_LIB CACHE) + UNSET(LAPACK_LIB CACHE) +@@ -24,9 +24,9 @@ ELSE(APPLE) # Linux and Windows + FIND_PACKAGE(LAPACKE) + ENDIF(APPLE) + +-IF(NOT LAPACK_FOUND) +- MESSAGE(WARNING "LAPACK not found. Functionality will be disabled") +-ELSE(NOT LAPACK_FOUND) ++IF(NOT LAPACKE_FOUND) ++ MESSAGE(WARNING "LAPACKE not found. Functionality will be disabled") ++ELSE(NOT LAPACKE_FOUND) + ADD_DEFINITIONS(-DWITH_OPENCL_LINEAR_ALGEBRA) + + IF(NOT USE_OPENCL_MKL) +@@ -105,8 +105,9 @@ INCLUDE_DIRECTORIES( + ${BoostCompute_INCLUDE_DIRS} + ${CBLAS_INCLUDE_DIR} + ) +-IF(LAPACK_FOUND) +- INCLUDE_DIRECTORIES(${LAPACK_INCLUDE_DIR}) ++IF(LAPACKE_FOUND) ++ INCLUDE_DIRECTORIES(${LAPACKE_INCLUDE_DIRS}) ++ LINK_DIRECTORIES(${LAPACKE_LIBRARY_DIRS}) + ENDIF() + + FILE(GLOB opencl_headers +@@ -163,7 +164,7 @@ source_group(backend\\opencl\\kernel\\convolve\\Sources FILES ${conv_ker_sources + source_group(backend\\opencl\\cpu\\Headers FILES ${cpu_headers}) + source_group(backend\\opencl\\cpu\\Sources FILES ${cpu_sources}) + +-IF(LAPACK_FOUND) ++IF(LAPACKE_FOUND) + FILE(GLOB magma_sources + "magma/*.cpp") + +@@ -313,9 +314,9 @@ IF(FORGE_FOUND AND NOT USE_SYSTEM_FORGE) + ADD_DEPENDENCIES(afopencl forge) + ENDIF() + +-IF(LAPACK_FOUND) ++IF(LAPACKE_FOUND) + TARGET_LINK_LIBRARIES(afopencl +- PRIVATE ${LAPACK_LIBRARIES} ++ PRIVATE ${LAPACKE_LIBRARIES} + PRIVATE ${CBLAS_LIBRARIES}) + ENDIF() + diff --git a/arrayfire-newer-boost-compute.patch b/arrayfire-newer-boost-compute.patch new file mode 100644 index 0000000..b08c121 --- /dev/null +++ b/arrayfire-newer-boost-compute.patch @@ -0,0 +1,33 @@ +https://sources.debian.org/data/main/a/arrayfire/3.3.2+dfsg1-4/debian/patches/Use-compute-library-from-Boost-1.61.patch + +From: Ghislain Antony Vaillant +Date: Fri, 12 Aug 2016 08:35:19 +0100 +Subject: Use compute library from Boost 1.61. + +--- + src/backend/opencl/CMakeLists.txt | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/backend/opencl/CMakeLists.txt b/src/backend/opencl/CMakeLists.txt +index ded53bf..d7e3628 100644 +--- a/src/backend/opencl/CMakeLists.txt ++++ b/src/backend/opencl/CMakeLists.txt +@@ -84,11 +84,13 @@ ADD_DEFINITIONS( -DBOOST_ALL_NO_LIB ) + SET(Boost_USE_STATIC_LIBS OFF) + FIND_PACKAGE(Boost 1.48 REQUIRED) + +-OPTION(USE_SYSTEM_BOOST_COMPUTE "Use system BoostCompute" OFF) +-IF(USE_SYSTEM_BOOST_COMPUTE) +- FIND_PACKAGE(BoostCompute REQUIRED) +-ELSE() +- INCLUDE("${CMAKE_MODULE_PATH}/build_boost_compute.cmake") ++IF(Boost_VERSION VERSION_LESS "1.61") ++ OPTION(USE_SYSTEM_BOOST_COMPUTE "Use system BoostCompute" OFF) ++ IF(USE_SYSTEM_BOOST_COMPUTE) ++ FIND_PACKAGE(BoostCompute REQUIRED) ++ ELSE() ++ INCLUDE("${CMAKE_MODULE_PATH}/build_boost_compute.cmake") ++ ENDIF() + ENDIF() + + SET( cl_kernel_headers diff --git a/gn/packages/arrayfire.scm b/gn/packages/arrayfire.scm index 723444a..6a7c07f 100644 --- a/gn/packages/arrayfire.scm +++ b/gn/packages/arrayfire.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 Dennis Mungai +;;; Copyright © 2019 Efraim Flashner ;;; ;;; This file is part of GNU Guix. ;;; @@ -19,235 +20,216 @@ (define-module (gn packages arrayfire) #:use-module (guix packages) #:use-module ((guix licenses) #:prefix license:) - #:use-module (guix download) #:use-module (guix git-download) - #:use-module (guix build-system gnu) #:use-module (guix build-system cmake) #:use-module (gnu packages) #:use-module (guix utils) #:use-module (gnu packages algebra) - #:use-module (gnu packages autotools) - #:use-module (gnu packages bootstrap) - #:use-module (gnu packages compression) - #:use-module (gnu packages curl) - #:use-module (gnu packages gawk) - #:use-module (gnu packages cmake) #:use-module (gnu packages boost) - #:use-module (gnu packages glib) - #:use-module (gnu packages image) - #:use-module (gnu packages video) - #:use-module (gnu packages textutils) - ;; #:use-module (gnu packages fftw) - ;; #:use-module (gnu packages fftw-openmpi) - in algebra - ;; #:use-module (gnu packages fftwf) - #:use-module (gnu packages gl) + #:use-module (gnu packages check) #:use-module (gnu packages gcc) - #:use-module (gnu packages gnupg) - #:use-module (gnu packages pkg-config) #:use-module (gnu packages maths) - #:use-module (gnu packages mpi) - #:use-module (gnu packages web) - #:use-module (gnu packages wget) - #:use-module (gnu packages python) - #:use-module (gnu packages ruby) - #:use-module (gnu packages xorg) - #:use-module (gnu packages version-control) - #:use-module (gnu packages linux) - #:use-module (gnu packages opencl)) + #:use-module (gnu packages opencl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python)) (define-public arrayfire (package (name "arrayfire") - (version "3.3.1") + (version "3.3.2") (source (origin - (method url-fetch) - (uri (string-append "http://arrayfire.com/arrayfire_source/arrayfire-full-" version - ".tar.bz2")) - (file-name (string-append name "-" version ".tar.bz2")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/arrayfire/arrayfire.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 (base32 - "045adww6dqmyz6kkfmq7xawi5v9a894yp5j9pzn6j568gi48pyqc")))) - (native-inputs `(("autoconf" ,autoconf) - ("automake" ,automake) - ("gawk" ,gawk) - ("git" ,git) - ("glew" ,glew) - ("libtool" ,libtool) - ("pkg-config" ,pkg-config))) - (inputs `(("boost" ,boost) - ("glfw" ,glfw) - ("compute" ,compute) - ("curl" ,curl) + "113ldnqsil4p84sayv7jh8vnn0nalxibhdyvvwp94vqk20kqg4lw")) + (patches (search-patches "arrayfire-lapack-detection.patch" + "arrayfire-newer-boost-compute.patch")))) + (native-inputs + `(("pkg-config" ,pkg-config) + ("googletest" ,googletest) + ("assets" ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/arrayfire/assets.git") + (commit "729c7b64039e6433ae5ee521658ba20147efcb02"))) ; March 4, 2019 + (file-name (git-file-name "arrayfire-assets" "submodule")) + (sha256 + (base32 + "05zg7m6zlwi3llbv7l5wd9qi9ppb9p3ad2i5xmqwvcbgx5ry4l2s")))) + ("threads" ,(origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/alltheflops/threads.git") + (commit "5e778ce0a7f0f80af9d32ea3569df3dbec834f59"))) ; Dec 16, 2015 + (file-name (git-file-name "arrayfire-threads" "submodule")) + (sha256 + (base32 + "1rj2357r124b4ry0s467fz9hs4jxcyacliwprggvai85a39pqabx")))))) + (inputs + `(("boost" ,boost) ("clBLAS" ,clBLAS) ("clFFT" ,clFFT) - ("atlas" ,atlas) - ("dbus" ,dbus) - ("opencl-headers" ,opencl-headers) - ("ocl-icd" ,ocl-icd) - ("enca" ,enca) - ("eudev" ,eudev) - ("glew" ,glew) - ("glib" ,glib) - ("lapack" ,lapack) - ("scalapack" ,scalapack) - ("libcap" ,libcap) - ("libjpeg" ,libjpeg) - ("libltdl" ,libltdl) - ("libtiff" ,libtiff) - ("libyajl" ,libyajl) - ("mesa-utils" ,mesa-utils) - ("python" ,python-2) - ("freeimage" ,freeimage) - ("freeglut" ,freeglut) - ("fftw" ,fftw) - ("fftwf" ,fftwf) ("fftw-openmpi" ,fftw-openmpi) - ("glew" ,glew) - ("glu" ,glu) + ("fftwf" ,fftwf) + ("ocl-icd" ,ocl-icd) ("openblas" ,openblas) - ("wget" ,wget) - ("cmake" ,cmake))) + ("opencl-headers" ,opencl-headers))) (build-system cmake-build-system) (arguments - `(#:configure-flags '("-DBUILD_OPENCL=ON" "-DBUILD_CUDA=OFF" "-DBUILD_GRAPHICS=OFF" "-DUSE_SYSTEM_BOOST_COMPUTE=ON" "-DUSE_SYSTEM_CLBLAS=ON" "-DUSE_SYSTEM_CLFFT=ON") - #:tests? #t)) - (synopsis "ArrayFire: a general purpose GPU library. https://arrayfire.com") - (description "ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple.Now on Guix") - (home-page "http://arrayfire.com/") - (license (list license:gpl2 - license:gpl2+ - license:gpl3 - license:gpl3+)))) + `(#:configure-flags + '("-DBUILD_OPENCL=ON" + "-DBUILD_CUDA=OFF" + "-DBUILD_GRAPHICS=OFF" + "-DBUILD_TEST=OFF" ; building tests segfaults + "-DUSE_SYSTEM_CLBLAS=ON" + "-DUSE_SYSTEM_CLFFT=ON" + "-DUSE_SYSTEM_GTEST=ON") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'add-more-sources + (lambda* (#:key inputs #:allow-other-keys) + (let ((assets (assoc-ref inputs "assets")) + (threads (assoc-ref inputs "threads"))) + (copy-recursively assets "assets") + (copy-recursively threads "src/backend/cpu/threads")) + #t)) + (add-after 'unpack 'fix-sources + (lambda _ + (substitute* "src/backend/opencl/blas.cpp" + ;; https://github.com/arrayfire/arrayfire/commit/90a9ffbce5c38352a365e03a634ffaf0d2fb9933 + (("#undef BLAS_FUNC_DEF") + "#undef BLAS_FUNC_DEF\n#undef BLAS_FUNC")) + (substitute* '("src/backend/cpu/blas.cpp" + "src/backend/opencl/cpu/cpu_blas.cpp") + ;; https://github.com/arrayfire/arrayfire/pull/2538/files + (("&cblas_##PREFIX##FUNC;") + "(FUNC##_func_def)&cblas_##PREFIX##FUNC;")) + #t))) + #:tests? #f)) ; Building the tests fail linking, so we build the examples as a test. + (home-page "https://arrayfire.com/") + (synopsis "High performance library for parallel computing") + (description + "ArrayFire is a high performance software library for parallel computing +with an easy-to-use API. Its array based function set makes parallel +programming simple.") + (license (list license:bsd-3 ; everything except CMakeModules folder + license:cc0)))) ; assets (define-public clBLAS (package (name "clBLAS") - (version "v2.10") + (version "2.12") (source (origin - (method url-fetch) - (uri (string-append "https://github.com/clMathLibraries/clBLAS/archive/" - version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/clMathLibraries/clBLAS.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 (base32 - "0adlb02lqzrklfybhnv4n0p37mvkvdi3vqiwa05x2mv05ywnr93j")))) + "154mz52r5hm0jrp5fqrirzzbki14c1jkacj75flplnykbl36ibjs")))) (build-system cmake-build-system) - (arguments `(#:tests? #f - #:configure-flags '("../clBLAS-2.10/src" "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_BUILD_TYPE=Release" "-DBUILD_TEST=OFF"))) - (native-inputs `(("autoconf" ,autoconf) - ("automake" ,automake) - ("cmake" ,cmake) - ("gfortran" ,gfortran) - ("libtool" ,libtool) - ("pkg-config" ,pkg-config))) - (inputs `(("curl" ,curl) - ("dbus" ,dbus) - ("boost" ,boost) - ("enca" ,enca) - ("eudev" ,eudev) - ("fftw-openmpi" ,fftw-openmpi) - ("glew" ,glew) - ("libcap" ,libcap) - ("libjpeg" ,libjpeg) - ("libltdl" ,libltdl) - ("libtiff" ,libtiff) - ("mesa-utils" ,mesa-utils) - ("openmpi" ,openmpi) - ("ocl-icd" ,ocl-icd) + (arguments + `(#:tests? #f + #:configure-flags + (list "../source/src" + "-DUSE_SYSTEM_GTEST=ON" + ;"-DBoost_USE_STATIC_LIBS=OFF" ; this does not seem to apply + "-DBUILD_TEST=OFF") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-source + (lambda _ + (substitute* "src/CMakeLists.txt" + (("Boost_USE_STATIC_LIBS ON") + "Boost_USE_STATIC_LIBS OFF")) + #t))))) + (native-inputs + `(("gfortran" ,gfortran) + ("openblas" ,openblas) ("opencl-headers" ,opencl-headers) - ("randrproto" ,randrproto) - ("libxrandr" ,libxrandr) - ("xineramaproto" ,xineramaproto) - ("libxinerama" ,libxinerama) - ("libxcursor" ,libxcursor) ("python" ,python-2))) - (home-page "http://www.glfw.org/") - (synopsis "glfw is an Open Source, multi-platform library for creating windows with OpenGL contexts and receiving input and events.") - (description "glfw is an Open Source, multi-platform library for creating windows with OpenGL contexts and receiving input and events.") - (license (list license:gpl2)))) + (inputs + `(("boost" ,boost) + ("ocl-icd" ,ocl-icd))) + (home-page "https://github.com/clMathLibraries/clBLAS") + (synopsis "Library containing BLAS functions written in OpenCL") + (description + "The primary goal of @code{clBLAS} is to make it easier for developers to +utilize the inherent performance and power efficiency benefits of heterogeneous +computing. @code{clBLAS} interfaces do not hide nor wrap @code{OpenCL} +interfaces, but rather leaves @code{OpenCL} state management to the control of +the user to allow for maximum performance and flexibility. The @code{clBLAS} +library does generate and enqueue optimized @code{OpenCL} kernels, relieving the +user from the task of writing, optimizing and maintaining kernel code themselves.") + (license license:asl2.0))) (define-public clFFT (package (name "clFFT") - (version "v2.10.1") + (version "2.10.1") (source (origin - (method url-fetch) - (uri (string-append "https://github.com/clMathLibraries/clFFT/archive/" - version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/clMathLibraries/clFFT.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 (base32 - "19hrk1lf06kch8x9dpbdj0waycn2mldrmj2y4vzi7zn2gdfw6g73")))) + "1ksmcsqf25bmaq9rr2z1m936mxgh9cx6can2l7nna4mzlj0aghrs")))) (build-system cmake-build-system) - (arguments `(#:configure-flags '("../clFFT-2.10.1/src" "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_BUILD_TYPE=Release") #:tests? #f)) - (native-inputs `(("autoconf" ,autoconf) - ("automake" ,automake) - ("cmake" ,cmake) - ("libtool" ,libtool) - ("pkg-config" ,pkg-config))) - (inputs `(("curl" ,curl) - ("dbus" ,dbus) - ("enca" ,enca) - ("eudev" ,eudev) + (arguments + `(#:configure-flags '("../source/src" + "-DBUILD_TEST=ON" + "-DUSE_SYSTEM_GTEST=ON" + "-DBoost_USE_STATIC_LIBS=OFF") + #:test-target "Test")) + (native-inputs + `(("boost" ,boost) ("fftw-openmpi" ,fftw-openmpi) - ("glew" ,glew) - ("libcap" ,libcap) - ("libjpeg" ,libjpeg) - ("libltdl" ,libltdl) - ("libtiff" ,libtiff) - ("mesa-utils" ,mesa-utils) - ("openmpi" ,openmpi) - ("ocl-icd" ,ocl-icd) - ("opencl-headers" ,opencl-headers) - ("randrproto" ,randrproto) - ("libxrandr" ,libxrandr) - ("xineramaproto" ,xineramaproto) - ("libxinerama" ,libxinerama) - ("libxcursor" ,libxcursor) - ("python" ,python-2))) - (home-page "http://www.glfw.org/") - (synopsis "glfw is an Open Source, multi-platform library for creating windows with OpenGL contexts and receiving input and events.") - (description "glfw is an Open Source, multi-platform library for creating windows with OpenGL contexts and receiving input and events.") - (license (list license:gpl2)))) + ("fftwf" ,fftwf) + ("googletest" ,googletest))) + (inputs + `(("ocl-icd" ,ocl-icd) + ("opencl-headers" ,opencl-headers))) + (home-page "https://github.com/clMathLibraries/clFFT/") + (synopsis "Library containing FFT functions written in OpenCL") + (description "@code{clFFT} is a software library containing FFT functions +written in @code{OpenCL}. In addition to GPU devices, the library also supports +running on CPU devices to facilitate debugging and heterogeneous programming.") + (license license:asl2.0))) -(define-public compute +(define-public compute ; superceeded by boost-1.61+ (package (name "compute") - (version "v0.5") + (version "0.5") (source (origin - (method url-fetch) - (uri (string-append "https://github.com/boostorg/compute/archive/" - version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://github.com/boostorg/compute.git") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 (base32 - "1r16zd1wdnn9gx278mkvr13k3i79hr35v6vj0fn7v3n92ngwxnhd")))) + "0jc04k43br49hqgzrxfn3wfz2m94q1z45zfg5nahqb7p0lbfgwyx")))) (build-system cmake-build-system) - (arguments `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON" "-DCMAKE_BUILD_TYPE=Release") #:tests? #f)) - (native-inputs `(("autoconf" ,autoconf) - ("automake" ,automake) - ("cmake" ,cmake) - ("libtool" ,libtool) - ("pkg-config" ,pkg-config))) - (inputs `(("curl" ,curl) - ("dbus" ,dbus) - ("enca" ,enca) - ("eudev" ,eudev) - ("fftw-openmpi" ,fftw-openmpi) - ("glew" ,glew) - ("boost" ,boost) - ("libcap" ,libcap) - ("libjpeg" ,libjpeg) - ("libltdl" ,libltdl) - ("libtiff" ,libtiff) - ("mesa-utils" ,mesa-utils) - ("openmpi" ,openmpi) + (arguments + `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON" + "-DCMAKE_BUILD_TYPE=Release") + #:tests? #f)) ; tests require OpenCL device + (native-inputs + `(("boost" ,boost-for-mysql) ; 1.59.0 ("opencl-headers" ,opencl-headers) - ("ocl-icd" ,ocl-icd) - ("randrproto" ,randrproto) - ("libxrandr" ,libxrandr) - ("xineramaproto" ,xineramaproto) - ("libxinerama" ,libxinerama) - ("libxcursor" ,libxcursor) - ("python" ,python-2))) - (home-page "http://boost.org") - (synopsis "Peer-reviewed portable C++ source libraries,BoostCompute") - (description "Peer-reviewed portable C++ source libraries,BoostCompute") - (license (list license:x11-style)))) + ("ocl-icd" ,ocl-icd))) + (home-page "http://boostorg.github.io/compute/") + (synopsis "C++ GPU Computing Library for OpenCL") + (description + "@code{Boost.Compute} is a GPU/parallel-computing library for C++ based on +@code{OpenCL}. The core library is a thin C++ wrapper over the @code{OpenCL +API} and provides access to compute devices, contexts, command queues and memory +buffers.") + (license license:boost1.0))) -- cgit v1.2.3