at 23.05-pre 2.1 kB view raw
1{ lib, stdenv, fetchFromGitHub, cmake, pkg-config 2, opencl-clhpp, ocl-icd, fftw, fftwFloat 3, blas, lapack, boost, mesa, libGLU, libGL 4, freeimage, python3, clfft, clblas 5, doxygen, buildDocs ? false 6, cudaSupport ? false, cudatoolkit 7}: 8 9stdenv.mkDerivation rec { 10 pname = "arrayfire"; 11 version = "3.7.3"; 12 13 src = fetchFromGitHub { 14 owner = pname; 15 repo = pname; 16 rev = "v${version}"; 17 sha256 = "0gcbg6b6gs38xhks5pp0vkcqs89zl7rh9982jqlzsd0h724qddw0"; 18 fetchSubmodules = true; 19 }; 20 21 cmakeFlags = [ 22 "-DAF_BUILD_OPENCL=OFF" 23 "-DAF_BUILD_EXAMPLES=OFF" 24 "-DBUILD_TESTING=OFF" 25 ] ++ lib.optional cudaSupport "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs"; 26 27 patches = [ ./no-download.patch ]; 28 29 postPatch = '' 30 mkdir -p ./build/third_party/clFFT/src 31 cp -R --no-preserve=mode,ownership ${clfft.src}/ ./build/third_party/clFFT/src/clFFT-ext/ 32 mkdir -p ./build/third_party/clBLAS/src 33 cp -R --no-preserve=mode,ownership ${clblas.src}/ ./build/third_party/clBLAS/src/clBLAS-ext/ 34 mkdir -p ./build/include/CL 35 cp -R --no-preserve=mode,ownership ${opencl-clhpp}/include/CL/cl2.hpp ./build/include/CL/cl2.hpp 36 ''; 37 38 preBuild = lib.optionalString cudaSupport '' 39 export CUDA_PATH="${cudatoolkit}" 40 ''; 41 42 nativeBuildInputs = [ 43 cmake 44 pkg-config 45 python3 46 ]; 47 48 strictDeps = true; 49 50 buildInputs = [ 51 opencl-clhpp fftw fftwFloat 52 blas lapack 53 libGLU libGL 54 mesa freeimage 55 boost.out boost.dev 56 ] ++ (lib.optional stdenv.isLinux ocl-icd) 57 ++ (lib.optional cudaSupport cudatoolkit) 58 ++ (lib.optional buildDocs doxygen); 59 60 meta = with lib; { 61 description = "A general-purpose library for parallel and massively-parallel computations"; 62 longDescription = '' 63 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."; 64 ''; 65 license = licenses.bsd3; 66 homepage = "https://arrayfire.com/"; 67 platforms = platforms.linux ++ platforms.darwin; 68 maintainers = with maintainers; [ chessai ]; 69 }; 70}