git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #71413 from chessai/add-arrayfire

arrayfire: add

commitb03da424c6b985e831251415606a2eaee832fbd1 authorMichael Bishop <cleverca22@gmail.com> dateSun 20 Oct 2019, 00:47 (7 years ago) parent48c9c55ed3ccf4
3 files changed+119
pkgs/development/libraries/arrayfire/default.nix+86 pkgs/development/libraries/arrayfire/no-download.patch+28 pkgs/top-level/all-packages.nix+5
pkgs/development/libraries/arrayfire/default.nixnew file+86
@@ -0,0 +1,86 @@
1+{ stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig
2+, cudatoolkit, opencl-clhpp, ocl-icd, fftw, fftwFloat, mkl
3+, blas, openblas, boost, mesa, libGLU_combined
4+, freeimage, python
5+}:
6+
7+let
8+ version = "3.6.4";
9+
10+ clfftSource = fetchFromGitHub {
11+ owner = "arrayfire";
12+ repo = "clFFT";
13+ rev = "16925fb93338b3cac66490b5cf764953d6a5dac7";
14+ sha256 = "0y35nrdz7w4n1l17myhkni3hwm37z775xn6f76xmf1ph7dbkslsc";
15+ fetchSubmodules = true;
16+ };
17+
18+ clblasSource = fetchFromGitHub {
19+ owner = "arrayfire";
20+ repo = "clBLAS";
21+ rev = "1f3de2ae5582972f665c685b18ef0df43c1792bb";
22+ sha256 = "154mz52r5hm0jrp5fqrirzzbki14c1jkacj75flplnykbl36ibjs";
23+ fetchSubmodules = true;
24+ };
25+
26+ cl2hppSource = fetchurl {
27+ url = "https://github.com/KhronosGroup/OpenCL-CLHPP/releases/download/v2.0.10/cl2.hpp";
28+ sha256 = "1v4q0g6b6mwwsi0kn7kbjn749j3qafb9r4ld3zdq1163ln9cwnvw";
29+ };
30+
31+in stdenv.mkDerivation {
32+ pname = "arrayfire";
33+ inherit version;
34+
35+ src = fetchurl {
36+ url = "http://arrayfire.com/arrayfire_source/arrayfire-full-${version}.tar.bz2";
37+ sha256 = "1fin7a9rliyqic3z83agkpb8zlq663q6gdxsnm156cs8s7f7rc9h";
38+ };
39+
40+ cmakeFlags = [
41+ "-DAF_BUILD_OPENCL=OFF"
42+ "-DAF_BUILD_EXAMPLES=OFF"
43+ "-DBUILD_TESTING=OFF"
44+ "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs"
45+ ];
46+
47+ patches = [ ./no-download.patch ];
48+
49+ postPatch = ''
50+ mkdir -p ./build/third_party/clFFT/src
51+ cp -R --no-preserve=mode,ownership ${clfftSource}/ ./build/third_party/clFFT/src/clFFT-ext/
52+ mkdir -p ./build/third_party/clBLAS/src
53+ cp -R --no-preserve=mode,ownership ${clblasSource}/ ./build/third_party/clBLAS/src/clBLAS-ext/
54+ mkdir -p ./build/include/CL
55+ cp -R --no-preserve=mode,ownership ${cl2hppSource} ./build/include/CL/cl2.hpp
56+ '';
57+
58+ preBuild = ''
59+ export CUDA_PATH="${cudatoolkit}"
60+ '';
61+
62+ enableParallelBuilding = true;
63+
64+ nativeBuildInputs = [
65+ cmake
66+ pkgconfig
67+ ];
68+
69+ buildInputs = [
70+ opencl-clhpp fftw fftwFloat
71+ mkl
72+ openblas
73+ libGLU_combined
74+ mesa freeimage
75+ boost.out boost.dev python
76+ ] ++ (stdenv.lib.optional stdenv.isLinux [ cudatoolkit ocl-icd ]);
77+
78+ meta = with stdenv.lib; {
79+ description = "A general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices";
80+ license = licenses.bsd3;
81+ homepage = https://arrayfire.com/ ;
82+ platforms = platforms.linux ++ platforms.darwin;
83+ maintainers = with stdenv.lib.maintainers; [ chessai ];
84+ inherit version;
85+ };
86+}
pkgs/development/libraries/arrayfire/no-download.patchnew file+28
@@ -0,0 +1,28 @@
1+diff --git a/CMakeModules/build_clBLAS.cmake b/CMakeModules/build_clBLAS.cmake
2+index 8de529e8..6361b613 100644
3+--- a/CMakeModules/build_clBLAS.cmake
4++++ b/CMakeModules/build_clBLAS.cmake
5+@@ -14,8 +14,7 @@ find_package(OpenCL)
6+
7+ ExternalProject_Add(
8+ clBLAS-ext
9+- GIT_REPOSITORY https://github.com/arrayfire/clBLAS.git
10+- GIT_TAG arrayfire-release
11++ DOWNLOAD_COMMAND true
12+ BUILD_BYPRODUCTS ${clBLAS_location}
13+ PREFIX "${prefix}"
14+ INSTALL_DIR "${prefix}"
15+diff --git a/CMakeModules/build_clFFT.cmake b/CMakeModules/build_clFFT.cmake
16+index 28be38a3..85e3915e 100644
17+--- a/CMakeModules/build_clFFT.cmake
18++++ b/CMakeModules/build_clFFT.cmake
19+@@ -20,8 +20,7 @@ ENDIF()
20+
21+ ExternalProject_Add(
22+ clFFT-ext
23+- GIT_REPOSITORY https://github.com/arrayfire/clFFT.git
24+- GIT_TAG arrayfire-release
25++ DOWNLOAD_COMMAND true
26+ PREFIX "${prefix}"
27+ INSTALL_DIR "${prefix}"
28+ UPDATE_COMMAND ""
pkgs/top-level/all-packages.nix+5
@@ -10413,6 +10413,11 @@ in
1041310413
1041410414 armadillo = callPackage ../development/libraries/armadillo {};
1041510415
10416+ arrayfire = callPackage ../development/libraries/arrayfire {
10417+ # fails to build with gcc >= 7
10418+ stdenv = gcc6Stdenv;
10419+ };
10420+
1041610421 arrow-cpp = callPackage ../development/libraries/arrow-cpp {
1041710422 gtest = gtest.override { static = true; };
1041810423 };