about summary refs log tree commit diff
path: root/pkgs/development/libraries/science
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/science')
-rw-r--r--pkgs/development/libraries/science/benchmark/papi/default.nix2
-rw-r--r--pkgs/development/libraries/science/biology/htslib/default.nix2
-rw-r--r--pkgs/development/libraries/science/biology/mirtk/default.nix10
-rw-r--r--pkgs/development/libraries/science/math/clmagma/default.nix75
-rw-r--r--pkgs/development/libraries/science/math/fenics/default.nix41
-rw-r--r--pkgs/development/libraries/science/math/mkl/default.nix37
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix7
-rw-r--r--pkgs/development/libraries/science/math/osi/default.nix6
8 files changed, 143 insertions, 37 deletions
diff --git a/pkgs/development/libraries/science/benchmark/papi/default.nix b/pkgs/development/libraries/science/benchmark/papi/default.nix
index 35d0914e3f76..53ae70f5bf8a 100644
--- a/pkgs/development/libraries/science/benchmark/papi/default.nix
+++ b/pkgs/development/libraries/science/benchmark/papi/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "13mngf9kl0y2wfxqvkad0smdaag7k8fvw82b4312gx62nwhc1i6r";
   };
 
-  NIX_CFLAGS_COMPILE = [ "-Wno-error=format-truncation" ];
+  NIX_CFLAGS_COMPILE = "-Wno-error=format-truncation";
 
   preConfigure = ''
     cd src
diff --git a/pkgs/development/libraries/science/biology/htslib/default.nix b/pkgs/development/libraries/science/biology/htslib/default.nix
index 0b13696ad5f8..7d771414fb01 100644
--- a/pkgs/development/libraries/science/biology/htslib/default.nix
+++ b/pkgs/development/libraries/science/biology/htslib/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--enable-libcurl" ]; # optional but strongly recommended
 
-  installFlags = "prefix=$(out)";
+  installFlags = [ "prefix=$(out)" ];
 
   preCheck = ''
     patchShebangs test/
