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/math/brial/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/fenics/default.nix244
-rw-r--r--pkgs/development/libraries/science/math/fenics/unicode.patch67
-rw-r--r--pkgs/development/libraries/science/math/openblas/0001-Disable-optimised-aarch64-dgemm_beta-pending-fix.patch26
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix6
-rw-r--r--pkgs/development/libraries/science/math/petsc/default.nix34
6 files changed, 211 insertions, 172 deletions
diff --git a/pkgs/development/libraries/science/math/brial/default.nix b/pkgs/development/libraries/science/math/brial/default.nix
index 4ffe147b27f2..90d7357cc07e 100644
--- a/pkgs/development/libraries/science/math/brial/default.nix
+++ b/pkgs/development/libraries/science/math/brial/default.nix
@@ -8,14 +8,14 @@
 }:
 
 stdenv.mkDerivation rec {
-  version = "1.2.7";
+  version = "1.2.8";
   pname = "brial";
 
   src = fetchFromGitHub {
     owner = "BRiAl";
     repo = "BRiAl";
     rev = version;
-    sha256 = "1s0wmbb42sq6a5kxgzsz5srphclmfa4cvxdx2h9kzp0da2zcp3cm";
+    sha256 = "0qhgckd4fvbs40jw14mvw89rccv94d3df27kipd27hxd4cx7y80y";
   };
 
   # FIXME package boost-test and enable checks
@@ -37,7 +37,7 @@ stdenv.mkDerivation rec {
   ];
 
   meta = with stdenv.lib; {
-    homepage = https://github.com/BRiAl/BRiAl;
+    homepage = "https://github.com/BRiAl/BRiAl";
     description = "Legacy version of PolyBoRi maintained by sagemath developers";
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ timokau ];
diff --git a/pkgs/development/libraries/science/math/fenics/default.nix b/pkgs/development/libraries/science/math/fenics/default.nix
index 2bb284477e6d..e70462cd9efc 100644
--- a/pkgs/development/libraries/science/math/fenics/default.nix
+++ b/pkgs/development/libraries/science/math/fenics/default.nix
@@ -1,43 +1,42 @@
 { stdenv
 , fetchurl
+, fetchpatch
 , boost
 , cmake
 , doxygen
 , eigen
+, mpi4py
 , numpy
-, pkgconfig
+, pkg-config
+, pybind11
 , pytest
 , pythonPackages
 , six
 , sympy
-, gtest ? null
-, hdf5 ? null
-, mpi ? null
-, ply ? null
-, python ? null
-, sphinx ? null
-, suitesparse ? null
-, swig ? null
-, vtk ? null
-, zlib ? null
-, docs ? false
-, pythonBindings ? false
-, doCheck ? true }:
-
-assert pythonBindings -> python != null && ply != null && swig != null;
-
+, gtest
+, hdf5
+, mpi
+, ply
+, python
+, scotch
+, setuptools
+, sphinx
+, suitesparse
+, swig
+, zlib
+}:
 let
