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