diff --git a/pkgs/development/libraries/science/biology/mirtk/default.nix b/pkgs/development/libraries/science/biology/mirtk/default.nix
index e6c58b96e5c7..4291e11ed33f 100644
--- a/pkgs/development/libraries/science/biology/mirtk/default.nix
+++ b/pkgs/development/libraries/science/biology/mirtk/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python, vtk, zlib }:
+{ stdenv, gtest, fetchFromGitHub, cmake, boost, eigen, python, vtk, zlib, tbb }:
 
 stdenv.mkDerivation rec {
   version = "2.0.0";
@@ -12,7 +12,11 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
-  cmakeFlags = "-DWITH_VTK=ON -DBUILD_ALL_MODULES=ON";
+  cmakeFlags = [
+    "-DWITH_VTK=ON"
+    "-DBUILD_ALL_MODULES=ON"
+    "-DWITH_TBB=ON"
+  ];
 
   doCheck = true;
 
@@ -30,7 +34,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ cmake gtest ];
-  buildInputs = [ boost eigen python vtk zlib ];
+  buildInputs = [ boost eigen python vtk zlib tbb ];
 
   meta = with stdenv.lib; {
     homepage = "https://github.com/BioMedIA/MIRTK";
diff --git a/pkgs/development/libraries/science/math/clmagma/default.nix b/pkgs/development/libraries/science/math/clmagma/default.nix
new file mode 100644
index 000000000000..b5c59a83277d
--- /dev/null
+++ b/pkgs/development/libraries/science/math/clmagma/default.nix
@@ -0,0 +1,75 @@
+{ stdenv, fetchurl, gfortran, opencl-headers, clblas, ocl-icd, mkl, intel-ocl }:
+
+with stdenv.lib;
+
+let 
+  version = "1.3.0";
+  incfile = builtins.toFile "make.inc.custom" ''
+    CC        = g++
+    FORT      = gfortran
+    
+    ARCH      = ar
+    ARCHFLAGS = cr
+    RANLIB    = ranlib
+
+    OPTS      = -fPIC -O3 -DADD_ -Wall
+    FOPTS     = -fPIC -O3 -DADD_ -Wall -x f95-cpp-input
+    F77OPTS   = -fPIC -O3 -DADD_ -Wall
+    LDOPTS    = -fPIC
+   
+    -include make.check-mkl
+    -include make.check-clblas
+    
+    # Gnu mkl is not available I guess?
+    #LIB       = -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lpthread -lm -fopenmp
+    LIB        = -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lm -fopenmp
+    LIB       += -lclBLAS -lOpenCL
+    
+    LIBDIR    = -L$(MKLROOT)/lib/intel64 \
+                -L$(MKLROOT)/../compiler/lib/intel64 \
+                -L$(clBLAS)/lib64
+    
+    INC       = -I$(clBLAS)/include 
+               #-I$(AMDAPP)/include
+  '';  
+in stdenv.mkDerivation {
+  name = "clmagma-${version}";
+  src = fetchurl {
+    url = "http://icl.cs.utk.edu/projectsfiles/magma/cl/clmagma-${version}.tar.gz";
+    sha256 = "1n27ny0xhwirw2ydn46pfcwy53gzia9zbam4irx44fd4d7f9ydv7";
+    name = "clmagma-${version}.tar.gz";
+  };
+
+  buildInputs = [ 
+    gfortran 
+    clblas 
+    opencl-headers 
+    ocl-icd  
+    mkl
+    intel-ocl
+  ];
+
+  enableParallelBuilding=true;
+
+  MKLROOT   = "${mkl}";
+  clBLAS    = "${clblas}";
+
+  # Otherwise build looks for it in /run/opengl-driver/etc/OpenCL/vendors, 
+  # which is not available.
+  OPENCL_VENDOR_PATH="${intel-ocl}/etc/OpenCL/vendors";
+
+  preBuild = ''  
+    # By default it tries to use GPU, and thus fails for CPUs
+    sed -i "s/CL_DEVICE_TYPE_GPU/CL_DEVICE_TYPE_DEFAULT/" interface_opencl/clmagma_runtime.cpp   
+    sed -i "s%/usr/local/clmagma%/$out%" Makefile.internal
+    cp ${incfile} make.inc
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Matrix Algebra on GPU and Multicore Architectures, OpenCL port";
+    license = licenses.bsd3;
+    homepage = http://icl.cs.utk.edu/magma/index.html;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ volhovm ];
+  };
+}
diff --git a/pkgs/development/libraries/science/math/fenics/default.nix b/pkgs/development/libraries/science/math/fenics/default.nix
index a93ede63a263..2bb284477e6d 100644
--- a/pkgs/development/libraries/science/math/fenics/default.nix
+++ b/pkgs/development/libraries/science/math/fenics/default.nix
@@ -142,26 +142,27 @@ stdenv.mkDerivation {
     numpy pkgconfig six sphinx suitesparse sympy ufl vtk zlib
     ] ++ stdenv.lib.optionals pythonBindings [ ply python numpy swig ];
   patches = [ ./unicode.patch ];
