2017-11-09 11:26:09 +00:00
|
|
|
{ stdenv
|
2017-09-17 16:02:20 +01:00
|
|
|
, lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, cython
|
|
|
|
, numpy
|
|
|
|
, six
|
|
|
|
, nose
|
|
|
|
, Mako
|
2018-05-13 13:17:32 +01:00
|
|
|
, cudaSupport ? false, cudatoolkit , nvidia_x11
|
2017-09-17 16:02:20 +01:00
|
|
|
, openclSupport ? true, ocl-icd, clblas
|
2017-11-09 11:26:09 +00:00
|
|
|
}:
|
2017-09-17 16:02:20 +01:00
|
|
|
|
2018-05-13 13:17:32 +01:00
|
|
|
assert cudaSupport -> nvidia_x11 != null
|
|
|
|
&& cudatoolkit != null;
|
|
|
|
|
2017-09-17 16:02:20 +01:00
|
|
|
buildPythonPackage rec {
|
2017-11-09 11:26:09 +00:00
|
|
|
pname = "libgpuarray";
|
2018-02-25 17:13:47 +00:00
|
|
|
version = "0.7.5";
|
2017-09-17 16:02:20 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2017-11-09 11:26:09 +00:00
|
|
|
owner = "Theano";
|
2017-09-17 16:02:20 +01:00
|
|
|
repo = "libgpuarray";
|
|
|
|
rev = "v${version}";
|
2018-02-25 17:13:47 +00:00
|
|
|
sha256 = "0zkdwjq3k6ciiyf8y5w663fbsnmzhgy27yvpxfhkpxazw9vg3l5v";
|
2017-11-09 11:26:09 +00:00
|
|
|
};
|
2017-09-17 16:02:20 +01:00
|
|
|
|
|
|
|
# requires a GPU
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
configurePhase = "cmakeConfigurePhase";
|
|
|
|
|
|
|
|
libraryPath = lib.makeLibraryPath (
|
|
|
|
[]
|
2018-05-13 13:17:32 +01:00
|
|
|
++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out nvidia_x11 ]
|
2018-04-15 17:34:45 +01:00
|
|
|
++ lib.optionals openclSupport ([ clblas ] ++ lib.optional (!stdenv.isDarwin) ocl-icd)
|
2017-09-17 16:02:20 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
make -j$NIX_BUILD_CORES
|
|
|
|
make install
|
|
|
|
|
|
|
|
export NIX_CFLAGS_COMPILE="-L $out/lib -I $out/include $NIX_CFLAGS_COMPILE"
|
|
|
|
|
|
|
|
cd ..
|
2017-11-09 11:26:09 +00:00
|
|
|
'';
|
2017-09-17 16:02:20 +01:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
rm $out/lib/libgpuarray-static.a
|
2018-04-15 17:34:45 +01:00
|
|
|
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
2017-09-17 16:02:20 +01:00
|
|
|
function fixRunPath {
|
|
|
|
p=$(patchelf --print-rpath $1)
|
|
|
|
patchelf --set-rpath "$p:$libraryPath" $1
|
|
|
|
}
|
|
|
|
|
|
|
|
fixRunPath $out/lib/libgpuarray.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
six
|
|
|
|
Mako
|
|
|
|
];
|
|
|
|
|
2019-03-29 13:18:55 +00:00
|
|
|
nativeBuildInputs = [ cmake ];
|
|
|
|
|
2017-11-09 11:26:09 +00:00
|
|
|
buildInputs = [
|
|
|
|
cython
|
2017-09-17 16:02:20 +01:00
|
|
|
nose
|
2017-11-09 11:26:09 +00:00
|
|
|
];
|
2017-09-17 16:02:20 +01:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2017-09-17 16:02:20 +01:00
|
|
|
homepage = "https://github.com/Theano/libgpuarray";
|
|
|
|
description = "Library to manipulate tensors on GPU.";
|
|
|
|
license = licenses.free;
|
|
|
|
maintainers = with maintainers; [ artuuge ];
|
2018-04-15 17:34:45 +01:00
|
|
|
platforms = platforms.unix;
|
2017-09-17 16:02:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|