-  version = "2017.1.0";
+  version = "2019.1.0";
 
   dijitso = pythonPackages.buildPythonPackage {
     pname = "dijitso";
     inherit version;
     src = fetchurl {
       url = "https://bitbucket.org/fenics-project/dijitso/downloads/dijitso-${version}.tar.gz";
-      sha256 = "0mw6mynjmg6yl3l2k33yra2x84s4r6mh44ylhk9znjfk74jra8zg";
+      sha256 = "1ncgbr0bn5cvv16f13g722a0ipw6p9y6p4iasxjziwsp8kn5x97a";
     };
-    buildInputs = [ numpy six ];
-    nativeBuildInputs = [ pytest ];
+    propagatedBuildInputs = [ numpy six ];
+    checkInputs = [ pytest ];
     preCheck = ''
       export HOME=$PWD
     '';
@@ -59,11 +58,22 @@ let
     inherit version;
     src = fetchurl {
       url = "https://bitbucket.org/fenics-project/fiat/downloads/fiat-${version}.tar.gz";
-      sha256 = "156ybz70n4n7p88q4pfkvbmg1xr2ll80inzr423mki0nml0q8a6l";
+      sha256 = "1sbi0fbr7w9g9ajr565g3njxrc3qydqjy3334vmz5xg0rd3106il";
     };
-    buildInputs = [ numpy pytest six sympy ];
+    propagatedBuildInputs = [ numpy six sympy ];
+    checkInputs = [ pytest ];
+
+    preCheck = ''
+      # Workaround pytest 4.6.3 issue.
+      # See: https://bitbucket.org/fenics-project/fiat/pull-requests/59
+      rm test/unit/test_quadrature.py
+      rm test/unit/test_reference_element.py
+      rm test/unit/test_fiat.py
+    '';
     checkPhase = ''
+      runHook preCheck
       py.test test/unit/
+      runHook postCheck
     '';
     meta = {
       description = "Automatic generation of finite element basis functions";
@@ -78,11 +88,14 @@ let
     inherit version;
     src = fetchurl {
       url = "https://bitbucket.org/fenics-project/ufl/downloads/ufl-${version}.tar.gz";
-      sha256 = "13ysimmwad429fjjs07j1fw1gq196p021j7mv66hwrljyh8gm1xg";
+      sha256 = "04daxwg4y9c51sdgvwgmlc82nn0fjw7i2vzs15ckdc7dlazmcfi1";
     };
-    buildInputs = [ numpy pytest six ];
+    propagatedBuildInputs = [ numpy six ];
+    checkInputs = [ pytest ];
     checkPhase = ''
+      runHook preCheck
       py.test test/
+      runHook postCheck
     '';
     meta = {
       description = "A domain-specific language for finite element variational forms";
@@ -97,12 +110,29 @@ let
     inherit version;
     src = fetchurl {
       url = "https://bitbucket.org/fenics-project/ffc/downloads/ffc-${version}.tar.gz";
-      sha256 = "1cw7zsrjms11xrfg7x9wjd90x3w4v5s1wdwa18xqlycqz7cc8wr0";
+      sha256 = "1zdg6pziss4va74pd7jjl8sc3ya2gmhpypccmyd8p7c66ji23y2g";
     };
-    buildInputs = [ dijitso fiat numpy pytest six sympy ufl ];
-    checkPhase = ''
+    nativeBuildInputs = [
+      pybind11
+    ];
+    propagatedBuildInputs = [
+      dijitso
+      fiat
+      numpy
+      six
+      sympy
+      ufl
+      setuptools
+    ];
+    checkInputs = [ pytest ];
+    preCheck = ''
       export HOME=$PWD
+      rm test/unit/ufc/finite_element/test_evaluate.py
+    '';
+    checkPhase = ''
+      runHook preCheck
       py.test test/unit/
+      runHook postCheck
     '';
     meta = {
       description = "A compiler for finite element variational forms";
@@ -111,66 +141,118 @@ let
       license = stdenv.lib.licenses.lgpl3;
     };
   };
-
-  instant = pythonPackages.buildPythonPackage {
-    pname = "instant";
+  dolfin = stdenv.mkDerivation {
+    pname = "dolfin";
     inherit version;
     src = fetchurl {
-      url = "https://bitbucket.org/fenics-project/instant/downloads/instant-${version}.tar.gz";
-      sha256 = "1rsyh6n04w0na2zirfdcdjip8k8ikb8fc2x94fq8ylc3lpcnpx9q";
+      url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz";
+      sha256 = "0kbyi4x5f6j4zpasch0swh0ch81w2h92rqm1nfp3ydi4a93vky33";
     };
-    buildInputs = [ numpy six ];
+    patches = [
+      (fetchpatch {
+        name = "fix-double-prefix.patch";
+        url = "https://bitbucket.org/josef_kemetmueller/dolfin/commits/328e94acd426ebaf2243c072b806be3379fd4340/raw";
+        sha256 = "1zj7k3y7vsx0hz3gwwlxhq6gdqamqpcw90d4ishwx5ps5ckcsb9r";
+      })
+    ];
+    propagatedBuildInputs = [
+      dijitso
+      fiat
+      numpy
+      six
+      ufl
+    ];
+    nativeBuildInputs = [
+      cmake
+      doxygen
+      pkg-config
+    ];
+    buildInputs = [
+      boost
+      dijitso
+      eigen
+      ffc
+      fiat
+      hdf5
+      mpi
+      numpy
+      (numpy.blas)
+      ply
+      python
+      scotch
+      six
+      sphinx
+      (suitesparse.override { openblas = numpy.blas; })
+      swig
+      sympy
+      ufl
+      zlib
+    ];
+    cmakeFlags = [
+      "-DDOLFIN_CXX_FLAGS=-std=c++11"
+      "-DDOLFIN_AUTO_DETECT_MPI=ON"
+      "-DDOLFIN_ENABLE_CHOLMOD=ON"
+      "-DDOLFIN_ENABLE_DOCS=ON"
+      "-DDOLFIN_ENABLE_HDF5=ON"
+      "-DDOLFIN_ENABLE_MPI=ON"
+      "-DDOLFIN_ENABLE_SCOTCH=ON"
+      "-DDOLFIN_ENABLE_UMFPACK=ON"
+      "-DDOLFIN_ENABLE_ZLIB=ON"
+      "-DDOLFIN_SKIP_BUILD_TESTS=ON" # Otherwise SCOTCH is not found
+      # TODO: Enable the following features
+      "-DDOLFIN_ENABLE_PARMETIS=OFF"
+      "-DDOLFIN_ENABLE_PETSC=OFF"
+      "-DDOLFIN_ENABLE_SLEPC=OFF"
+      "-DDOLFIN_ENABLE_TRILINOS=OFF"
+    ];
+    installCheckPhase = ''
+      source $out/share/dolfin/dolfin.conf
+      make runtests
+    '';
     meta = {
-      description = "Instant inlining of C and C++ code in Python";
+      description = "The FEniCS Problem Solving Environment in Python and C++";
       homepage = https://fenicsproject.org/;
-      platforms = stdenv.lib.platforms.all;
       license = stdenv.lib.licenses.lgpl3;
     };
   };
+  python-dolfin = pythonPackages.buildPythonPackage rec {
+    pname = "dolfin";
+    inherit version;
+    disabled = pythonPackages.isPy27;
+    src = dolfin.src;
+    sourceRoot = "${pname}-${version}/python";
+    nativeBuildInputs = [
+      pybind11
+      cmake
+    ];
+    dontUseCmakeConfigure = true;
+    preConfigure = ''
+      export CMAKE_PREFIX_PATH=${pybind11}/share/cmake/pybind11:$CMAKE_PREFIX_PATH
+      substituteInPlace setup.py --replace "pybind11==2.2.4" "pybind11"
+      substituteInPlace dolfin/jit/jit.py \
+        --replace 'pkgconfig.exists("dolfin")' 'pkgconfig.exists("${dolfin}/lib/pkgconfig/dolfin.pc")' \
+        --replace 'pkgconfig.parse("dolfin")' 'pkgconfig.parse("${dolfin}/lib/pkgconfig/dolfin.pc")'
+    '';
+    buildInputs = [
+      dolfin
+      boost
+    ];
 
-in
-stdenv.mkDerivation {
-  pname = "dolfin";
-  inherit version;
-  src = fetchurl {
-    url = "https://bitbucket.org/fenics-project/dolfin/downloads/dolfin-${version}.tar.gz";
-    sha256 = "14hfb5q6rz79zmy742s2fiqkb9j2cgh5bsg99v76apcr84nklyds";
-  };
-  propagatedBuildInputs = [ dijitso fiat numpy six ufl ];
-  buildInputs = [
-    boost cmake dijitso doxygen eigen ffc fiat gtest hdf5 instant mpi
-    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"))
-  ];
-  checkPhase = ''
-    make runtests
-  '';
-  postInstall = "source $out/share/dolfin/dolfin.conf";
-  meta = {
-    description = "The FEniCS Problem Solving Environment in Python and C++";
-    homepage = https://fenicsproject.org/;
-    platforms = stdenv.lib.platforms.darwin;
-    license = stdenv.lib.licenses.lgpl3;
+    propagatedBuildInputs = [
+      dijitso
+      ffc
+      mpi4py
+      numpy
+      ufl
+      pythonPackages.pkgconfig
+      pythonPackages.pybind11
+    ];
+    doCheck = false; # Tries to orte_ess_init and call ssh to localhost
+    meta = {
+      description = "Python bindings for the DOLFIN FEM compiler";
+      homepage = https://fenicsproject.org/;
+      platforms = stdenv.lib.platforms.all;
+      license = stdenv.lib.licenses.lgpl3;
+    };
   };
-}
+in python-dolfin
diff --git a/pkgs/development/libraries/science/math/fenics/unicode.patch b/pkgs/development/libraries/science/math/fenics/unicode.patch
deleted file mode 100644
index 2ef2709263ab..000000000000
--- a/pkgs/development/libraries/science/math/fenics/unicode.patch
+++ /dev/null
@@ -1,67 +0,0 @@
-From 0cc9e68de1181d950d4185bf3a87b69a87e4358f Mon Sep 17 00:00:00 2001
-From: "James D. Trotter" <james@simula.no>
-Date: Mon, 14 Aug 2017 16:43:53 +0200
-Subject: [PATCH] Use a UTF-8 encoding to avoid errors with decoding non-ascii
- characters
-
----
- cmake/scripts/generate-swig-interface.py |  6 +++---
- utils/pylit/pylit.py                     | 10 +++++++---
- 2 files changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/cmake/scripts/generate-swig-interface.py b/cmake/scripts/generate-swig-interface.py
-index 843a49229..7b85453d0 100644
---- a/cmake/scripts/generate-swig-interface.py
-+++ b/cmake/scripts/generate-swig-interface.py
-@@ -212,10 +212,10 @@ def extract_swig_modules_dependencies(module_to_submodules, submodule_info):
-                     continue
- 
-                 # Read code
--                with open(header_file) as f:
--                    code = f.read()
--
-                 try:
-+                    with open(header_file, encoding='utf-8') as f:
-+                        code = f.read()
-+
-                     # Extract type info
-                     used_types, declared_types = parse_and_extract_type_info(code)
-                 except Exception as e:
-diff --git a/utils/pylit/pylit.py b/utils/pylit/pylit.py
-index bcd8ec5e0..8c2964fbd 100755
---- a/utils/pylit/pylit.py
-+++ b/utils/pylit/pylit.py
-@@ -1496,7 +1496,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw):
-     if infile == '-':
-         in_stream = sys.stdin
-     else:
--        in_stream = open(infile, 'r')
-+        in_stream = open(infile, 'r', encoding='utf-8')
- 
-     if outfile == '-':
-         out_stream = sys.stdout
-@@ -1505,7 +1505,7 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw):
-     elif overwrite == 'update' and is_newer(outfile, infile):
-         raise IOError((1, "Output file is newer than input file!", outfile))
-     else:
--        out_stream = open(outfile, 'w')
-+        out_stream = open(outfile, 'w', encoding='utf-8')
-     return (in_stream, out_stream)
- 
- # is_newer
-@@ -1731,7 +1731,11 @@ def main(args=sys.argv[1:], **defaults):
- 
- # Convert and write to out_stream::
- 
--    out_stream.write(str(converter))
-+    try:
-+        out_stream.write(str(converter))
-+    except Exception as e:
-+        print("Failed to write extract to", out_stream.name)
-+        raise
- 
-     if out_stream is not sys.stdout:
-         print("extract written to", out_stream.name)
--- 
-2.14.0
-
diff --git a/pkgs/development/libraries/science/math/openblas/0001-Disable-optimised-aarch64-dgemm_beta-pending-fix.patch b/pkgs/development/libraries/science/math/openblas/0001-Disable-optimised-aarch64-dgemm_beta-pending-fix.patch
new file mode 100644
index 000000000000..1da1f3fb3190
--- /dev/null
+++ b/pkgs/development/libraries/science/math/openblas/0001-Disable-optimised-aarch64-dgemm_beta-pending-fix.patch
@@ -0,0 +1,26 @@
+From 6cb9aa7c69c20a677ca9fb1bc5fa1580e3236fbd Mon Sep 17 00:00:00 2001
+From: Tom Hall <tahall256@protonmail.ch>
+Date: Sat, 14 Mar 2020 11:55:45 +0000
+Subject: [PATCH] Disable optimised aarch64 dgemm_beta pending fix
+
+Identified as source of https://github.com/xianyi/OpenBLAS/issues/2496,
+but not yet fixed.
+---
+ kernel/arm64/KERNEL.ARMV8 | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/kernel/arm64/KERNEL.ARMV8 b/kernel/arm64/KERNEL.ARMV8
+index fe32d313..33d12f94 100644
+--- a/kernel/arm64/KERNEL.ARMV8
++++ b/kernel/arm64/KERNEL.ARMV8
+@@ -102,7 +102,6 @@ CDOTKERNEL     = zdot.S
+ ZDOTKERNEL     = zdot.S
+ DSDOTKERNEL    = dot.S
+ 
+-DGEMM_BETA     = dgemm_beta.S
+ SGEMM_BETA     = sgemm_beta.S
+ 
+ SGEMMKERNEL    =  sgemm_kernel_$(SGEMM_UNROLL_M)x$(SGEMM_UNROLL_N).S
+-- 
+2.24.1
+
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index 9c411234357a..38ad31cc6257 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -123,6 +123,12 @@ stdenv.mkDerivation rec {
     buildPackages.stdenv.cc
   ];
 
+  # Disable an optimisation which seems to cause issues, pending an
+  # upstream fix: https://github.com/xianyi/OpenBLAS/issues/2496
+  patches = stdenv.lib.optionals stdenv.hostPlatform.isAarch64 [
+    ./0001-Disable-optimised-aarch64-dgemm_beta-pending-fix.patch
+  ];
+
   makeFlags = mkMakeFlagsFromConfig (config // {
     FC = "${stdenv.cc.targetPrefix}gfortran";
     CC = "${stdenv.cc.targetPrefix}${if stdenv.cc.isClang then "clang" else "cc"}";
diff --git a/pkgs/development/libraries/science/math/petsc/default.nix b/pkgs/development/libraries/science/math/petsc/default.nix
index c2eda9dac48b..492ad63f27b6 100644
--- a/pkgs/development/libraries/science/math/petsc/default.nix
+++ b/pkgs/development/libraries/science/math/petsc/default.nix
@@ -1,17 +1,12 @@
-{ stdenv
-, fetchurl
-, blas
-, gfortran
-, liblapack
-, python }:
+{ stdenv , fetchurl , blas , gfortran , liblapack , python }:
 
 stdenv.mkDerivation rec {
   pname = "petsc";
-  version = "3.8.4";
+  version = "3.12.4";
 
   src = fetchurl {
     url = "http://ftp.mcs.anl.gov/pub/petsc/release-snapshots/petsc-${version}.tar.gz";
-    sha256 = "1iy49gagxncx09d88kxnwkj876p35683mpfk33x37165si6xqy4z";
+    sha256 = "1hw4f12v2xwrs37gjh83dbixhg0yxandqx7s7k5vlfx91l9l3aan";
   };
 
   nativeBuildInputs = [ blas gfortran.cc.lib liblapack python ];
@@ -26,7 +21,7 @@ stdenv.mkDerivation rec {
     configureFlagsArray=(
       $configureFlagsArray
       "--CC=$CC"
-      "--with-cxx=0"
+      "--with-cxx=g++"
       "--with-fc=0"
       "--with-mpi=0"
       "--with-blas-lib=[${blas}/lib/libblas.a,${gfortran.cc.lib}/lib/libgfortran.a]"
@@ -34,17 +29,14 @@ stdenv.mkDerivation rec {
     )
   '';
 
-  postInstall = ''
-    rm $out/bin/petscmpiexec
-    rm $out/bin/popup
-    rm $out/bin/uncrustify.cfg
-    rm -rf $out/bin/win32fe
-  '';
-
-  meta = {
-    description = "Library of linear algebra algorithms for solving partial differential equations";
-    homepage = https://www.mcs.anl.gov/petsc/index.html;
-    platforms = stdenv.lib.platforms.all;
-    license = stdenv.lib.licenses.bsd2;
+  meta = with stdenv.lib; {
+    description = ''
+      Library of linear algebra algorithms for solving partial differential
+      equations
+    '';
+    homepage = "https://www.mcs.anl.gov/petsc/index.html";
+    license = licenses.bsd2;
+    maintainers = with maintainers; [ wucke13 ];
+    platforms = platforms.all;
   };
 }