-  cmakeFlags = "-DDOLFIN_CXX_FLAGS=-std=c++11"
-    + " -DDOLFIN_AUTO_DETECT_MPI=OFF"
-    + " -DDOLFIN_ENABLE_CHOLMOD=" + (if suitesparse != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_DOCS=" + (if docs then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_GTEST=" + (if gtest != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_HDF5=" + (if hdf5 != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_MPI=" + (if mpi != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_PARMETIS=OFF"
-    + " -DDOLFIN_ENABLE_PETSC4PY=OFF"
-    + " -DDOLFIN_ENABLE_PETSC=OFF"
-    + " -DDOLFIN_ENABLE_PYTHON=" + (if pythonBindings then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_SCOTCH=OFF"
-    + " -DDOLFIN_ENABLE_SLEPC4PY=OFF"
-    + " -DDOLFIN_ENABLE_SLEPC=OFF"
-    + " -DDOLFIN_ENABLE_SPHINX=" + (if sphinx != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_TESTING=" + (if doCheck then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_TRILINOS=OFF"
-    + " -DDOLFIN_ENABLE_UMFPACK=" + (if suitesparse != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_VTK=" + (if vtk != null then "ON" else "OFF")
-    + " -DDOLFIN_ENABLE_ZLIB=" + (if zlib != null then "ON" else "OFF");
+  cmakeFlags = [ "-DDOLFIN_CXX_FLAGS=-std=c++11"
+    "-DDOLFIN_AUTO_DETECT_MPI=OFF"
+    ("-DDOLFIN_ENABLE_CHOLMOD=" + (if suitesparse != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_DOCS=" + (if docs then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_GTEST=" + (if gtest != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_HDF5=" + (if hdf5 != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_MPI=" + (if mpi != null then "ON" else "OFF"))
+    "-DDOLFIN_ENABLE_PARMETIS=OFF"
+    "-DDOLFIN_ENABLE_PETSC4PY=OFF"
+    "-DDOLFIN_ENABLE_PETSC=OFF"
+    ("-DDOLFIN_ENABLE_PYTHON=" + (if pythonBindings then "ON" else "OFF"))
+    "-DDOLFIN_ENABLE_SCOTCH=OFF"
+    "-DDOLFIN_ENABLE_SLEPC4PY=OFF"
+    "-DDOLFIN_ENABLE_SLEPC=OFF"
+    ("-DDOLFIN_ENABLE_SPHINX=" + (if sphinx != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_TESTING=" + (if doCheck then "ON" else "OFF"))
+    "-DDOLFIN_ENABLE_TRILINOS=OFF"
+    ("-DDOLFIN_ENABLE_UMFPACK=" + (if suitesparse != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_VTK=" + (if vtk != null then "ON" else "OFF"))
+    ("-DDOLFIN_ENABLE_ZLIB=" + (if zlib != null then "ON" else "OFF"))
+  ];
   checkPhase = ''
     make runtests
   '';
diff --git a/pkgs/development/libraries/science/math/mkl/default.nix b/pkgs/development/libraries/science/math/mkl/default.nix
index 382d2c303e3c..604413c96d8a 100644
--- a/pkgs/development/libraries/science/math/mkl/default.nix
+++ b/pkgs/development/libraries/science/math/mkl/default.nix
@@ -1,4 +1,4 @@
-{ stdenvNoCC, fetchurl, rpmextract, undmg, darwin }:
+{ stdenvNoCC, fetchurl, rpmextract, undmg, darwin, enableStatic ? false }:
 /*
   For details on using mkl as a blas provider for python packages such as numpy,
   numexpr, scipy, etc., see the Python section of the NixPkgs manual.
@@ -46,12 +46,28 @@ in stdenvNoCC.mkDerivation {
       tar xzvf $f
     done
   '' else ''
-    rpmextract rpm/intel-mkl-cluster-rt-${rpm-ver}.x86_64.rpm
-    rpmextract rpm/intel-mkl-common-c-${rpm-ver}.noarch.rpm
+    # Common stuff
     rpmextract rpm/intel-mkl-core-${rpm-ver}.x86_64.rpm
+    rpmextract rpm/intel-mkl-common-c-${rpm-ver}.noarch.rpm
+    rpmextract rpm/intel-mkl-common-f-${rpm-ver}.noarch.rpm
+
+    # Dynamic libraries
+    rpmextract rpm/intel-mkl-cluster-rt-${rpm-ver}.x86_64.rpm
     rpmextract rpm/intel-mkl-core-rt-${rpm-ver}.x86_64.rpm
+    rpmextract rpm/intel-mkl-gnu-f-rt-${rpm-ver}.x86_64.rpm
+    rpmextract rpm/intel-mkl-gnu-rt-${rpm-ver}.x86_64.rpm
+
+    # Intel OpenMP runtime
     rpmextract rpm/intel-openmp-${openmp-ver}.x86_64.rpm
-  '';
+  '' + (if enableStatic then ''
+    # Static libraries
+    rpmextract rpm/intel-mkl-cluster-${rpm-ver}.x86_64.rpm
+    rpmextract rpm/intel-mkl-gnu-${rpm-ver}.x86_64.rpm
+    rpmextract rpm/intel-mkl-gnu-f-${rpm-ver}.x86_64.rpm
+  '' else ''
+    # Take care of installing dynamic-only PkgConfig files during the installPhase
+  ''
+  );
 
   installPhase = ''
     for f in $(find . -name 'mkl*.pc') ; do
@@ -80,16 +96,21 @@ in stdenvNoCC.mkDerivation {
       cp -r compilers_and_libraries_${version}/mac/mkl/bin/pkgconfig/* $out/lib/pkgconfig
   '' else ''
       mkdir -p $out/lib
+      cp license.txt $out/lib/
 
       cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/include $out/
 
+      mkdir -p $out/lib/pkgconfig
+  '') +
+    (if enableStatic then ''
       cp -r opt/intel/compilers_and_libraries_${version}/linux/compiler/lib/intel64_lin/* $out/lib/
       cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/* $out/lib/
-      cp license.txt $out/lib/
-
-      mkdir -p $out/lib/pkgconfig
       cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/bin/pkgconfig/* $out/lib/pkgconfig
-  '');
+    '' else ''
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/compiler/lib/intel64_lin/*.so* $out/lib/
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/lib/intel64_lin/*.so* $out/lib/
+      cp -r opt/intel/compilers_and_libraries_${version}/linux/mkl/bin/pkgconfig/*dynamic*.pc $out/lib/pkgconfig
+    '');
 
   # fixDarwinDylibName fails for libmkl_cdft_core.dylib because the
   # larger updated load commands do not fit. Use install_name_tool
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index f8d392691ab2..a26cf38a9d09 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -8,6 +8,7 @@
 # See https://github.com/xianyi/OpenBLAS/blob/develop/TargetList.txt
 , target ? null
 , enableStatic ? false
+, enableShared ? true
 }:
 
 with stdenv.lib;
@@ -60,7 +61,7 @@ let
       TARGET = setTarget "ATHLON";
       DYNAMIC_ARCH = true;
       NO_AVX512 = true;
-      USE_OPENMP = true;
+      USE_OPENMP = !stdenv.hostPlatform.isMusl;
     };
   };
 in
@@ -115,6 +116,9 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     perl
     which
+  ];
+
+  depsBuildBuild = [
     buildPackages.gfortran
     buildPackages.stdenv.cc
   ];
@@ -126,6 +130,7 @@ stdenv.mkDerivation rec {
     NUM_THREADS = 64;
     INTERFACE64 = blas64;
     NO_STATIC = !enableStatic;
+    NO_SHARED = !enableShared;
     CROSS = stdenv.hostPlatform != stdenv.buildPlatform;
     HOSTCC = "cc";
     # Makefile.system only checks defined status
diff --git a/pkgs/development/libraries/science/math/osi/default.nix b/pkgs/development/libraries/science/math/osi/default.nix
index 1cc80e78a100..6dc7e746fd35 100644
--- a/pkgs/development/libraries/science/math/osi/default.nix
+++ b/pkgs/development/libraries/science/math/osi/default.nix
@@ -22,10 +22,10 @@ stdenv.mkDerivation rec {
     ++ lib.optionals withCplex [ "--with-cplex-incdir=${cplex}/cplex/include/ilcplex" "--with-cplex-lib=-lcplex${cplex.libSuffix}" ];
 
   NIX_LDFLAGS =
-    lib.optional withCplex "-L${cplex}/cplex/bin/${cplex.libArch}";
+    lib.optionalString withCplex "-L${cplex}/cplex/bin/${cplex.libArch}";
 
-  # Compile errors 
-  NIX_CFLAGS_COMPILE = [ "-Wno-cast-qual" ];
+  # Compile errors
+  NIX_CFLAGS_COMPILE = "-Wno-cast-qual";
   hardeningDisable = [ "format" ];
 
   enableParallelBuilding = true;