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
9 stdenv.mkDerivation rec {
14 url = "http://arrayfire.com/arrayfire_source/arrayfire-full-${version}.tar.bz2";
15 sha256 = "1fin7a9rliyqic3z83agkpb8zlq663q6gdxsnm156cs8s7f7rc9h";
19 "-DAF_BUILD_OPENCL=OFF"
20 "-DAF_BUILD_EXAMPLES=OFF"
22 ] ++ lib.optional cudaSupport "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs";
24 patches = [ ./no-download.patch ];
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
35 preBuild = lib.optionalString cudaSupport ''
36 export CUDA_PATH="${cudatoolkit}"
48 opencl-clhpp fftw fftwFloat
53 ] ++ (lib.optional stdenv.isLinux ocl-icd)
54 ++ (lib.optional cudaSupport cudatoolkit)
55 ++ (lib.optional buildDocs doxygen);
58 description = "A general-purpose library for parallel and massively-parallel computations";
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.";
62 license = licenses.bsd3;
63 homepage = "https://arrayfire.com/";
64 platforms = platforms.linux ++ platforms.darwin;
65 maintainers = with maintainers; [ chessai ];