summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/libgpuarray
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-09-17 18:02:20 +0300
committerNikolay Amiantov <ab@fmap.me>2017-10-19 12:47:30 +0300
commitefd2444de5663df1cad443f41d4bfec4a1745f28 (patch)
tree80a94766129fc69a3b15e27de9b26cd899b4b76d /pkgs/development/python-modules/libgpuarray
parent50a223b1446224d4fb0144ecd13c2a2d9955a156 (diff)
python.pkgs.libgpuarray: -9998.0 -> 0.6.9
Diffstat (limited to 'pkgs/development/python-modules/libgpuarray')
-rw-r--r--pkgs/development/python-modules/libgpuarray/cuda/default.nix129
-rw-r--r--pkgs/development/python-modules/libgpuarray/default.nix81
2 files changed, 81 insertions, 129 deletions
diff --git a/pkgs/development/python-modules/libgpuarray/cuda/default.nix b/pkgs/development/python-modules/libgpuarray/cuda/default.nix
deleted file mode 100644
index a9c64cd7d7f8..000000000000
--- a/pkgs/development/python-modules/libgpuarray/cuda/default.nix
+++ /dev/null
@@ -1,129 +0,0 @@
-{ stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, cmake
-, cython
-, numpy
-, Mako
-, six
-, nose
-, beaker
-, memcached
-, pkgconfig
-, glibc
-, clblas
-, Babel
-, pygments
-, scipy
-, python
-, cudatoolkit
-, nvidia_x11
-}:
-buildPythonPackage rec {
- name = "libgpuarray-cuda-${version}";
- version = "-9998.0";
-
- src = fetchFromGitHub {
- owner = "Theano";
- repo = "libgpuarray";
- rev = "fc36a40526c0a8303ace6c574ffdefba7feafe17";
- sha256 = "1kb0k42addqjxiahlcbv6v6271yhsmz71j12186fpy60870i7zm7";
- };
-
- doCheck = true;
-
- configurePhase = ''
- mkdir -p Build/Install
- pushd Build
-
- cmake .. -DCMAKE_BUILD_TYPE=Release \
- -DCMAKE_INSTALL_PREFIX=./Install \
- -DCLBLAS_ROOT_DIR=${clblas}
-
- popd
- '';
-
- preBuild = ''
- pushd Build
- make
- make install
-
- function fixRunPath {
- p=$(patchelf --print-rpath $1)
- patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ cudatoolkit clblas nvidia_x11 ]}" $1
- }
-
- fixRunPath Install/lib/libgpuarray.so
-
- popd
- '';
-
- setupPyBuildFlags = [ "-L $(pwd)/Build/Install/lib" "-I $(pwd)/Build/Install/include" ];
-
- preInstall = ''
- cp -r Build/Install $out
- '';
-
- postInstall = ''
- pushd $out/${python.sitePackages}/pygpu
- for f in $(find $out/pygpu -name "*.h"); do
- ln -s $f $(basename $f)
- done
- popd
- '';
- checkPhase = ''
- mkdir -p my_bin
- pushd my_bin
-
- cat > libgpuarray_run_tests << EOF
-#!/bin/sh
-if [ \$# -eq 0 ]; then
- echo "No argument provided."
- echo "Available tests:"
- ls $out/${python.sitePackages}/pygpu/tests | grep "test_"
- exit 1
-else
- nosetests -v "$out/${python.sitePackages}/pygpu/tests/\$@"
-fi
-EOF
-
- chmod +x libgpuarray_run_tests
- popd
-
- cp -r my_bin $out/bin
- '';
-
- dontStrip = true;
-
- propagatedBuildInputs = [
- numpy
- scipy
- nose
- six
- Mako
- ];
-
- buildInputs = [
- cmake
- cython
- beaker
- memcached
- pkgconfig
- glibc
- Babel
- pygments
- numpy.blas
- cudatoolkit
- nvidia_x11
- clblas
- ];
-
- meta = with stdenv.lib; {
- homepage = https://github.com/Theano/libgpuarray;
- description = "Library to manipulate tensors on GPU.";
- license = licenses.free;
- maintainers = with maintainers; [ artuuge ];
- platforms = platforms.linux;
- };
-
-}
diff --git a/pkgs/development/python-modules/libgpuarray/default.nix b/pkgs/development/python-modules/libgpuarray/default.nix
new file mode 100644
index 000000000000..3c24c2ed24cb
--- /dev/null
+++ b/pkgs/development/python-modules/libgpuarray/default.nix
@@ -0,0 +1,81 @@
+{ stdenv
+, lib
+, buildPythonPackage
+, fetchFromGitHub
+, cmake
+, cython
+, numpy
+, six
+, nose
+, Mako
+, python
+, cudaSupport ? false, cudatoolkit
+, openclSupport ? true, ocl-icd, clblas
+}:
+
+buildPythonPackage rec {
+ name = "libgpuarray-${version}";
+ version = "0.6.9";
+
+ src = fetchFromGitHub {
+ owner = "Theano";
+ repo = "libgpuarray";
+ rev = "v${version}";
+ sha256 = "06z47ls42a37gbv0x7f3l1qvils7q0hvy02s95l530klgibp19s0";
+ };
+
+ # requires a GPU
+ doCheck = false;
+
+ configurePhase = "cmakeConfigurePhase";
+
+ libraryPath = lib.makeLibraryPath (
+ []
+ ++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out ]
+ ++ lib.optionals openclSupport [ ocl-icd clblas ]
+ );
+
+ preBuild = ''
+ make -j$NIX_BUILD_CORES
+ make install
+
+ ls $out/lib
+ export NIX_CFLAGS_COMPILE="-L $out/lib -I $out/include $NIX_CFLAGS_COMPILE"
+
+ cd ..
+ '';
+
+ postFixup = ''
+ rm $out/lib/libgpuarray-static.a
+
+ function fixRunPath {
+ p=$(patchelf --print-rpath $1)
+ patchelf --set-rpath "$p:$libraryPath" $1
+ }
+
+ fixRunPath $out/lib/libgpuarray.so
+ '';
+
+ propagatedBuildInputs = [
+ numpy
+ six
+ Mako
+ ];
+
+ enableParallelBuilding = true;
+
+ buildInputs = [
+ cmake
+ cython
+ nose
+ ];
+
+ meta = with stdenv.lib; {
+ homepage = "https://github.com/Theano/libgpuarray";
+ description = "Library to manipulate tensors on GPU.";
+ license = licenses.free;
+ maintainers = with maintainers; [ artuuge ];
+ platforms = platforms.linux;
+ };
+
+}