summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorartuuge <artuuge@gmail.com>2016-06-05 14:33:19 +0200
committerartuuge <artuuge@gmail.com>2016-06-05 14:33:19 +0200
commit5b51f0bff92290e4a4f41837126c722293301672 (patch)
treec5c3122b91190f939dbcc867f78ef07437829299 /pkgs/development
parent4c722ad380dc9885721f8722158e8d7cd1eeab37 (diff)
downloadnixlib-5b51f0bff92290e4a4f41837126c722293301672.tar
nixlib-5b51f0bff92290e4a4f41837126c722293301672.tar.gz
nixlib-5b51f0bff92290e4a4f41837126c722293301672.tar.bz2
nixlib-5b51f0bff92290e4a4f41837126c722293301672.tar.lz
nixlib-5b51f0bff92290e4a4f41837126c722293301672.tar.xz
nixlib-5b51f0bff92290e4a4f41837126c722293301672.tar.zst
nixlib-5b51f0bff92290e4a4f41837126c722293301672.zip
clblas-cuda: init at git-20160505
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/science/math/clblas/cuda/default.nix68
-rw-r--r--pkgs/development/libraries/science/math/clblas/cuda/platform.patch34
2 files changed, 102 insertions, 0 deletions
diff --git a/pkgs/development/libraries/science/math/clblas/cuda/default.nix b/pkgs/development/libraries/science/math/clblas/cuda/default.nix
new file mode 100644
index 000000000000..8691009acae7
--- /dev/null
+++ b/pkgs/development/libraries/science/math/clblas/cuda/default.nix
@@ -0,0 +1,68 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, gfortran
+, blas
+, boost
+, python
+, cudatoolkit
+, nvidia_x11
+}:
+
+stdenv.mkDerivation rec {
+  name = "clblas-cuda-${version}"; 
+  version = "git-20160505"; 
+
+  src = fetchFromGitHub {
+    owner = "clMathLibraries"; 
+    repo = "clBLAS";
+    rev = "d20977ec4389c6b3751e318779410007c5e272f8";
+    sha256 = "1jna176cxznv7iz43svd6cjrbbf0fc2lrbpfpg4s08vc7xnwp0n4";
+  }; 
+
+  patches = [ ./platform.patch ]; 
+
+  postPatch = ''
+    sed -i -re 's/(set\(\s*Boost_USE_STATIC_LIBS\s+).*/\1OFF\ \)/g' src/CMakeLists.txt
+  '';
+
+  configurePhase = ''    
+    findInputs ${boost} boost_dirs propagated-native-build-inputs
+
+    export BOOST_INCLUDEDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep '\-dev')/include
+    export BOOST_LIBRARYDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep -v '\-dev')/lib
+
+    mkdir -p Build
+    pushd Build
+
+    export LD_LIBRARY_PATH="${blas}/lib:${nvidia_x11}/lib"
+
+    cmake ../src -DCMAKE_INSTALL_PREFIX=$out \
+                 -DCMAKE_BUILD_TYPE=Release \
+                 -DOPENCL_ROOT=${cudatoolkit} \
+  '';
+
+  dontStrip = true; 
+
+  buildInputs = [
+    cmake
+    gfortran
+    blas
+    python
+    cudatoolkit
+    nvidia_x11
+  ]; 
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/clMathLibraries/clBLAS;
+    description = "A software library containing BLAS functions written in OpenCL";
+    longDescription = ''
+      This package contains a library of BLAS functions on top of OpenCL. 
+      The current version is linked to the NVIDIA OpenCL implementation provided by the CUDA toolkit. 
+    '';
+    license = licenses.asl20;
+    maintainers = with maintainers; [ artuuge ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/pkgs/development/libraries/science/math/clblas/cuda/platform.patch b/pkgs/development/libraries/science/math/clblas/cuda/platform.patch
new file mode 100644
index 000000000000..87404a426a4b
--- /dev/null
+++ b/pkgs/development/libraries/science/math/clblas/cuda/platform.patch
@@ -0,0 +1,34 @@
+diff --git a/src/library/tools/ktest/config.cpp b/src/library/tools/ktest/config.cpp
+index 8b20128..faf9bde 100644
+--- a/src/library/tools/ktest/config.cpp
++++ b/src/library/tools/ktest/config.cpp
+@@ -24,8 +24,6 @@
+ 
+ using namespace clMath;
+ 
+-static const char DEFAULT_PLATFORM_NAME[] = "AMD Accelerated Parallel Processing";
+-
+ Config::Config() :
+     defaultConfig_(""),
+     cpp_("ktest.cpp"),
+@@ -35,7 +33,10 @@ Config::Config() :
+     hasFuncID_(false), hasSubdims_(false),
+     skipAccuracy_(false)
+ {
+-    setPlatform(DEFAULT_PLATFORM_NAME);
++    platform_ = NULL;
++    setPlatform("");
++
++    device_ = NULL;
+     setDevice("");
+ 
+     memset(&kargs_, 0, sizeof(kargs_));
+@@ -262,7 +263,7 @@ Config::setPlatform(const std::string& name)
+             continue;
+         }
+         if (name.empty()) {
+-            found = (strcmp(pname, DEFAULT_PLATFORM_NAME) == 0);
++	    found = true;
+         }
+         else {
+             found = (strcmp(pname, name.c_str()) == 0);