From 1c8aba83340be3713f68410d1d273a8b15e7e007 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Tue, 31 Mar 2020 10:47:18 -0400 Subject: treewide: use blas and lapack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes packages use lapack and blas, which can wrap different BLAS/LAPACK implementations. treewide: cleanup from blas/lapack changes A few issues in the original treewide: - can’t assume blas64 is a bool - unused commented code --- pkgs/applications/science/math/R/default.nix | 10 ++++++---- pkgs/applications/science/math/caffe/default.nix | 4 ++-- pkgs/applications/science/math/calculix/calculix.patch | 2 +- pkgs/applications/science/math/calculix/default.nix | 4 ++-- pkgs/applications/science/math/cntk/default.nix | 3 ++- pkgs/applications/science/math/csdp/default.nix | 4 ++-- pkgs/applications/science/math/getdp/default.nix | 4 ++-- pkgs/applications/science/math/giac/default.nix | 6 +++--- pkgs/applications/science/math/gmsh/default.nix | 6 ++++-- pkgs/applications/science/math/jags/default.nix | 6 +++--- pkgs/applications/science/math/mxnet/default.nix | 6 +++--- pkgs/applications/science/math/sage/sage-env.nix | 7 +++++-- pkgs/applications/science/math/sage/sage-with-env.nix | 8 ++++++-- pkgs/applications/science/math/sage/sagelib.nix | 8 ++++++-- 14 files changed, 47 insertions(+), 31 deletions(-) (limited to 'pkgs/applications/science/math') diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix index 3ee62fad44d..836ce004fff 100644 --- a/pkgs/applications/science/math/R/default.nix +++ b/pkgs/applications/science/math/R/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, bzip2, gfortran, libX11, libXmu, libXt, libjpeg, libpng , libtiff, ncurses, pango, pcre, perl, readline, tcl, texLive, tk, xz, zlib -, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, openblas +, less, texinfo, graphviz, icu, pkgconfig, bison, imake, which, jdk, blas, lapack , curl, Cocoa, Foundation, libobjc, libcxx, tzdata, fetchpatch , withRecommendedPackages ? true , enableStrictBarrier ? false @@ -9,6 +9,8 @@ , static ? false }: +assert (!blas.is64bit) && (!lapack.is64bit); + stdenv.mkDerivation rec { name = "R-3.6.3"; @@ -22,7 +24,7 @@ stdenv.mkDerivation rec { buildInputs = [ bzip2 gfortran libX11 libXmu libXt libXt libjpeg libpng libtiff ncurses pango pcre perl readline texLive xz zlib less texinfo graphviz icu - pkgconfig bison imake which openblas curl tcl tk jdk + pkgconfig bison imake which blas lapack curl tcl tk jdk ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation libobjc libcxx ]; patches = [ @@ -43,8 +45,8 @@ stdenv.mkDerivation rec { configureFlagsArray=( --disable-lto --with${stdenv.lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages - --with-blas="-L${openblas}/lib -lopenblas" - --with-lapack="-L${openblas}/lib -lopenblas" + --with-blas="-L${blas}/lib -lblas" + --with-lapack="-L${lapack}/lib -llapack" --with-readline --with-tcltk --with-tcl-config="${tcl}/lib/tclConfig.sh" --with-tk-config="${tk}/lib/tkConfig.sh" --with-cairo diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix index ea87c4953ee..4a6a2dc6c7e 100644 --- a/pkgs/applications/science/math/caffe/default.nix +++ b/pkgs/applications/science/math/caffe/default.nix @@ -9,7 +9,7 @@ , opencv3 , protobuf , doxygen -, openblas +, blas , Accelerate, CoreGraphics, CoreVideo , lmdbSupport ? true, lmdb , leveldbSupport ? true, leveldb, snappy @@ -63,7 +63,7 @@ stdenv.mkDerivation rec { ++ ["-DUSE_LEVELDB=${toggle leveldbSupport}"] ++ ["-DUSE_LMDB=${toggle lmdbSupport}"]; - buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 openblas ] + buildInputs = [ boost gflags glog protobuf hdf5-cpp opencv3 blas ] ++ lib.optional cudaSupport cudatoolkit ++ lib.optional cudnnSupport cudnn ++ lib.optional lmdbSupport lmdb diff --git a/pkgs/applications/science/math/calculix/calculix.patch b/pkgs/applications/science/math/calculix/calculix.patch index 311421f2ef5..5b8f492a8e7 100644 --- a/pkgs/applications/science/math/calculix/calculix.patch +++ b/pkgs/applications/science/math/calculix/calculix.patch @@ -15,7 +15,7 @@ index 9cab2fc..6e977b8 100755 OCCXMAIN = $(SCCXMAIN:.c=.o) -DIR=../../../SPOOLES.2.2 -+LIBS = -lpthread -lm -lc -lspooles -larpack -lopenblas ++LIBS = -lpthread -lm -lc -lspooles -larpack -lblas -llapack -LIBS = \ - $(DIR)/spooles.a \ diff --git a/pkgs/applications/science/math/calculix/default.nix b/pkgs/applications/science/math/calculix/default.nix index 6f2d61cd80f..44882594550 100644 --- a/pkgs/applications/science/math/calculix/default.nix +++ b/pkgs/applications/science/math/calculix/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, gfortran, arpack, spooles, openblas }: +{ stdenv, fetchurl, gfortran, arpack, spooles, blas, lapack }: stdenv.mkDerivation rec { pname = "calculix"; @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ gfortran ]; - buildInputs = [ arpack spooles openblas ]; + buildInputs = [ arpack spooles blas lapack ]; NIX_CFLAGS_COMPILE = "-I${spooles}/include/spooles"; diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix index e2db40a402e..401454a6b69 100644 --- a/pkgs/applications/science/math/cntk/default.nix +++ b/pkgs/applications/science/math/cntk/default.nix @@ -1,11 +1,12 @@ { lib, stdenv, fetchgit, fetchFromGitHub, cmake -, openblas, opencv3, libzip, boost, protobuf, openmpi +, openblas, blas, lapack, opencv3, libzip, boost, protobuf, openmpi , onebitSGDSupport ? false , cudaSupport ? false, addOpenGLRunpath, cudatoolkit, nvidia_x11 , cudnnSupport ? cudaSupport, cudnn }: assert cudnnSupport -> cudaSupport; +assert blas.implementation == "openblas" && lapack.implementation == "openblas"; let # Old specific version required for CNTK. diff --git a/pkgs/applications/science/math/csdp/default.nix b/pkgs/applications/science/math/csdp/default.nix index eef60829f8e..ef9d5e733ca 100644 --- a/pkgs/applications/science/math/csdp/default.nix +++ b/pkgs/applications/science/math/csdp/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchurl, blas, gfortran, liblapack }: +{ lib, stdenv, fetchurl, blas, gfortran, lapack }: stdenv.mkDerivation { name = "csdp-6.1.1"; @@ -8,7 +8,7 @@ stdenv.mkDerivation { sha256 = "1f9ql6cjy2gwiyc51ylfan24v1ca9sjajxkbhszlds1lqmma8n05"; }; - buildInputs = [ blas gfortran.cc.lib liblapack ]; + buildInputs = [ blas gfortran.cc.lib lapack ]; postPatch = '' substituteInPlace Makefile --replace /usr/local/bin $out/bin diff --git a/pkgs/applications/science/math/getdp/default.nix b/pkgs/applications/science/math/getdp/default.nix index 0ac2ea7d1b3..ae93e89f141 100644 --- a/pkgs/applications/science/math/getdp/default.nix +++ b/pkgs/applications/science/math/getdp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, gfortran, openblas, openmpi, petsc, python3 }: +{ stdenv, fetchurl, cmake, gfortran, blas, lapack, openmpi, petsc, python3 }: stdenv.mkDerivation rec { name = "getdp-${version}"; @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ cmake gfortran ]; - buildInputs = [ openblas openmpi petsc python3 ]; + buildInputs = [ blas lapack openmpi petsc python3 ]; meta = with stdenv.lib; { description = "A General Environment for the Treatment of Discrete Problems"; diff --git a/pkgs/applications/science/math/giac/default.nix b/pkgs/applications/science/math/giac/default.nix index b3777528ecd..feb30b990ab 100644 --- a/pkgs/applications/science/math/giac/default.nix +++ b/pkgs/applications/science/math/giac/default.nix @@ -1,5 +1,5 @@ -{ stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, liblapack -, gmp, mpfr, pari, ntl, gsl, blas, mpfi, ecm, glpk, nauty +{ stdenv, lib, fetchurl, fetchpatch, texlive, bison, flex, lapack, blas +, gmp, mpfr, pari, ntl, gsl, mpfi, ecm, glpk, nauty , readline, gettext, libpng, libao, gfortran, perl , enableGUI ? false, libGL ? null, libGLU ? null, xorg ? null, fltk ? null }: @@ -41,7 +41,7 @@ stdenv.mkDerivation rec { # gfortran.cc default output contains static libraries compiled without -fPIC # we want libgfortran.so.3 instead (stdenv.lib.getLib gfortran.cc) - liblapack + lapack blas ] ++ stdenv.lib.optionals enableGUI [ libGL libGLU fltk xorg.libX11 ]; diff --git a/pkgs/applications/science/math/gmsh/default.nix b/pkgs/applications/science/math/gmsh/default.nix index 2c4d5f254da..8ece2e7819c 100644 --- a/pkgs/applications/science/math/gmsh/default.nix +++ b/pkgs/applications/science/math/gmsh/default.nix @@ -1,6 +1,8 @@ -{ stdenv, fetchurl, cmake, openblasCompat, gfortran, gmm, fltk, libjpeg +{ stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg , zlib, libGL, libGLU, xorg, opencascade-occt }: +assert (!blas.is64bit) && (!lapack.is64bit); + stdenv.mkDerivation rec { pname = "gmsh"; version = "4.5.6"; @@ -10,7 +12,7 @@ stdenv.mkDerivation rec { sha256 = "0gs65bgr1ph5lz7r6manqj8cra30s7c94pxilkd2z0p5vq6fpsj6"; }; - buildInputs = [ openblasCompat gmm fltk libjpeg zlib libGLU libGL + buildInputs = [ blas lapack gmm fltk libjpeg zlib libGLU libGL libGLU xorg.libXrender xorg.libXcursor xorg.libXfixes xorg.libXext xorg.libXft xorg.libXinerama xorg.libX11 xorg.libSM xorg.libICE opencascade-occt diff --git a/pkgs/applications/science/math/jags/default.nix b/pkgs/applications/science/math/jags/default.nix index 5ac1594e19a..122c6288847 100644 --- a/pkgs/applications/science/math/jags/default.nix +++ b/pkgs/applications/science/math/jags/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, gfortran, openblas}: +{stdenv, fetchurl, gfortran, blas, lapack}: stdenv.mkDerivation rec { name = "JAGS-4.3.0"; @@ -6,8 +6,8 @@ stdenv.mkDerivation rec { url = "mirror://sourceforge/mcmc-jags/${name}.tar.gz"; sha256 = "1z3icccg2ic56vmhyrpinlsvpq7kcaflk1731rgpvz9bk1bxvica"; }; - buildInputs = [gfortran openblas]; - configureFlags = [ "--with-blas=-lopenblas" "--with-lapack=-lopenblas" ]; + buildInputs = [gfortran blas lapack]; + configureFlags = [ "--with-blas=-lblas" "--with-lapack=-llapack" ]; meta = with stdenv.lib; { description = "Just Another Gibbs Sampler"; diff --git a/pkgs/applications/science/math/mxnet/default.nix b/pkgs/applications/science/math/mxnet/default.nix index 5b7688f6051..87d46850f14 100644 --- a/pkgs/applications/science/math/mxnet/default.nix +++ b/pkgs/applications/science/math/mxnet/default.nix @@ -1,5 +1,5 @@ { config, stdenv, lib, fetchurl, bash, cmake -, opencv3, gtest, openblas, liblapack, perl +, opencv3, gtest, blas, perl , cudaSupport ? config.cudaSupport or false, cudatoolkit, nvidia_x11 , cudnnSupport ? cudaSupport, cudnn }: @@ -17,7 +17,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake perl ]; - buildInputs = [ opencv3 gtest openblas liblapack ] + buildInputs = [ opencv3 gtest blas ] ++ lib.optionals cudaSupport [ cudatoolkit nvidia_x11 ] ++ lib.optional cudnnSupport cudnn; @@ -34,7 +34,7 @@ stdenv.mkDerivation rec { substituteInPlace 3rdparty/mkldnn/tests/CMakeLists.txt \ --replace "/bin/bash" "${bash}/bin/bash" - # Build against the system version of OpenMP. + # Build against the system version of OpenMP. # https://github.com/apache/incubator-mxnet/pull/12160 rm -rf 3rdparty/openmp ''; diff --git a/pkgs/applications/science/math/sage/sage-env.nix b/pkgs/applications/science/math/sage/sage-env.nix index 68e0d134ace..c0dfeef1119 100644 --- a/pkgs/applications/science/math/sage/sage-env.nix +++ b/pkgs/applications/science/math/sage/sage-env.nix @@ -41,7 +41,8 @@ , lcalc , rubiks , flintqs -, openblasCompat +, blas +, lapack , flint , gmp , mpfr @@ -53,6 +54,8 @@ , less }: +assert (!blas.is64bit) && (!lapack.is64bit); + # This generates a `sage-env` shell file that will be sourced by sage on startup. # It sets up various environment variables, telling sage where to find its # dependencies. @@ -114,7 +117,7 @@ writeTextFile rec { # testsuite instead, but since all the packages are also runtime # dependencies it doesn't really hurt to include them here. singular - openblasCompat + blas lapack fflas-ffpack givaro gd libpng zlib diff --git a/pkgs/applications/science/math/sage/sage-with-env.nix b/pkgs/applications/science/math/sage/sage-with-env.nix index 524085e8c01..77bc65c2be1 100644 --- a/pkgs/applications/science/math/sage/sage-with-env.nix +++ b/pkgs/applications/science/math/sage/sage-with-env.nix @@ -2,7 +2,8 @@ , lib , makeWrapper , sage-env -, openblasCompat +, blas +, lapack , pkg-config , three , singular @@ -21,6 +22,9 @@ , pythonEnv }: +# lots of segfaults with (64 bit) blas +assert (!blas.is64bit) && (!lapack.is64bit); + # Wrapper that combined `sagelib` with `sage-env` to produce an actually # executable sage. No tests are run yet and no documentation is built. @@ -29,7 +33,7 @@ let pythonEnv # for patchShebangs makeWrapper pkg-config - openblasCompat # lots of segfaults with regular (64 bit) openblas + blas lapack singular three pynac diff --git a/pkgs/applications/science/math/sage/sagelib.nix b/pkgs/applications/science/math/sage/sagelib.nix index 69f7624078e..92b4e8efa2e 100644 --- a/pkgs/applications/science/math/sage/sagelib.nix +++ b/pkgs/applications/science/math/sage/sagelib.nix @@ -3,7 +3,8 @@ , perl , buildPythonPackage , arb -, openblasCompat +, blas +, lapack , brial , cliquer , cypari2 @@ -52,6 +53,8 @@ , pplpy }: +assert (!blas.is64bit) && (!lapack.is64bit); + # This is the core sage python package. Everything else is just wrappers gluing # stuff together. It is not very useful on its own though, since it will not # find many of its dependencies without `sage-env`, will not be tested without @@ -103,7 +106,8 @@ buildPythonPackage rec { m4rie mpfi ntl - openblasCompat + blas + lapack pari planarity ppl -- cgit 1.4.1