2019-10-20 02:04:07 +01:00
|
|
|
{ stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig
|
|
|
|
, cudatoolkit, opencl-clhpp, ocl-icd, fftw, fftwFloat, mkl
|
2019-11-10 16:44:34 +00:00
|
|
|
, blas, openblas, boost, mesa, libGLU, libGL
|
2019-10-28 06:25:49 +00:00
|
|
|
, freeimage, python, clfft, clblas
|
|
|
|
, doxygen, buildDocs ? false
|
2019-10-20 02:04:07 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2019-10-28 06:25:49 +00:00
|
|
|
strOnLinux = stdenv.lib.optionalString stdenv.isLinux;
|
2019-10-20 02:04:07 +01:00
|
|
|
|
2019-10-28 06:25:49 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-10-20 02:04:07 +01:00
|
|
|
pname = "arrayfire";
|
2019-10-28 06:25:49 +00:00
|
|
|
version = "3.6.4";
|
2019-10-20 02:04:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "http://arrayfire.com/arrayfire_source/arrayfire-full-${version}.tar.bz2";
|
|
|
|
sha256 = "1fin7a9rliyqic3z83agkpb8zlq663q6gdxsnm156cs8s7f7rc9h";
|
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DAF_BUILD_OPENCL=OFF"
|
|
|
|
"-DAF_BUILD_EXAMPLES=OFF"
|
|
|
|
"-DBUILD_TESTING=OFF"
|
2019-10-28 06:25:49 +00:00
|
|
|
(strOnLinux "-DCMAKE_LIBRARY_PATH=${cudatoolkit}/lib/stubs")
|
2019-10-20 02:04:07 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
patches = [ ./no-download.patch ];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
mkdir -p ./build/third_party/clFFT/src
|
2019-10-28 06:25:49 +00:00
|
|
|
cp -R --no-preserve=mode,ownership ${clfft.src}/ ./build/third_party/clFFT/src/clFFT-ext/
|
2019-10-20 02:04:07 +01:00
|
|
|
mkdir -p ./build/third_party/clBLAS/src
|
2019-10-28 06:25:49 +00:00
|
|
|
cp -R --no-preserve=mode,ownership ${clblas.src}/ ./build/third_party/clBLAS/src/clBLAS-ext/
|
2019-10-20 02:04:07 +01:00
|
|
|
mkdir -p ./build/include/CL
|
2019-10-28 06:25:49 +00:00
|
|
|
cp -R --no-preserve=mode,ownership ${opencl-clhpp}/include/CL/cl2.hpp ./build/include/CL/cl2.hpp
|
2019-10-20 02:04:07 +01:00
|
|
|
'';
|
|
|
|
|
2019-10-28 06:25:49 +00:00
|
|
|
preBuild = strOnLinux ''
|
2019-10-20 02:04:07 +01:00
|
|
|
export CUDA_PATH="${cudatoolkit}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
pkgconfig
|
2019-10-28 06:25:49 +00:00
|
|
|
python
|
2019-10-20 02:04:07 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
opencl-clhpp fftw fftwFloat
|
|
|
|
mkl
|
|
|
|
openblas
|
2019-11-10 16:44:34 +00:00
|
|
|
libGLU libGL
|
2019-10-20 02:04:07 +01:00
|
|
|
mesa freeimage
|
2019-10-28 06:25:49 +00:00
|
|
|
boost.out boost.dev
|
|
|
|
] ++ (stdenv.lib.optional stdenv.isLinux [ cudatoolkit ocl-icd ])
|
|
|
|
++ (stdenv.lib.optional buildDocs [ doxygen ]);
|
2019-10-20 02:04:07 +01:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2019-10-28 06:25:49 +00:00
|
|
|
description = "A general-purpose library for parallel and massively-parallel computations";
|
|
|
|
longDescription = ''
|
|
|
|
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.";
|
|
|
|
'';
|
2019-10-20 02:04:07 +01:00
|
|
|
license = licenses.bsd3;
|
2019-10-28 06:25:49 +00:00
|
|
|
homepage = "https://arrayfire.com/";
|
2019-10-20 02:04:07 +01:00
|
|
|
platforms = platforms.linux ++ platforms.darwin;
|
2019-10-28 06:25:49 +00:00
|
|
|
maintainers = with maintainers; [ chessai ];
|
2019-10-20 02:04:07 +01:00
|
|
|
};
|
|
|
|
}
|