2022-01-15 18:38:44 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, pkg-config
|
2020-04-17 00:06:49 +01:00
|
|
|
, opencl-clhpp, ocl-icd, fftw, fftwFloat
|
2020-03-31 15:47:18 +01:00
|
|
|
, blas, lapack, boost, mesa, libGLU, libGL
|
2021-03-25 09:24:48 +00:00
|
|
|
, freeimage, python3, clfft, clblas
|
2019-10-28 06:25:49 +00:00
|
|
|
, doxygen, buildDocs ? false
|
2020-03-31 15:47:18 +01:00
|
|
|
, cudaSupport ? false, cudatoolkit
|
2019-10-20 02:04:07 +01:00
|
|
|
}:
|
|
|
|
|
2020-03-31 15:47:18 +01:00
|
|
|
stdenv.mkDerivation rec {
|
2019-10-20 02:04:07 +01:00
|
|
|
pname = "arrayfire";
|
2022-01-15 18:38:44 +00:00
|
|
|
version = "3.7.3";
|
2019-10-20 02:04:07 +01:00
|
|
|
|
2022-01-15 18:38:44 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "0gcbg6b6gs38xhks5pp0vkcqs89zl7rh9982jqlzsd0h724qddw0";
|
|
|
|
fetchSubmodules = true;
|
2019-10-20 02:04:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DAF_BUILD_OPENCL=OFF"
|
|
|
|
"-DAF_BUILD_EXAMPLES=OFF"
|
|
|
|
"-DBUILD_TESTING=OFF"
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optional cudaSupport "-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
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
preBuild = lib.optionalString cudaSupport ''
|
2019-10-20 02:04:07 +01:00
|
|
|
export CUDA_PATH="${cudatoolkit}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-01-19 06:50:56 +00:00
|
|
|
pkg-config
|
2021-03-25 09:24:48 +00:00
|
|
|
python3
|
2019-10-20 02:04:07 +01:00
|
|
|
];
|
|
|
|
|
2021-03-25 09:24:48 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2019-10-20 02:04:07 +01:00
|
|
|
buildInputs = [
|
|
|
|
opencl-clhpp fftw fftwFloat
|
2020-03-31 15:47:18 +01:00
|
|
|
blas lapack
|
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
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ (lib.optional stdenv.isLinux ocl-icd)
|
|
|
|
++ (lib.optional cudaSupport cudatoolkit)
|
|
|
|
++ (lib.optional buildDocs doxygen);
|
2019-10-20 02:04:07 +01:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with 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
|
|
|
};
|
|
|
|
}
|