From 14ee766024a7d1cf97e215c66d2193012ee346ca Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 18:15:50 -0500 Subject: [PATCH 01/43] openblas: set NUM_THREADS and USE_OPENMP --- pkgs/development/libraries/science/math/openblas/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 67d95f97e074..0597cbae77ae 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -14,6 +14,8 @@ let local = config.openblas.preferLocalBuild or false; "DYNAMIC_ARCH=1" "NUM_THREADS=64" "BINARY=${binary}" + "USE_OPENMP=1" + "NUM_THREADS=64" ]; localFlags = config.openblas.flags or optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ]; From 86fb034008b007e4e9a4a595f6d789e105958772 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 18:16:06 -0500 Subject: [PATCH 02/43] openblas: build with native-width integers by default --- .../science/math/openblas/default.nix | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index 0597cbae77ae..ef76c33fb6d5 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -1,24 +1,24 @@ -{ stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils }: +{ stdenv, fetchurl, gfortran, perl, liblapack, config, coreutils +# Most packages depending on openblas expect integer width to match pointer width, +# but some expect to use 32-bit integers always (for compatibility with reference BLAS). +, blas64 ? null +}: with stdenv.lib; let local = config.openblas.preferLocalBuild or false; binary = - { - i686-linux = "32"; + { i686-linux = "32"; x86_64-linux = "64"; x86_64-darwin = "64"; }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); genericFlags = - [ - "DYNAMIC_ARCH=1" - "NUM_THREADS=64" - "BINARY=${binary}" - "USE_OPENMP=1" + [ "DYNAMIC_ARCH=1" "NUM_THREADS=64" ]; localFlags = config.openblas.flags or optionals (hasAttr "target" config.openblas) [ "TARGET=${config.openblas.target}" ]; + blas64Orig = blas64; in stdenv.mkDerivation rec { version = "0.2.14"; @@ -45,9 +45,13 @@ stdenv.mkDerivation rec { # thus is not an explicit dependency. "CC=${if stdenv.isDarwin then "clang" else "gcc"}" ''PREFIX="''$(out)"'' - "INTERFACE64=1" + "BINARY=${binary}" + "USE_OPENMP=1" + "INTERFACE64=${if blas64 then "1" else "0"}" ]; + blas64 = if blas64Orig != null then blas64Orig else hasPrefix "x86_64" stdenv.system; + meta = with stdenv.lib; { description = "Basic Linear Algebra Subprograms"; license = licenses.bsd3; From a376a68f74eebeeee85e5f7a876d14f449623a17 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 06:27:20 -0500 Subject: [PATCH 03/43] openblas: add openblasCompat openblasCompat uses 32-bit integers on all platforms for compatibility with standard BLAS and LAPACK. --- pkgs/top-level/all-packages.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 6b54674cb656..076e34b263c3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13877,6 +13877,10 @@ let liblapack = liblapack_3_5_0; }; + # A version of OpenBLAS using 32-bit integers on all platforms for compatibility with + # standard BLAS and LAPACK. + openblasCompat = openblas.override { blas64 = false; }; + mathematica = callPackage ../applications/science/math/mathematica { }; mathematica9 = callPackage ../applications/science/math/mathematica/9.nix { }; From a0a5fb46ff889be6b5c66521a896f3e206d76e36 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 06:27:57 -0500 Subject: [PATCH 04/43] openblas: use default liblapack --- pkgs/top-level/all-packages.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 076e34b263c3..0e74825b67d3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13873,9 +13873,7 @@ let liblbfgs = callPackage ../development/libraries/science/math/liblbfgs { }; - openblas = callPackage ../development/libraries/science/math/openblas { - liblapack = liblapack_3_5_0; - }; + openblas = callPackage ../development/libraries/science/math/openblas { }; # A version of OpenBLAS using 32-bit integers on all platforms for compatibility with # standard BLAS and LAPACK. From b4eb8a5bc32c99b8ee7c3fcd2d414ce10d39b437 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 06:28:37 -0500 Subject: [PATCH 05/43] openblas: remove old expressions --- .../science/math/openblas/0.2.10.nix | 37 ------------------- .../libraries/science/math/openblas/0.2.2.nix | 37 ------------------- 2 files changed, 74 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/openblas/0.2.10.nix delete mode 100644 pkgs/development/libraries/science/math/openblas/0.2.2.nix diff --git a/pkgs/development/libraries/science/math/openblas/0.2.10.nix b/pkgs/development/libraries/science/math/openblas/0.2.10.nix deleted file mode 100644 index ec4422ce8951..000000000000 --- a/pkgs/development/libraries/science/math/openblas/0.2.10.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv, fetchurl, gfortran, perl, liblapack, config }: - -let local = config.openblas.preferLocalBuild or false; - localTarget = config.openblas.target or ""; -in -stdenv.mkDerivation rec { - version = "0.2.10"; - - name = "openblas-${version}"; - src = fetchurl { - url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}"; - sha256 = "06i0q4qnd5q5xljzrgvda0gjsczc6l2pl9hw6dn2qjpw38al73za"; - name = "openblas-${version}.tar.gz"; - }; - - preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz"; - - buildInputs = [gfortran perl]; - - cpu = builtins.head (stdenv.lib.splitString "-" stdenv.system); - - target = if local then localTarget else - if cpu == "i686" then "P2" else - if cpu == "x86_64" then "CORE2" else - # allow autodetect - ""; - - makeFlags = "${if target != "" then "TARGET=" else ""}${target} FC=gfortran CC=cc PREFIX=\"\$(out)\" INTERFACE64=1"; - - meta = with stdenv.lib; { - description = "Basic Linear Algebra Subprograms"; - license = licenses.bsd3; - homepage = "https://github.com/xianyi/OpenBLAS"; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ ttuegel ]; - }; -} diff --git a/pkgs/development/libraries/science/math/openblas/0.2.2.nix b/pkgs/development/libraries/science/math/openblas/0.2.2.nix deleted file mode 100644 index c476dac955ad..000000000000 --- a/pkgs/development/libraries/science/math/openblas/0.2.2.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ stdenv, fetchurl, gfortran, perl, liblapack, config }: - -let local = config.openblas.preferLocalBuild or false; - localTarget = config.openblas.target or ""; -in -stdenv.mkDerivation rec { - version = "0.2.2"; - - name = "openblas-${version}"; - src = fetchurl { - url = "https://github.com/xianyi/OpenBLAS/tarball/v${version}"; - sha256 = "13kdx3knff5ajnmgn419g0dnh83plin07p7akwamr3v7z5qfrzqr"; - name = "openblas-${version}.tar.gz"; - }; - - preBuild = "cp ${liblapack.src} lapack-${liblapack.meta.version}.tgz"; - - buildInputs = [gfortran perl]; - - cpu = builtins.head (stdenv.lib.splitString "-" stdenv.system); - - target = if local then localTarget else - if cpu == "i686" then "P2" else - if cpu == "x86_64" then "CORE2" else - # allow autodetect - ""; - - makeFlags = "${if target != "" then "TARGET=" else ""}${target} FC=gfortran CC=cc PREFIX=\"\$(out)\""; - - meta = with stdenv.lib; { - description = "Basic Linear Algebra Subprograms"; - license = licenses.bsd3; - homepage = "https://github.com/xianyi/OpenBLAS"; - platforms = [ "x86_64-linux" ]; - maintainers = with maintainers; [ ttuegel ]; - }; -} From 982aabc5617f144626a108fa6dc57bdcb9592e87 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 17:31:34 -0500 Subject: [PATCH 06/43] suitesparse_4_2: build with openblas Compared to ATLAS, OpenBLAS offers better performance, faster builds, and dynamic architecture detection. --- .../science/math/suitesparse/4.2.nix | 34 +++++++++++++++---- .../math/suitesparse/disable-metis.patch | 18 ---------- 2 files changed, 28 insertions(+), 24 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/suitesparse/disable-metis.patch diff --git a/pkgs/development/libraries/science/math/suitesparse/4.2.nix b/pkgs/development/libraries/science/math/suitesparse/4.2.nix index 4d27701b135a..16174a80212f 100644 --- a/pkgs/development/libraries/science/math/suitesparse/4.2.nix +++ b/pkgs/development/libraries/science/math/suitesparse/4.2.nix @@ -1,22 +1,44 @@ -{ stdenv, fetchurl, blas, liblapack, gfortran } : +{ stdenv, fetchurl, gfortran, openblas }: + +let + int_t = if openblas.blas64 then "int64_t" else "int32_t"; +in stdenv.mkDerivation rec { version = "4.2.1"; name = "suitesparse-${version}"; src = fetchurl { url = "http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-${version}.tar.gz" ; - sha256 = "1ga69637x7kdkiy3w3lq9dvva7220bdangv2lch2wx1hpi83h0p8"; + sha256 = "1ga69637x7kdkiy3w3lq9dvva7220bdangv2lch2wx1hpi83h0p8"; }; - buildInputs = [blas liblapack gfortran] ; - patches = [./disable-metis.patch]; + + nativeBuildInputs = [ gfortran ]; + buildInputs = [ openblas ]; preConfigure = '' - export PREFIX=$out mkdir -p $out/lib mkdir -p $out/include + + sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ + -e 's/METIS .*$/METIS =/' \ + -e 's/METIS_PATH .*$/METIS_PATH =/' \ + -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \ + -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/' ''; - makeFlags = ''PREFIX=\"$(out)\" INSTALL_LIB=$(out)/lib INSTALL_INCLUDE=$(out)/include''; + makeFlags = [ + "PREFIX=\"$(out)\"" + "INSTALL_LIB=$(out)/lib" + "INSTALL_INCLUDE=$(out)/include" + "BLAS=-lopenblas" + "LAPACK=" + ]; NIX_CFLAGS = "-fPIC"; + meta = with stdenv.lib; { + homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html; + description = "A suite of sparse matrix algorithms"; + license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ]; + maintainers = with maintainers; [ ttuegel ]; + }; } diff --git a/pkgs/development/libraries/science/math/suitesparse/disable-metis.patch b/pkgs/development/libraries/science/math/suitesparse/disable-metis.patch deleted file mode 100644 index 5b735eb7d3c9..000000000000 --- a/pkgs/development/libraries/science/math/suitesparse/disable-metis.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff -Nrc SuiteSparse/UMFPACK/Demo/Makefile SuiteSparse-new/UMFPACK/Demo/Makefile -*** SuiteSparse/UMFPACK/Demo/Makefile 2009-11-11 21:09:45.000000000 +0100 ---- SuiteSparse-new/UMFPACK/Demo/Makefile 2010-08-02 12:53:16.000000000 +0200 -*************** -*** 40,46 **** - ../../CAMD/Lib/libcamd.a: - ( cd ../../CAMD ; $(MAKE) library ) - -- $(METIS): -- ( cd $(METIS_PATH) && $(MAKE) ) - - UMFPACK = ../Lib/libumfpack.a ../../AMD/Lib/libamd.a \ ---- 40,44 ---- - ../../CAMD/Lib/libcamd.a: - ( cd ../../CAMD ; $(MAKE) library ) - - - UMFPACK = ../Lib/libumfpack.a ../../AMD/Lib/libamd.a \ From b02f300c445296c9580d9ccd1d7000a09ac10b0d Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 17:33:11 -0500 Subject: [PATCH 07/43] suitesparse_4_4_1: build with openblas Compared to ATLAS, OpenBLAS offers better performance, faster builds, and dynamic architecture detection. --- .../math/suitesparse/0001-disable-metis.patch | 36 ------------------ .../science/math/suitesparse/default.nix | 38 +++++++++++-------- 2 files changed, 23 insertions(+), 51 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/suitesparse/0001-disable-metis.patch diff --git a/pkgs/development/libraries/science/math/suitesparse/0001-disable-metis.patch b/pkgs/development/libraries/science/math/suitesparse/0001-disable-metis.patch deleted file mode 100644 index b0f7715f755d..000000000000 --- a/pkgs/development/libraries/science/math/suitesparse/0001-disable-metis.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 456b26d0c9101adaa5876954baac0ca0e872dab6 Mon Sep 17 00:00:00 2001 -From: Thomas Tuegel -Date: Mon, 15 Dec 2014 10:18:01 -0600 -Subject: [PATCH 1/3] disable metis - ---- - SuiteSparse_config/SuiteSparse_config.mk | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/SuiteSparse_config/SuiteSparse_config.mk b/SuiteSparse_config/SuiteSparse_config.mk -index ba2da23..e1514bf 100644 ---- a/SuiteSparse_config/SuiteSparse_config.mk -+++ b/SuiteSparse_config/SuiteSparse_config.mk -@@ -212,8 +212,8 @@ XERBLA = - # The path is relative to where it is used, in CHOLMOD/Lib, CHOLMOD/MATLAB, etc. - # You may wish to use an absolute path. METIS is optional. Compile - # CHOLMOD with -DNPARTITION if you do not wish to use METIS. --METIS_PATH = ../../metis-4.0 --METIS = ../../metis-4.0/libmetis.a -+# METIS_PATH = ../../metis-4.0 -+# METIS = ../../metis-4.0/libmetis.a - - #------------------------------------------------------------------------------ - # UMFPACK configuration: -@@ -273,7 +273,7 @@ UMFPACK_CONFIG = - # -DNSUNPERF for Solaris only. If defined, do not use the Sun - # Performance Library - --CHOLMOD_CONFIG = $(GPU_CONFIG) -+CHOLMOD_CONFIG = $(GPU_CONFIG) -DNPARTITION - - # uncomment this line to compile CHOLMOD without METIS: - # CHOLMOD_CONFIG = -DNPARTITION --- -2.1.3 - diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index add4ca9a08f4..ccd0c378a813 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -1,33 +1,41 @@ -{ stdenv, fetchurl, substituteAll -, atlasWithLapack, gfortran }: +{ stdenv, fetchurl, gfortran, openblas }: let - name = "suitesparse-4.4.1"; + version = "4.4.1"; + name = "suitesparse-${version}"; + + int_t = if openblas.blas64 then "int64_t" else "int32_t"; in stdenv.mkDerivation { inherit name; src = fetchurl { - url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-4.4.1.tar.gz"; + url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz"; sha256 = "0y8i6dizrr556xggpjyc7wijjv4jbizhssmjj4jv8n1s7zxy2z0n"; }; - patches = [ - ./0001-disable-metis.patch - ./0002-set-install-dir.patch - (substituteAll { - src = ./0003-blas-lapack-flags.patch; - blasFlags = "-lf77blas -latlas -lcblas -lgfortran"; - lapackFlags= "-llapack -latlas -lcblas"; - }) - ]; - preConfigure = '' substituteAllInPlace SuiteSparse_config/SuiteSparse_config.mk mkdir -p $out/lib mkdir -p $out/include + + sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ + -e 's/METIS .*$/METIS =/' \ + -e 's/METIS_PATH .*$/METIS_PATH =/' \ + -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \ + -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/' ''; + makeFlags = [ + "PREFIX=\"$(out)\"" + "INSTALL_LIB=$(out)/lib" + "INSTALL_INCLUDE=$(out)/include" + "BLAS=-lopenblas" + "LAPACK=" + ]; + + NIX_CFLAGS = "-fPIC"; + postInstall = '' # Install documentation outdoc=$out/share/doc/${name} @@ -47,7 +55,7 @@ stdenv.mkDerivation { ''; nativeBuildInputs = [ gfortran ]; - buildInputs = [ atlasWithLapack ]; + buildInputs = [ openblas ]; meta = with stdenv.lib; { homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html; From e5ee1a0577164d7e253ba69a2239f37b78a9c3c0 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 17:34:31 -0500 Subject: [PATCH 08/43] suitesparse: remove unnecessary patches --- .../suitesparse/0002-set-install-dir.patch | 27 -- .../suitesparse/0003-blas-lapack-flags.patch | 27 -- .../math/suitesparse/SuiteSparse_config.mk | 452 ------------------ .../science/math/suitesparse/default.nix | 1 - 4 files changed, 507 deletions(-) delete mode 100644 pkgs/development/libraries/science/math/suitesparse/0002-set-install-dir.patch delete mode 100644 pkgs/development/libraries/science/math/suitesparse/0003-blas-lapack-flags.patch delete mode 100644 pkgs/development/libraries/science/math/suitesparse/SuiteSparse_config.mk diff --git a/pkgs/development/libraries/science/math/suitesparse/0002-set-install-dir.patch b/pkgs/development/libraries/science/math/suitesparse/0002-set-install-dir.patch deleted file mode 100644 index ef861f68091a..000000000000 --- a/pkgs/development/libraries/science/math/suitesparse/0002-set-install-dir.patch +++ /dev/null @@ -1,27 +0,0 @@ -From e0fee492a315ce1ef8697b056af210beb1465334 Mon Sep 17 00:00:00 2001 -From: Thomas Tuegel -Date: Mon, 15 Dec 2014 10:18:12 -0600 -Subject: [PATCH 2/3] set install dir - ---- - SuiteSparse_config/SuiteSparse_config.mk | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/SuiteSparse_config/SuiteSparse_config.mk b/SuiteSparse_config/SuiteSparse_config.mk -index e1514bf..f1046a6 100644 ---- a/SuiteSparse_config/SuiteSparse_config.mk -+++ b/SuiteSparse_config/SuiteSparse_config.mk -@@ -95,8 +95,8 @@ F77LIB = - # LIB = -lm - - # For "make install" --INSTALL_LIB = /usr/local/lib --INSTALL_INCLUDE = /usr/local/include -+INSTALL_LIB = @out@/lib -+INSTALL_INCLUDE = @out@/include - - # Which version of MAKE you are using (default is "make") - # MAKE = make --- -2.1.3 - diff --git a/pkgs/development/libraries/science/math/suitesparse/0003-blas-lapack-flags.patch b/pkgs/development/libraries/science/math/suitesparse/0003-blas-lapack-flags.patch deleted file mode 100644 index db0b1c456558..000000000000 --- a/pkgs/development/libraries/science/math/suitesparse/0003-blas-lapack-flags.patch +++ /dev/null @@ -1,27 +0,0 @@ -From a99cca30cfd965683564ae024e8ecc615c61697a Mon Sep 17 00:00:00 2001 -From: Thomas Tuegel -Date: Mon, 15 Dec 2014 10:24:08 -0600 -Subject: [PATCH 3/3] blas lapack flags - ---- - SuiteSparse_config/SuiteSparse_config.mk | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/SuiteSparse_config/SuiteSparse_config.mk b/SuiteSparse_config/SuiteSparse_config.mk -index f1046a6..1710162 100644 ---- a/SuiteSparse_config/SuiteSparse_config.mk -+++ b/SuiteSparse_config/SuiteSparse_config.mk -@@ -119,8 +119,8 @@ INSTALL_INCLUDE = @out@/include - # naming the BLAS and LAPACK library (*.a or *.so) files. - - # This is probably slow ... it might connect to the Standard Reference BLAS: -- BLAS = -lblas -lgfortran -- LAPACK = -llapack -+ BLAS = @blasFlags@ -+ LAPACK = @lapackFlags@ - - # MKL - # BLAS = -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -lpthread -lm --- -2.1.3 - diff --git a/pkgs/development/libraries/science/math/suitesparse/SuiteSparse_config.mk b/pkgs/development/libraries/science/math/suitesparse/SuiteSparse_config.mk deleted file mode 100644 index 157a20d7b5aa..000000000000 --- a/pkgs/development/libraries/science/math/suitesparse/SuiteSparse_config.mk +++ /dev/null @@ -1,452 +0,0 @@ -#=============================================================================== -# SuiteSparse_config.mk: common configuration file for the SuiteSparse -#=============================================================================== - -# This file contains all configuration settings for all packages authored or -# co-authored by Tim Davis: -# -# Package Version Description -# ------- ------- ----------- -# AMD 1.2 or later approximate minimum degree ordering -# COLAMD 2.4 or later column approximate minimum degree ordering -# CCOLAMD 1.0 or later constrained column approximate minimum degree ordering -# CAMD any constrained approximate minimum degree ordering -# UMFPACK 4.5 or later sparse LU factorization, with the BLAS -# CHOLMOD any sparse Cholesky factorization, update/downdate -# KLU 0.8 or later sparse LU factorization, BLAS-free -# BTF 0.8 or later permutation to block triangular form -# LDL 1.2 or later concise sparse LDL' -# CXSparse any extended version of CSparse (int/long, real/complex) -# SuiteSparseQR any sparse QR factorization -# RBio 2.0 or later read/write sparse matrices in Rutherford-Boeing format -# -# By design, this file is NOT included in the CSparse makefile. -# That package is fully stand-alone. CSparse is primarily for teaching; -# production code should use CXSparse. -# -# The SuiteSparse_config directory and the above packages should all appear in -# a single directory, in order for the Makefile's within each package to find -# this file. -# -# To enable an option of the form "# OPTION = ...", edit this file and -# delete the "#" in the first column of the option you wish to use. -# -# The use of METIS 4.0.1 is optional. To exclude METIS, you must compile with -# CHOLMOD_CONFIG set to -DNPARTITION. See below for details. However, if you -# do not have a metis-4.0 directory inside the SuiteSparse directory, the -# */Makefile's that optionally rely on METIS will automatically detect this -# and compile without METIS. - -#------------------------------------------------------------------------------ -# Generic configuration -#------------------------------------------------------------------------------ - -# Using standard definitions from the make environment, typically: -# -# CC cc C compiler -# CXX g++ C++ compiler -# CFLAGS [ ] flags for C and C++ compiler -# CPPFLAGS [ ] flags for C and C++ compiler -# TARGET_ARCH [ ] target architecture -# FFLAGS [ ] flags for Fortran compiler -# RM rm -f delete a file -# AR ar create a static *.a library archive -# ARFLAGS rv flags for ar -# MAKE make make itself (sometimes called gmake) -# -# You can redefine them here, but by default they are used from the -# default make environment. - -# To use OpenMP add -openmp to the CFLAGS -# If OpenMP is used, it is recommended to define CHOLMOD_OMP_NUM_THREADS -# as the number of cores per socket on the machine being used to maximize -# memory performance - CFLAGS = -# CFLAGS = -g -# for the icc compiler and OpenMP: -# CFLAGS = -openmp - -# C and C++ compiler flags. The first three are standard for *.c and *.cpp -# Add -DNTIMER if you do use any timing routines (otherwise -lrt is required). -# CF = $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -O3 -fexceptions -fPIC -DNTIMER - CF = $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -O3 -fexceptions -fPIC -# for the MKL BLAS: -# CF = $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -O3 -fexceptions -fPIC -I$(MKLROOT)/include -D_GNU_SOURCE -# with no optimization: -# CF = $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -fexceptions -fPIC - -# ranlib, and ar, for generating libraries. If you don't need ranlib, -# just change it to RANLAB = echo -RANLIB = ranlib -ARCHIVE = $(AR) $(ARFLAGS) - -# copy and delete a file -CP = cp -f -MV = mv -f - -# Fortran compiler (not required for 'make' or 'make library') -F77 = gfortran -F77FLAGS = $(FFLAGS) -O -F77LIB = - -# C and Fortran libraries. Remove -lrt if you don't have it. - LIB = -lm -lrt -# Using the following requires CF = ... -DNTIMER on POSIX C systems. -# LIB = -lm - -# For "make install" -INSTALL_LIB = @out@/lib -INSTALL_INCLUDE = @out@/include - -# Which version of MAKE you are using (default is "make") -# MAKE = make -# MAKE = gmake - -#------------------------------------------------------------------------------ -# BLAS and LAPACK configuration: -#------------------------------------------------------------------------------ - -# UMFPACK and CHOLMOD both require the BLAS. CHOLMOD also requires LAPACK. -# See Kazushige Goto's BLAS at http://www.cs.utexas.edu/users/flame/goto/ or -# http://www.tacc.utexas.edu/~kgoto/ for the best BLAS to use with CHOLMOD. -# LAPACK is at http://www.netlib.org/lapack/ . You can use the standard -# Fortran LAPACK along with Goto's BLAS to obtain very good performance. -# CHOLMOD gets a peak numeric factorization rate of 3.6 Gflops on a 3.2 GHz -# Pentium 4 (512K cache, 4GB main memory) with the Goto BLAS, and 6 Gflops -# on a 2.5Ghz dual-core AMD Opteron. - -# These settings will probably not work, since there is no fixed convention for -# naming the BLAS and LAPACK library (*.a or *.so) files. - -# This is probably slow ... it might connect to the Standard Reference BLAS: - BLAS = -lf77blas -latlas -lcblas -lgfortran - LAPACK = -llapack -latlas -lcblas - -# MKL -# BLAS = -Wl,--start-group $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a $(MKLROOT)/lib/intel64/libmkl_core.a $(MKLROOT)/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -lpthread -lm -# LAPACK = - -# ACML -# BLAS = -lacml -lgfortran -# LAPACK = - -# OpenBLAS -# BLAS = -lopenblas -# LAPACK = - -# NOTE: this next option for the "Goto BLAS" has nothing to do with a "goto" -# statement. Rather, the Goto BLAS is written by Dr. Kazushige Goto. -# Using the Goto BLAS: -# BLAS = -lgoto -lgfortran -lgfortranbegin -# BLAS = -lgoto2 -lgfortran -lgfortranbegin -lpthread - -# Using non-optimized versions: -# BLAS = -lblas_plain -lgfortran -lgfortranbegin -# LAPACK = -llapack_plain - -# BLAS = -lblas_plain -lgfortran -lgfortranbegin -# LAPACK = -llapack - -# The BLAS might not contain xerbla, an error-handling routine for LAPACK and -# the BLAS. Also, the standard xerbla requires the Fortran I/O library, and -# stops the application program if an error occurs. A C version of xerbla -# distributed with this software (SuiteSparse_config/xerbla/libcerbla.a) -# includes a Fortran-callable xerbla routine that prints nothing and does not -# stop the application program. This is optional. - -# XERBLA = ../../SuiteSparse_config/xerbla/libcerbla.a - -# If you wish to use the XERBLA in LAPACK and/or the BLAS instead, -# use this option: -XERBLA = - -# If you wish to use the Fortran SuiteSparse_config/xerbla/xerbla.f instead, -# use this: - -# XERBLA = ../../SuiteSparse_config/xerbla/libxerbla.a - -#------------------------------------------------------------------------------ -# GPU configuration for CHOLMOD and SPQR -#------------------------------------------------------------------------------ - -# no cuda - CUDA_ROOT = - GPU_BLAS_PATH = - GPU_CONFIG = - CUDA_PATH = - CUDART_LIB = - CUBLAS_LIB = - CUDA_INC_PATH = - NV20 = - NV30 = - NV35 = - NVCC = echo - NVCCFLAGS = - -# with cuda for CHOLMOD -# CUDA_ROOT = /usr/local/cuda -# GPU_BLAS_PATH = $(CUDA_ROOT) -# with 4 cores (default): -# GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -# with 10 cores: -# GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=10 -# CUDA_PATH = $(CUDA_ROOT) -# CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so -# CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so -# CUDA_INC_PATH = $(CUDA_ROOT)/include/ -# NV20 = -arch=sm_20 -Xcompiler -fPIC -# NV30 = -arch=sm_30 -Xcompiler -fPIC -# NV35 = -arch=sm_35 -Xcompiler -fPIC -# NVCC = $(CUDA_ROOT)/bin/nvcc -# NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 - -# was NVCC = $(CUDA_ROOT)/bin/nvcc $(NV35) $(NV30) $(NV20) - -#------------------------------------------------------------------------------ -# METIS, optionally used by CHOLMOD -#------------------------------------------------------------------------------ - -# If you do not have METIS, or do not wish to use it in CHOLMOD, you must -# compile CHOLMOD with the -DNPARTITION flag. - -# The path is relative to where it is used, in CHOLMOD/Lib, CHOLMOD/MATLAB, etc. -# You may wish to use an absolute path. METIS is optional. Compile -# CHOLMOD with -DNPARTITION if you do not wish to use METIS. -# METIS_PATH = ../../metis-4.0 -# METIS = ../../metis-4.0/libmetis.a - -#------------------------------------------------------------------------------ -# UMFPACK configuration: -#------------------------------------------------------------------------------ - -# Configuration flags for UMFPACK. See UMFPACK/Source/umf_config.h for details. -# -# -DNBLAS do not use the BLAS. UMFPACK will be very slow. -# -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by -# LAPACK and the BLAS (defaults to 'int') -# -DNSUNPERF do not use the Sun Perf. Library (default is use it on Solaris) -# -DNRECIPROCAL do not multiply by the reciprocal -# -DNO_DIVIDE_BY_ZERO do not divide by zero -# -DNCHOLMOD do not use CHOLMOD as a ordering method. If -DNCHOLMOD is -# included in UMFPACK_CONFIG, then UMFPACK does not rely on -# CHOLMOD, CAMD, CCOLAMD, COLAMD, and METIS. - -UMFPACK_CONFIG = - -# uncomment this line to compile UMFPACK without CHOLMOD: -# UMFPACK_CONFIG = -DNCHOLMOD - -#------------------------------------------------------------------------------ -# CHOLMOD configuration -#------------------------------------------------------------------------------ - -# CHOLMOD Library Modules, which appear in libcholmod.a: -# Core requires: none -# Check requires: Core -# Cholesky requires: Core, AMD, COLAMD. optional: Partition, Supernodal -# MatrixOps requires: Core -# Modify requires: Core -# Partition requires: Core, CCOLAMD, METIS. optional: Cholesky -# Supernodal requires: Core, BLAS, LAPACK -# -# CHOLMOD test/demo Modules (all are GNU GPL, do not appear in libcholmod.a): -# Tcov requires: Core, Check, Cholesky, MatrixOps, Modify, Supernodal -# optional: Partition -# Valgrind same as Tcov -# Demo requires: Core, Check, Cholesky, MatrixOps, Supernodal -# optional: Partition -# -# Configuration flags: -# -DNCHECK do not include the Check module. License GNU LGPL -# -DNCHOLESKY do not include the Cholesky module. License GNU LGPL -# -DNPARTITION do not include the Partition module. License GNU LGPL -# also do not include METIS. -# -DNCAMD do not use CAMD, etc from Partition module. GNU LGPL -# -DNGPL do not include any GNU GPL Modules in the CHOLMOD library: -# -DNMATRIXOPS do not include the MatrixOps module. License GNU GPL -# -DNMODIFY do not include the Modify module. License GNU GPL -# -DNSUPERNODAL do not include the Supernodal module. License GNU GPL -# -# -DNPRINT do not print anything. -# -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by -# LAPACK and the BLAS (defaults to 'int') -# -DNSUNPERF for Solaris only. If defined, do not use the Sun -# Performance Library - -CHOLMOD_CONFIG = $(GPU_CONFIG) -DNPARTITION - -# uncomment this line to compile CHOLMOD without METIS: -# CHOLMOD_CONFIG = -DNPARTITION - -#------------------------------------------------------------------------------ -# SuiteSparseQR configuration: -#------------------------------------------------------------------------------ - -# The SuiteSparseQR library can be compiled with the following options: -# -# -DNPARTITION do not include the CHOLMOD partition module -# -DNEXPERT do not include the functions in SuiteSparseQR_expert.cpp -# -DHAVE_TBB enable the use of Intel's Threading Building Blocks (TBB) - -# default, without timing, without TBB: -SPQR_CONFIG = $(GPU_CONFIG) -# with TBB: -# SPQR_CONFIG = -DHAVE_TBB - -# This is needed for IBM AIX: (but not for and C codes, just C++) -# SPQR_CONFIG = -DBLAS_NO_UNDERSCORE - -# with TBB, you must select this: -# TBB = -ltbb -# without TBB: -TBB = - -#------------------------------------------------------------------------------ -# code formatting -#------------------------------------------------------------------------------ - -# Use "grep" only, if you do not have "indent" -# PRETTY = grep -v "^\#" -# PRETTY = grep -v "^\#" | indent -bl -nce -ss -bli0 -i4 -sob -l120 - PRETTY = grep -v "^\#" | indent -bl -nce -bli0 -i4 -sob -l120 - -#------------------------------------------------------------------------------ -# Linux -#------------------------------------------------------------------------------ - -# Using default compilers: -# CC = gcc -# CF = $(CFLAGS) -O3 -fexceptions - -# alternatives: -# CF = $(CFLAGS) -g -fexceptions \ -# -Wall -W -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ -# -Wredundant-decls -Wnested-externs -Wdisabled-optimization -ansi \ -# -funit-at-a-time -# CF = $(CFLAGS) -O3 -fexceptions \ -# -Wall -W -Werror -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ -# -Wredundant-decls -Wnested-externs -Wdisabled-optimization -ansi -# CF = $(CFLAGS) -O3 -fexceptions -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -# CF = $(CFLAGS) -O3 -# CF = $(CFLAGS) -O3 -g -fexceptions -# CF = $(CFLAGS) -g -fexceptions \ -# -Wall -W -Wshadow \ -# -Wredundant-decls -Wdisabled-optimization -ansi - -# consider: -# -fforce-addr -fmove-all-movables -freduce-all-givs -ftsp-ordering -# -frename-registers -ffast-math -funroll-loops - -# Using the Goto BLAS: -# BLAS = -lgoto -lfrtbegin -lg2c $(XERBLA) -lpthread - -# Using Intel's icc and ifort compilers: -# (does not work for mexFunctions unless you add a mexopts.sh file) -# F77 = ifort -# CC = icc -# CF = $(CFLAGS) -O3 -xN -vec_report=0 -# CF = $(CFLAGS) -g - -# 64bit: -# F77FLAGS = -O -m64 -# CF = $(CFLAGS) -O3 -fexceptions -m64 -# BLAS = -lgoto64 -lfrtbegin -lg2c -lpthread $(XERBLA) -# LAPACK = -llapack64 - -# SUSE Linux 10.1, AMD Opteron, with GOTO Blas -# F77 = gfortran -# BLAS = -lgoto_opteron64 -lgfortran - -# SUSE Linux 10.1, Intel Pentium, with GOTO Blas -# F77 = gfortran -# BLAS = -lgoto -lgfortran - -#------------------------------------------------------------------------------ -# Mac -#------------------------------------------------------------------------------ - -# As recommended by macports, http://suitesparse.darwinports.com/ -# I've tested them myself on Mac OSX 10.6.1 and 10.6.8 (Snow Leopard), -# on my MacBook Air, and they work fine. - -# F77 = gfortran -# CF = $(CFLAGS) -O3 -fno-common -fexceptions -DNTIMER -# BLAS = -framework Accelerate -# LAPACK = -framework Accelerate -# LIB = -lm - -#------------------------------------------------------------------------------ -# Solaris -#------------------------------------------------------------------------------ - -# 32-bit -# CF = $(CFLAGS) -KPIC -dalign -xc99=%none -Xc -xlibmieee -xO5 -xlibmil -m32 - -# 64-bit -# CF = $(CFLAGS) -fast -KPIC -xc99=%none -xlibmieee -xlibmil -m64 -Xc - -# FFLAGS = -fast -KPIC -dalign -xlibmil -m64 - -# The Sun Performance Library includes both LAPACK and the BLAS: -# BLAS = -xlic_lib=sunperf -# LAPACK = - - -#------------------------------------------------------------------------------ -# Compaq Alpha -#------------------------------------------------------------------------------ - -# 64-bit mode only -# CF = $(CFLAGS) -O2 -std1 -# BLAS = -ldxml -# LAPACK = - -#------------------------------------------------------------------------------ -# IBM RS 6000 -#------------------------------------------------------------------------------ - -# BLAS = -lessl -# LAPACK = - -# 32-bit mode: -# CF = $(CFLAGS) -O4 -qipa -qmaxmem=16384 -qproto -# F77FLAGS = -O4 -qipa -qmaxmem=16384 - -# 64-bit mode: -# CF = $(CFLAGS) -O4 -qipa -qmaxmem=16384 -q64 -qproto -# F77FLAGS = -O4 -qipa -qmaxmem=16384 -q64 - -#------------------------------------------------------------------------------ -# SGI IRIX -#------------------------------------------------------------------------------ - -# BLAS = -lscsl -# LAPACK = - -# 32-bit mode -# CF = $(CFLAGS) -O - -# 64-bit mode (32 bit int's and 64-bit long's): -# CF = $(CFLAGS) -64 -# F77FLAGS = -64 - -# SGI doesn't have ranlib -# RANLIB = echo - -#------------------------------------------------------------------------------ -# AMD Opteron (64 bit) -#------------------------------------------------------------------------------ - -# BLAS = -lgoto_opteron64 -lg2c -# LAPACK = -llapack_opteron64 - -# SUSE Linux 10.1, AMD Opteron -# F77 = gfortran -# BLAS = -lgoto_opteron64 -lgfortran -# LAPACK = -llapack_opteron64 - -#------------------------------------------------------------------------------ -# remove object files and profile output -#------------------------------------------------------------------------------ - -CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d *.gcda *.gcno diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index ccd0c378a813..740ea3a09a67 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -15,7 +15,6 @@ stdenv.mkDerivation { }; preConfigure = '' - substituteAllInPlace SuiteSparse_config/SuiteSparse_config.mk mkdir -p $out/lib mkdir -p $out/include From 4f98287afa7c20ae8d5316cad603f834a60a7b18 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 18:14:51 -0500 Subject: [PATCH 09/43] julia02: build with openblas Compared to ATLAS, OpenBLAS offers better performance, faster builds, and dynamic architecture detection. --- pkgs/development/compilers/julia/0.2.nix | 14 ++++++++------ pkgs/top-level/all-packages.nix | 1 - 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/julia/0.2.nix b/pkgs/development/compilers/julia/0.2.nix index cc1be3db8a5b..9d585e07fe1a 100644 --- a/pkgs/development/compilers/julia/0.2.nix +++ b/pkgs/development/compilers/julia/0.2.nix @@ -1,6 +1,6 @@ { stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl - , ncurses, libunistring, lighttpd, patchelf, openblas, liblapack + , ncurses, libunistring, lighttpd, patchelf, openblas , tcl, tk, xproto, libX11, git, mpfr } : let @@ -71,7 +71,7 @@ stdenv.mkDerivation rec { buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf - openblas liblapack tcl tk xproto libX11 git mpfr + openblas tcl tk xproto libX11 git mpfr ]; configurePhase = '' @@ -91,14 +91,13 @@ stdenv.mkDerivation rec { copy_kill_hash "${dsfmt_src}" deps/random ${if realGcc ==null then "" else - ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''} + ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -lopenblas -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr"''} export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC " export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia" export GLPK_PREFIX="${glpk}/include" - mkdir -p "$out/lib" sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile @@ -111,9 +110,12 @@ stdenv.mkDerivation rec { preBuild = '' mkdir -p usr/lib - - echo "$out" + mkdir -p "$out/lib" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/liblapack.so" + + echo "$out" ( cd "$(mktemp -d)" for i in "${suitesparse}"/lib/lib*.a; do diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0e74825b67d3..fb089239f8fb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3990,7 +3990,6 @@ let jikes = callPackage ../development/compilers/jikes { }; julia02 = callPackage ../development/compilers/julia/0.2.nix { - liblapack = liblapack.override {shared = true;}; llvm = llvm_33; suitesparse = suitesparse_4_2; }; From 77a454b866633b6accd144a28c2616a2ea1fd8b0 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 18:15:08 -0500 Subject: [PATCH 10/43] julia03: refactor and build with openblas Compared to ATLAS, OpenBLAS offers better performance, faster builds, and dynamic architecture detection. --- pkgs/development/compilers/julia/0.3.nix | 128 +++++++++++++---------- pkgs/top-level/all-packages.nix | 9 +- 2 files changed, 73 insertions(+), 64 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 9f216c7207fc..dc51441bb171 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -1,26 +1,24 @@ { stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib - , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl - , ncurses, libunistring, patchelf, openblas, liblapack - , tcl, tk, xproto, libX11, git, mpfr, which, wget - } : +, readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl +, ncurses, libunistring, patchelf, openblas +, tcl, tk, xproto, libX11, git, mpfr, which +}: -assert stdenv.isLinux; +with stdenv.lib; let realGcc = stdenv.cc.cc; -in -stdenv.mkDerivation rec { - pname = "julia"; - version = "0.3.6"; - name = "${pname}-${version}"; + arch = head (splitString "-" stdenv.system); + march = + { + "x86_64-linux" = "x86-64"; + "i686-linux" = "i686"; + }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); dsfmt_ver = "2.2"; grisu_ver = "1.1.1"; - openblas_ver = "v0.2.13"; - lapack_ver = "3.5.0"; arpack_ver = "3.1.5"; patchelf_ver = "0.8"; - pcre_ver = "8.36"; utf8proc_ver = "1.1.6"; dsfmt_src = fetchurl { @@ -32,33 +30,26 @@ stdenv.mkDerivation rec { url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; md5 = "29b533ed4311161267bff1a9a97e2953"; }; - openblas_src = fetchurl { - url = "https://github.com/xianyi/OpenBLAS/tarball/${openblas_ver}"; - name = "openblas-${openblas_ver}.tar.gz"; - md5 = "74adf4c0d0d82bff4774be5bf2134183"; - }; arpack_src = fetchurl rec { url = "https://github.com/opencollab/arpack-ng/archive/${arpack_ver}.tar.gz"; md5 = "d84e1b6108d9ee67c0d21aba7099e953"; name = "arpack-ng-${arpack_ver}.tar.gz"; }; - lapack_src = fetchurl { - url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz"; - name = "lapack-${lapack_ver}.tgz"; - md5 = "b1d3e3e425b2e44a06760ff173104bdf"; - }; patchelf_src = fetchurl { url = "http://hydra.nixos.org/build/1524660/download/2/patchelf-${patchelf_ver}.tar.bz2"; md5 = "5087261514b4b5814a39c3d3a36eb6ef"; }; - pcre_src = fetchurl { - url = "ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-${pcre_ver}.tar.bz2"; - md5 = "b767bc9af0c20bc9c1fe403b0d41ad97"; - }; utf8proc_src = fetchurl { url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; md5 = "2462346301fac2994c34f5574d6c3ca7"; }; +in +stdenv.mkDerivation rec { + pname = "julia"; + version = "0.3.6"; + name = "${pname}-${version}"; + + extraSrcs = [ dsfmt_src grisu_src arpack_src utf8proc_src ]; src = fetchgit { url = "git://github.com/JuliaLang/julia.git"; @@ -67,59 +58,81 @@ stdenv.mkDerivation rec { name = "julia-git-v${version}"; }; - buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib - fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf - openblas liblapack tcl tk xproto libX11 git mpfr which wget + buildInputs = + [ + gfortran perl m4 gmp pcre llvm readline zlib + fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf + openblas tcl tk xproto libX11 git mpfr which ]; + makeFlags = + [ + "USE_SYSTEM_PATCHELF=1" + "USE_SYSTEM_OPENBLAS=1" + "USE_SYSTEM_BLAS=1" + "USE_SYSTEM_LAPACK=1" + "ARCH=${arch}" + "MARCH=${march}" + "JULIA_CPU_TARGET=${march}" + "PREFIX=$(out)" + "prefix=$(out)" + "SHELL=${stdenv.shell}" + ]; + + GLPK_PREFIX = "${glpk}/include"; + + NIX_CFLAGS_COMPILE = [ "-fPIC" ]; + NIX_LDFLAGS = + optionals + (realGcc != null) + [ + "-L${realGcc}/lib" + "-L${realGcc}/lib64" + "-lpcre" "-lm" "-lfftw3f" "-lfftw3" "-lglpk" + "-lunistring" "-lz" "-lgmp" "-lmpfr" "-lopenblas" + ]; + + postPatch = '' + sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile + sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile + + patchShebangs . contrib + + # ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache + # is probably not what we want anyway on non-NixOS + sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* + ''; + configurePhase = '' for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK ZLIB MPFR; do makeFlags="$makeFlags USE_SYSTEM_$i=1 " done - makeFlags="$makeFlags JULIA_CPU_TARGET=core2"; copy_kill_hash(){ cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')" } - for i in "${grisu_src}" "${dsfmt_src}" "${arpack_src}" "${patchelf_src}" \ - "${pcre_src}" "${utf8proc_src}" "${lapack_src}" "${openblas_src}"; do + for i in $extraSrcs; do copy_kill_hash "$i" deps done - ${if realGcc ==null then "" else - ''export NIX_LDFLAGS="$NIX_LDFLAGS -L${realGcc}/lib -L${realGcc}/lib64 -lpcre -llapack -lm -lfftw3f -lfftw3 -lglpk -lunistring -lz -lgmp -lmpfr -lblas -lopenblas -L$out/lib"''} - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fPIC " + ${if realGcc ==null then "" else ''export NIX_LDFLAGS="$NIX_LDFLAGS -L$out/lib"''} export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia" - export GLPK_PREFIX="${glpk}/include" - - mkdir -p "$out/lib" - sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile - sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile - - export makeFlags="$makeFlags PREFIX=$out SHELL=${stdenv.shell} prefix=$out" - - export dontPatchELF=1 - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia" - patchShebangs . contrib - export PATH="$PATH:${stdenv.cc.libc}/sbin" - - # ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache - # is probably not what we want anyway on non-NixOS - sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* - - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" ''; preBuild = '' + mkdir -p "$out/lib" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/liblapack.so" + mkdir -p usr/lib - + echo "$out" mkdir -p "$out/lib" ( @@ -137,6 +150,7 @@ stdenv.mkDerivation rec { ''; dontStrip = true; + dontPatchELF = true; enableParallelBuilding = true; @@ -147,8 +161,8 @@ stdenv.mkDerivation rec { description = "High-level performance-oriented dynamical language for technical computing"; homepage = "http://julialang.org/"; license = stdenv.lib.licenses.mit; - maintainers = [ stdenv.lib.maintainers.raskin ]; - platforms = with stdenv.lib.platforms; linux; + maintainers = with stdenv.lib.maintainers; [ raskin ttuegel ]; + platforms = [ "i686-linux" "x86_64-linux" "x86_64-darwin" ]; broken = false; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fb089239f8fb..32c7cdbef237 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3994,13 +3994,8 @@ let suitesparse = suitesparse_4_2; }; - julia03 = let - liblapack = liblapack_3_5_0.override {shared = true;}; - in callPackage ../development/compilers/julia/0.3.nix { - inherit liblapack; - suitesparse = suitesparse_4_2.override { - inherit liblapack; - }; + julia03 = callPackage ../development/compilers/julia/0.3.nix { + suitesparse = suitesparse_4_2; llvm = llvm_33; }; julia = julia03; From bbda7d427b0858be50236d99011de29416652c2d Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 20:09:37 -0500 Subject: [PATCH 11/43] suitesparse: version derivations by major version only --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 32c7cdbef237..5c600c47817b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13879,7 +13879,7 @@ let sage = callPackage ../applications/science/math/sage { }; suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { }; - suitesparse_4_4_1 = callPackage ../development/libraries/science/math/suitesparse {}; + suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {}; ipopt = callPackage ../development/libraries/science/math/ipopt { }; From a17d8bcc4bbf3e74cacecf956cd06cb9a98b52ba Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 20:33:42 -0500 Subject: [PATCH 12/43] suitesparse_4_4: update to 4.4.4 --- .../libraries/science/math/suitesparse/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 740ea3a09a67..af9396ad9004 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -1,7 +1,7 @@ { stdenv, fetchurl, gfortran, openblas }: let - version = "4.4.1"; + version = "4.4.4"; name = "suitesparse-${version}"; int_t = if openblas.blas64 then "int64_t" else "int32_t"; @@ -11,7 +11,7 @@ stdenv.mkDerivation { src = fetchurl { url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz"; - sha256 = "0y8i6dizrr556xggpjyc7wijjv4jbizhssmjj4jv8n1s7zxy2z0n"; + sha256 = "1zdn1y0ij6amj7smmcslkqgbqv9yy5cwmbyzqc9v6drzdzllgbpj"; }; preConfigure = '' From 86c54040aa1fba0307eeaebe00968a0a81871127 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 20:33:59 -0500 Subject: [PATCH 13/43] julia03: build with suitesparse_4_4 --- pkgs/top-level/all-packages.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5c600c47817b..0e96c04b7d83 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3995,7 +3995,6 @@ let }; julia03 = callPackage ../development/compilers/julia/0.3.nix { - suitesparse = suitesparse_4_2; llvm = llvm_33; }; julia = julia03; @@ -13880,6 +13879,7 @@ let suitesparse_4_2 = callPackage ../development/libraries/science/math/suitesparse/4.2.nix { }; suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {}; + suitesparse = suitesparse_4_4; ipopt = callPackage ../development/libraries/science/math/ipopt { }; From adcdec2e70905a35c99bd2ba0991dbdd13280f38 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Wed, 3 Jun 2015 20:34:30 -0500 Subject: [PATCH 14/43] julia03: use system patchelf --- pkgs/development/compilers/julia/0.3.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index dc51441bb171..c7cda2749248 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -18,7 +18,6 @@ let dsfmt_ver = "2.2"; grisu_ver = "1.1.1"; arpack_ver = "3.1.5"; - patchelf_ver = "0.8"; utf8proc_ver = "1.1.6"; dsfmt_src = fetchurl { @@ -35,10 +34,6 @@ let md5 = "d84e1b6108d9ee67c0d21aba7099e953"; name = "arpack-ng-${arpack_ver}.tar.gz"; }; - patchelf_src = fetchurl { - url = "http://hydra.nixos.org/build/1524660/download/2/patchelf-${patchelf_ver}.tar.bz2"; - md5 = "5087261514b4b5814a39c3d3a36eb6ef"; - }; utf8proc_src = fetchurl { url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; md5 = "2462346301fac2994c34f5574d6c3ca7"; From e36b3ec0a56c3b06152a205a46804733b88695d6 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 07:09:29 -0500 Subject: [PATCH 15/43] suitesparse: build shared libraries --- pkgs/development/compilers/julia/0.3.nix | 19 +++---------------- .../science/math/suitesparse/default.nix | 12 ++++++++++++ 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index c7cda2749248..62a1f4f98cc5 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -63,7 +63,6 @@ stdenv.mkDerivation rec { makeFlags = [ "USE_SYSTEM_PATCHELF=1" - "USE_SYSTEM_OPENBLAS=1" "USE_SYSTEM_BLAS=1" "USE_SYSTEM_LAPACK=1" "ARCH=${arch}" @@ -122,25 +121,13 @@ stdenv.mkDerivation rec { ''; preBuild = '' + # Link dynamically loaded shared libraries into output so they are found at runtime. mkdir -p "$out/lib" ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" ln -s "${openblas}/lib/libopenblas.so" "$out/lib/liblapack.so" - - mkdir -p usr/lib - - echo "$out" - mkdir -p "$out/lib" - ( - cd "$(mktemp -d)" - for i in "${suitesparse}"/lib/lib*.a; do - ar -x $i - done - gcc *.o --shared -o "$out/lib/libsuitesparse.so" - ) - cp "$out/lib/libsuitesparse.so" usr/lib + ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/libsuitesparse.so" for i in umfpack cholmod amd camd colamd spqr; do - ln -s libsuitesparse.so "$out"/lib/lib$i.so; - ln -s libsuitesparse.so "usr"/lib/lib$i.so; + ln -s libsuitesparse.so "$out/lib/lib$i.so"; done ''; diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index af9396ad9004..f30db472b0de 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -36,6 +36,18 @@ stdenv.mkDerivation { NIX_CFLAGS = "-fPIC"; postInstall = '' + # Build and install shared library + ( + cd "$(mktemp -d)" + for i in "$out"/lib/lib*.a; do + ar -x $i + done + gcc *.o --shared -o "$out/lib/libsuitesparse.so" + ) + for i in umfpack cholmod amd camd colamd spqr; do + ln -s libsuitesparse.so "$out"/lib/lib$i.so; + done + # Install documentation outdoc=$out/share/doc/${name} mkdir -p $outdoc From fff0191f481c49320d5c540ed8ae491a44b59c8e Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 07:17:30 -0500 Subject: [PATCH 16/43] arpack: build with openblas --- .../libraries/science/math/arpack/default.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/math/arpack/default.nix b/pkgs/development/libraries/science/math/arpack/default.nix index 01bb3371f5e2..c896ecca4728 100644 --- a/pkgs/development/libraries/science/math/arpack/default.nix +++ b/pkgs/development/libraries/science/math/arpack/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchurl, gfortran, atlasWithLapack }: +{ stdenv, fetchurl, gfortran, openblas }: + +with stdenv.lib; let version = "3.2.0"; @@ -10,10 +12,15 @@ stdenv.mkDerivation { sha256 = "1fwch6vipms1ispzg2djvbzv5wag36f1dmmr3xs3mbp6imfyhvff"; }; - buildInputs = [ gfortran atlasWithLapack ]; + buildInputs = [ gfortran openblas ]; # Auto-detection fails because gfortran brings in BLAS by default - configureFlags="--with-blas=-latlas --with-lapack=-latlas"; + configureFlags = [ + "--with-blas=-lopenblas" + "--with-lapack=-lopenblas" + ]; + + FFLAGS = optional openblas.blas64 "-fdefault-integer-8"; meta = { homepage = "http://forge.scilab.org/index.php/p/arpack-ng/"; From 5c9750e5bbf52977d6fb95d9ff07e09f10769b01 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 08:35:54 -0500 Subject: [PATCH 17/43] julia03: link shared libraries privately --- pkgs/development/compilers/julia/0.3.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 62a1f4f98cc5..d5e763003b12 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -122,12 +122,12 @@ stdenv.mkDerivation rec { preBuild = '' # Link dynamically loaded shared libraries into output so they are found at runtime. - mkdir -p "$out/lib" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/libblas.so" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/liblapack.so" - ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/libsuitesparse.so" + mkdir -p "$out/lib/julia" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/libblas.so" + ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/liblapack.so" + ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/julia/libsuitesparse.so" for i in umfpack cholmod amd camd colamd spqr; do - ln -s libsuitesparse.so "$out/lib/lib$i.so"; + ln -s libsuitesparse.so "$out/lib/julia/lib$i.so"; done ''; From 41cc06fd000293d2ce9eb81ab8ca5a3654f5ad73 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 07:17:38 -0500 Subject: [PATCH 18/43] julia03: use system arpack --- pkgs/development/compilers/julia/0.3.nix | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index d5e763003b12..563e59a2f585 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -1,6 +1,6 @@ { stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl -, ncurses, libunistring, patchelf, openblas +, ncurses, libunistring, patchelf, openblas, arpack , tcl, tk, xproto, libX11, git, mpfr, which }: @@ -17,7 +17,6 @@ let dsfmt_ver = "2.2"; grisu_ver = "1.1.1"; - arpack_ver = "3.1.5"; utf8proc_ver = "1.1.6"; dsfmt_src = fetchurl { @@ -29,11 +28,6 @@ let url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; md5 = "29b533ed4311161267bff1a9a97e2953"; }; - arpack_src = fetchurl rec { - url = "https://github.com/opencollab/arpack-ng/archive/${arpack_ver}.tar.gz"; - md5 = "d84e1b6108d9ee67c0d21aba7099e953"; - name = "arpack-ng-${arpack_ver}.tar.gz"; - }; utf8proc_src = fetchurl { url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; md5 = "2462346301fac2994c34f5574d6c3ca7"; @@ -44,7 +38,7 @@ stdenv.mkDerivation rec { version = "0.3.6"; name = "${pname}-${version}"; - extraSrcs = [ dsfmt_src grisu_src arpack_src utf8proc_src ]; + extraSrcs = [ dsfmt_src grisu_src utf8proc_src ]; src = fetchgit { url = "git://github.com/JuliaLang/julia.git"; @@ -57,7 +51,7 @@ stdenv.mkDerivation rec { [ gfortran perl m4 gmp pcre llvm readline zlib fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf - openblas tcl tk xproto libX11 git mpfr which + arpack openblas tcl tk xproto libX11 git mpfr which ]; makeFlags = @@ -65,6 +59,7 @@ stdenv.mkDerivation rec { "USE_SYSTEM_PATCHELF=1" "USE_SYSTEM_BLAS=1" "USE_SYSTEM_LAPACK=1" + "USE_SYSTEM_ARPACK=1" "ARCH=${arch}" "MARCH=${march}" "JULIA_CPU_TARGET=${march}" @@ -126,6 +121,7 @@ stdenv.mkDerivation rec { ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/libblas.so" ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/liblapack.so" ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/julia/libsuitesparse.so" + ln -s "${arpack}/lib/libarpack.so" "$out/lib/julia/libarpack.so" for i in umfpack cholmod amd camd colamd spqr; do ln -s libsuitesparse.so "$out/lib/julia/lib$i.so"; done From bd280660f75b0da002a6faa456e10ea63d6851bf Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 11:07:44 -0500 Subject: [PATCH 19/43] julia03: clean up LDFLAGS and LD_LIBRARY_PATH There were a few unused LDFLAGS and LD_LIBRARY_PATH settings. There was also an incorrect setting; Julia prefers to be linked to threaded FFTW. The libary names are now set correctly so that it's not necessary to link system libraries into $out/lib/julia as if they were private libraries. The LDFLAGS were also moved out of NIX_LDFLAGS so they will affect only the Julia build itself, and not all the individual private libraries. --- pkgs/development/compilers/julia/0.3.nix | 117 ++++++++++++----------- 1 file changed, 59 insertions(+), 58 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 563e59a2f585..3eb55ad8ac05 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -8,38 +8,12 @@ with stdenv.lib; let realGcc = stdenv.cc.cc; - arch = head (splitString "-" stdenv.system); - march = - { - "x86_64-linux" = "x86-64"; - "i686-linux" = "i686"; - }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); - - dsfmt_ver = "2.2"; - grisu_ver = "1.1.1"; - utf8proc_ver = "1.1.6"; - - dsfmt_src = fetchurl { - url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmt_ver}.tar.gz"; - name = "dsfmt-${dsfmt_ver}.tar.gz"; - md5 = "cb61be3be7254eae39684612c524740d"; - }; - grisu_src = fetchurl { - url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; - md5 = "29b533ed4311161267bff1a9a97e2953"; - }; - utf8proc_src = fetchurl { - url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; - md5 = "2462346301fac2994c34f5574d6c3ca7"; - }; in stdenv.mkDerivation rec { pname = "julia"; version = "0.3.6"; name = "${pname}-${version}"; - extraSrcs = [ dsfmt_src grisu_src utf8proc_src ]; - src = fetchgit { url = "git://github.com/JuliaLang/julia.git"; rev = "refs/tags/v${version}"; @@ -47,6 +21,27 @@ stdenv.mkDerivation rec { name = "julia-git-v${version}"; }; + extraSrcs = + let + dsfmt_ver = "2.2"; + grisu_ver = "1.1.1"; + utf8proc_ver = "1.1.6"; + + dsfmt_src = fetchurl { + url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmt_ver}.tar.gz"; + name = "dsfmt-${dsfmt_ver}.tar.gz"; + md5 = "cb61be3be7254eae39684612c524740d"; + }; + grisu_src = fetchurl { + url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; + md5 = "29b533ed4311161267bff1a9a97e2953"; + }; + utf8proc_src = fetchurl { + url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; + md5 = "2462346301fac2994c34f5574d6c3ca7"; + }; + in [ dsfmt_src grisu_src utf8proc_src ]; + buildInputs = [ gfortran perl m4 gmp pcre llvm readline zlib @@ -55,31 +50,37 @@ stdenv.mkDerivation rec { ]; makeFlags = - [ - "USE_SYSTEM_PATCHELF=1" - "USE_SYSTEM_BLAS=1" - "USE_SYSTEM_LAPACK=1" - "USE_SYSTEM_ARPACK=1" + let + arch = head (splitString "-" stdenv.system); + march = + { + "x86_64-linux" = "x86-64"; + "i686-linux" = "i686"; + }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); + in [ "ARCH=${arch}" "MARCH=${march}" "JULIA_CPU_TARGET=${march}" "PREFIX=$(out)" "prefix=$(out)" "SHELL=${stdenv.shell}" + + "USE_SYSTEM_PATCHELF=1" + + "USE_SYSTEM_BLAS=1" + "LIBBLAS=-lopenblas" + "LIBBLASNAME=libopenblas" + + "USE_SYSTEM_LAPACK=1" + "LIBLAPACK=-lopenblas" + "LIBLAPACKNAME=libopenblas" + + "USE_SYSTEM_ARPACK=1" ]; GLPK_PREFIX = "${glpk}/include"; NIX_CFLAGS_COMPILE = [ "-fPIC" ]; - NIX_LDFLAGS = - optionals - (realGcc != null) - [ - "-L${realGcc}/lib" - "-L${realGcc}/lib64" - "-lpcre" "-lm" "-lfftw3f" "-lfftw3" "-lglpk" - "-lunistring" "-lz" "-lgmp" "-lmpfr" "-lopenblas" - ]; postPatch = '' sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile @@ -92,6 +93,24 @@ stdenv.mkDerivation rec { sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* ''; + # Julia tries to load these libraries dynamically at runtime, but they can't be found. + # Easier by far to link against them as usual. + # These go in LDFLAGS, where they affect only Julia itself, and not NIX_LDFLAGS, + # where they would also be used for all the private libraries Julia builds. + LDFLAGS = [ + "-larpack" + "-lfftw3_threads" + "-lfftw3f_threads" + "-lglpk" + "-lgmp" + "-lmpfr" + "-lopenblas" + "-lpcre" + "-lsuitesparse" + "-lunistring" + "-lz" + ]; + configurePhase = '' for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK ZLIB MPFR; do @@ -106,27 +125,9 @@ stdenv.mkDerivation rec { copy_kill_hash "$i" deps done - ${if realGcc ==null then "" else ''export NIX_LDFLAGS="$NIX_LDFLAGS -L$out/lib"''} - - export LDFLAGS="-L${suitesparse}/lib -L$out/lib/julia -Wl,-rpath,$out/lib/julia" - - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PWD/usr/lib:$PWD/usr/lib/julia" - export PATH="$PATH:${stdenv.cc.libc}/sbin" ''; - preBuild = '' - # Link dynamically loaded shared libraries into output so they are found at runtime. - mkdir -p "$out/lib/julia" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/libblas.so" - ln -s "${openblas}/lib/libopenblas.so" "$out/lib/julia/liblapack.so" - ln -s "${suitesparse}/lib/libsuitesparse.so" "$out/lib/julia/libsuitesparse.so" - ln -s "${arpack}/lib/libarpack.so" "$out/lib/julia/libarpack.so" - for i in umfpack cholmod amd camd colamd spqr; do - ln -s libsuitesparse.so "$out/lib/julia/lib$i.so"; - done - ''; - dontStrip = true; dontPatchELF = true; From 2b525f60c9981f67eb6ebe662a8d9b1c51f552d1 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 12:36:34 -0500 Subject: [PATCH 20/43] update julia-0.3.6 -> julia-0.3.9 Includes a workaround for the test suite suggested by upstream (https://github.com/JuliaLang/julia/commit/b192bf0e2f0a0c5b232c3352c6e996e5f11053f2#commitcomment-11139348) for a buggy system wcwidth. --- pkgs/development/compilers/julia/0.3.nix | 6 +++-- .../0001-work-around-buggy-wcwidth.patch | 24 +++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/compilers/julia/0001-work-around-buggy-wcwidth.patch diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 3eb55ad8ac05..9faeda215936 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -11,16 +11,18 @@ let in stdenv.mkDerivation rec { pname = "julia"; - version = "0.3.6"; + version = "0.3.9"; name = "${pname}-${version}"; src = fetchgit { url = "git://github.com/JuliaLang/julia.git"; rev = "refs/tags/v${version}"; - md5 = "d28e8f428485219f756d80c011d5dd32"; + sha256 = "ad0820affefd04eb6fba7deb2603756974711846a251900a9202b8d2665a37cf"; name = "julia-git-v${version}"; }; + patches = [ ./0001-work-around-buggy-wcwidth.patch ]; + extraSrcs = let dsfmt_ver = "2.2"; diff --git a/pkgs/development/compilers/julia/0001-work-around-buggy-wcwidth.patch b/pkgs/development/compilers/julia/0001-work-around-buggy-wcwidth.patch new file mode 100644 index 000000000000..7c4870fb2a89 --- /dev/null +++ b/pkgs/development/compilers/julia/0001-work-around-buggy-wcwidth.patch @@ -0,0 +1,24 @@ +From b9070aeab0ab672ffe321089631f9afe263b0caa Mon Sep 17 00:00:00 2001 +From: Thomas Tuegel +Date: Thu, 4 Jun 2015 12:03:32 -0500 +Subject: [PATCH] work around buggy wcwidth + +--- + test/unicode.jl | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/test/unicode.jl b/test/unicode.jl +index 52c3e6a..f1ef698 100644 +--- a/test/unicode.jl ++++ b/test/unicode.jl +@@ -103,5 +103,6 @@ end + + # handling of embedded NUL chars (#10958) + @test length("\0w") == length("\0α") == 2 +-@test strwidth("\0w") == strwidth("\0α") == 1 ++@test strwidth("\0w") == charwidth('\0') + charwidth('w') ++@test strwidth("\0α") == charwidth('\0') + charwidth('α') + @test normalize_string("\0W", casefold=true) == "\0w" +-- +2.4.1 + From 63be59abc75eb79eaeaf455608539001624ce420 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 12:37:57 -0500 Subject: [PATCH 21/43] utf8proc: use makeFlags instead of overriding installPhase --- pkgs/development/libraries/utf8proc/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/libraries/utf8proc/default.nix b/pkgs/development/libraries/utf8proc/default.nix index 63de08b46dd7..c8a2fd6a4e99 100644 --- a/pkgs/development/libraries/utf8proc/default.nix +++ b/pkgs/development/libraries/utf8proc/default.nix @@ -11,9 +11,7 @@ stdenv.mkDerivation rec { sha256 = "1ryjlcnpfm7fpkq6444ybi576hbnh2l0w7kjhbqady5lxwjyg3pf"; }; - installPhase = '' - make install prefix=$out - ''; + makeFlags = [ "prefix=$(out)" ]; meta = with stdenv.lib; { description = "A clean C library for processing UTF-8 Unicode data"; From b255f8df2ed76e9696dbbcfefc126a6a84f7e6dc Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 12:38:36 -0500 Subject: [PATCH 22/43] julia03: use system utf8proc --- pkgs/development/compilers/julia/0.3.nix | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 9faeda215936..560298243d23 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -1,7 +1,7 @@ { stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl -, ncurses, libunistring, patchelf, openblas, arpack -, tcl, tk, xproto, libX11, git, mpfr, which +, ncurses, patchelf, openblas, arpack +, tcl, tk, xproto, libX11, git, mpfr, which, utf8proc }: with stdenv.lib; @@ -27,7 +27,6 @@ stdenv.mkDerivation rec { let dsfmt_ver = "2.2"; grisu_ver = "1.1.1"; - utf8proc_ver = "1.1.6"; dsfmt_src = fetchurl { url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmt_ver}.tar.gz"; @@ -38,19 +37,17 @@ stdenv.mkDerivation rec { url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; md5 = "29b533ed4311161267bff1a9a97e2953"; }; - utf8proc_src = fetchurl { - url = "http://www.public-software-group.org/pub/projects/utf8proc/v${utf8proc_ver}/utf8proc-v${utf8proc_ver}.tar.gz"; - md5 = "2462346301fac2994c34f5574d6c3ca7"; - }; - in [ dsfmt_src grisu_src utf8proc_src ]; + in [ dsfmt_src grisu_src ]; buildInputs = [ - gfortran perl m4 gmp pcre llvm readline zlib - fftw fftwSinglePrec libunwind suitesparse glpk ncurses libunistring patchelf - arpack openblas tcl tk xproto libX11 git mpfr which + gfortran gmp pcre llvm readline zlib + fftw fftwSinglePrec libunwind suitesparse glpk ncurses + arpack openblas tcl tk xproto libX11 mpfr utf8proc ]; + nativeBuildInputs = [ patchelf perl m4 which git ]; + makeFlags = let arch = head (splitString "-" stdenv.system); @@ -78,6 +75,8 @@ stdenv.mkDerivation rec { "LIBLAPACKNAME=libopenblas" "USE_SYSTEM_ARPACK=1" + + "USE_SYSTEM_UTF8PROC=1" ]; GLPK_PREFIX = "${glpk}/include"; @@ -109,7 +108,6 @@ stdenv.mkDerivation rec { "-lopenblas" "-lpcre" "-lsuitesparse" - "-lunistring" "-lz" ]; From 6f3dfc0cf886643b3a5e79b2eb7dc412ab9dc833 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 12:48:46 -0500 Subject: [PATCH 23/43] julia03: remove unused dependencies --- pkgs/development/compilers/julia/0.3.nix | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 560298243d23..9f228212a3b1 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -1,14 +1,11 @@ { stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib , readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl , ncurses, patchelf, openblas, arpack -, tcl, tk, xproto, libX11, git, mpfr, which, utf8proc +, git, mpfr, which, utf8proc }: with stdenv.lib; -let - realGcc = stdenv.cc.cc; -in stdenv.mkDerivation rec { pname = "julia"; version = "0.3.9"; @@ -43,7 +40,7 @@ stdenv.mkDerivation rec { [ gfortran gmp pcre llvm readline zlib fftw fftwSinglePrec libunwind suitesparse glpk ncurses - arpack openblas tcl tk xproto libX11 mpfr utf8proc + arpack openblas mpfr utf8proc ]; nativeBuildInputs = [ patchelf perl m4 which git ]; From 1a11b52ffab4c1832f0367fa15142f8b3ebda9c4 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 13:18:45 -0500 Subject: [PATCH 24/43] julia03: use system double_conversion (grisu) --- pkgs/development/compilers/julia/0.3.nix | 43 ++++++++++++------------ 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index 9f228212a3b1..fdf6ee1dec22 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -1,7 +1,11 @@ -{ stdenv, fetchgit, gfortran, perl, m4, llvm, gmp, pcre, zlib -, readline, fftwSinglePrec, fftw, libunwind, suitesparse, glpk, fetchurl -, ncurses, patchelf, openblas, arpack -, git, mpfr, which, utf8proc +{ stdenv, fetchgit, fetchurl +# build tools +, gfortran, git, m4, patchelf, perl, which +# libjulia dependencies +, libunwind, llvm, readline, utf8proc, zlib +# standard library dependencies +, double_conversion, fftwSinglePrec, fftw, glpk, gmp, mpfr, pcre +, openblas, arpack, suitesparse }: with stdenv.lib; @@ -23,34 +27,28 @@ stdenv.mkDerivation rec { extraSrcs = let dsfmt_ver = "2.2"; - grisu_ver = "1.1.1"; dsfmt_src = fetchurl { url = "http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/dSFMT-src-${dsfmt_ver}.tar.gz"; name = "dsfmt-${dsfmt_ver}.tar.gz"; md5 = "cb61be3be7254eae39684612c524740d"; }; - grisu_src = fetchurl { - url = "http://double-conversion.googlecode.com/files/double-conversion-${grisu_ver}.tar.gz"; - md5 = "29b533ed4311161267bff1a9a97e2953"; - }; - in [ dsfmt_src grisu_src ]; + in [ dsfmt_src ]; buildInputs = - [ - gfortran gmp pcre llvm readline zlib - fftw fftwSinglePrec libunwind suitesparse glpk ncurses - arpack openblas mpfr utf8proc + [ libunwind llvm readline utf8proc zlib + double_conversion fftw fftwSinglePrec glpk gmp mpfr pcre + openblas arpack suitesparse ]; - nativeBuildInputs = [ patchelf perl m4 which git ]; + nativeBuildInputs = [ gfortran git m4 patchelf perl which ]; makeFlags = let arch = head (splitString "-" stdenv.system); march = - { - "x86_64-linux" = "x86-64"; + { "x86_64-linux" = "x86-64"; + "x86_64-darwin" = "x86-64"; "i686-linux" = "i686"; }."${stdenv.system}" or (throw "unsupported system: ${stdenv.system}"); in [ @@ -61,8 +59,6 @@ stdenv.mkDerivation rec { "prefix=$(out)" "SHELL=${stdenv.shell}" - "USE_SYSTEM_PATCHELF=1" - "USE_SYSTEM_BLAS=1" "LIBBLAS=-lopenblas" "LIBBLASNAME=libopenblas" @@ -72,7 +68,8 @@ stdenv.mkDerivation rec { "LIBLAPACKNAME=libopenblas" "USE_SYSTEM_ARPACK=1" - + "USE_SYSTEM_GRISU=1" + "USE_SYSTEM_PATCHELF=1" "USE_SYSTEM_UTF8PROC=1" ]; @@ -81,8 +78,10 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = [ "-fPIC" ]; postPatch = '' - sed -e "s@/usr/local/lib@$out/lib@g" -i deps/Makefile - sed -e "s@/usr/lib@$out/lib@g" -i deps/Makefile + sed -i deps/Makefile \ + -e "s@/usr/local/lib@$out/lib@g" \ + -e "s@/usr/lib@$out/lib@g" \ + -e "s@/usr/include/double-conversion@${double_conversion}/include/double-conversion@g" patchShebangs . contrib From 6e3eac5c92036554974b34443e8157b7af9b67df Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 13:31:15 -0500 Subject: [PATCH 25/43] julia03: avoid opaque shell scripts The old expression used a shell script to set some repetitive makeFlags. The makeFlags settings were spread out over different parts of the expression. This deters new contributors. The new expression is clearer, at the cost of being slightly repetitive. --- pkgs/development/compilers/julia/0.3.nix | 61 +++++++++++++----------- 1 file changed, 34 insertions(+), 27 deletions(-) diff --git a/pkgs/development/compilers/julia/0.3.nix b/pkgs/development/compilers/julia/0.3.nix index fdf6ee1dec22..42b296c7b859 100644 --- a/pkgs/development/compilers/julia/0.3.nix +++ b/pkgs/development/compilers/julia/0.3.nix @@ -35,6 +35,29 @@ stdenv.mkDerivation rec { }; in [ dsfmt_src ]; + prePatch = '' + copy_kill_hash(){ + cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')" + } + + for i in $extraSrcs; do + copy_kill_hash "$i" deps + done + ''; + + postPatch = '' + sed -i deps/Makefile \ + -e "s@/usr/local/lib@$out/lib@g" \ + -e "s@/usr/lib@$out/lib@g" \ + -e "s@/usr/include/double-conversion@${double_conversion}/include/double-conversion@g" + + patchShebangs . contrib + + # ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache + # is probably not what we want anyway on non-NixOS + sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* + ''; + buildInputs = [ libunwind llvm readline utf8proc zlib double_conversion fftw fftwSinglePrec glpk gmp mpfr pcre @@ -68,28 +91,25 @@ stdenv.mkDerivation rec { "LIBLAPACKNAME=libopenblas" "USE_SYSTEM_ARPACK=1" + "USE_SYSTEM_FFTW=1" + "USE_SYSTEM_GLPK=1" + "USE_SYSTEM_GMP=1" "USE_SYSTEM_GRISU=1" + "USE_SYSTEM_LIBUNWIND=1" + "USE_SYSTEM_LLVM=1" + "USE_SYSTEM_MPFR=1" "USE_SYSTEM_PATCHELF=1" + "USE_SYSTEM_PCRE=1" + "USE_SYSTEM_READLINE=1" + "USE_SYSTEM_SUITESPARSE=1" "USE_SYSTEM_UTF8PROC=1" + "USE_SYSTEM_ZLIB=1" ]; GLPK_PREFIX = "${glpk}/include"; NIX_CFLAGS_COMPILE = [ "-fPIC" ]; - postPatch = '' - sed -i deps/Makefile \ - -e "s@/usr/local/lib@$out/lib@g" \ - -e "s@/usr/lib@$out/lib@g" \ - -e "s@/usr/include/double-conversion@${double_conversion}/include/double-conversion@g" - - patchShebangs . contrib - - # ldconfig doesn't seem to ever work on NixOS; system-wide ldconfig cache - # is probably not what we want anyway on non-NixOS - sed -e "s@/sbin/ldconfig@true@" -i src/ccall.* - ''; - # Julia tries to load these libraries dynamically at runtime, but they can't be found. # Easier by far to link against them as usual. # These go in LDFLAGS, where they affect only Julia itself, and not NIX_LDFLAGS, @@ -107,20 +127,7 @@ stdenv.mkDerivation rec { "-lz" ]; - configurePhase = '' - for i in GMP LLVM PCRE READLINE FFTW LIBUNWIND SUITESPARSE GLPK ZLIB MPFR; - do - makeFlags="$makeFlags USE_SYSTEM_$i=1 " - done - - copy_kill_hash(){ - cp "$1" "$2/$(basename "$1" | sed -e 's/^[a-z0-9]*-//')" - } - - for i in $extraSrcs; do - copy_kill_hash "$i" deps - done - + preConfigure = '' export PATH="$PATH:${stdenv.cc.libc}/sbin" ''; From 90b2afee040c8c20af58fdcec789e9bb73908b9a Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 13:49:41 -0500 Subject: [PATCH 26/43] haskell-hmatrix: build with openblas Fixes #6392. --- pkgs/development/haskell-modules/configuration-common.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index ade2055187d4..dbb7aadb4a2b 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -119,6 +119,11 @@ self: super: { # Help libconfig find it's C language counterpart. libconfig = (dontCheck super.libconfig).override { config = pkgs.libconfig; }; + hmatrix = overrideCabal super.hmatrix (drv: { + configureFlags = (drv.configureFlags or []) ++ [ "-fopenblas" ]; + extraLibraries = [ pkgs.openblasCompat ]; + }); + # The Haddock phase fails for one reason or another. attoparsec-conduit = dontHaddock super.attoparsec-conduit; base-noprelude = dontHaddock super.base-noprelude; From e729a88474da9e6cccd111a5f7c71f164ab8d784 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 16:49:04 -0500 Subject: [PATCH 27/43] R: build with openblas Fixes #6393. --- pkgs/applications/science/math/R/default.nix | 12 ++++++------ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix index d0adb3382079..72de0677e73a 100644 --- a/pkgs/applications/science/math/R/default.nix +++ b/pkgs/applications/science/math/R/default.nix @@ -1,7 +1,7 @@ -{ stdenv, fetchurl, blas, bzip2, gfortran, liblapack, libX11, libXmu, libXt +{ 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, atlas +, imake, which, jdk, openblas , withRecommendedPackages ? true }: @@ -13,10 +13,10 @@ stdenv.mkDerivation rec { sha256 = "0dagyqgvi8i3nw158qi2zpwm04s4ffzvnmk5niaksvxs30zrbbpm"; }; - buildInputs = [ blas bzip2 gfortran liblapack libX11 libXmu libXt + buildInputs = [ bzip2 gfortran libX11 libXmu libXt libXt libjpeg libpng libtiff ncurses pango pcre perl readline tcl texLive tk xz zlib less texinfo graphviz icu pkgconfig bison imake - which jdk atlas + which jdk openblas ]; patches = [ ./no-usr-local-search-paths.patch ]; @@ -25,8 +25,8 @@ stdenv.mkDerivation rec { configureFlagsArray=( --disable-lto --with${stdenv.lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages - --with-blas="-L${atlas}/lib -lf77blas -latlas" - --with-lapack="-L${liblapack}/lib -llapack" + --with-blas="-L${openblas}/lib -lopenblas" + --with-lapack="-L${openblas}/lib -lopenblas" --with-readline --with-tcltk --with-tcl-config="${tcl}/lib/tclConfig.sh" --with-tk-config="${tk}/lib/tkConfig.sh" --with-cairo diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 0e96c04b7d83..9f95e32e9511 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -8556,6 +8556,7 @@ let R = callPackage ../applications/science/math/R { inherit (xlibs) libX11 libXt; texLive = texLiveAggregationFun { paths = [ texLive texLiveExtra ]; }; + openblas = openblasCompat; withRecommendedPackages = false; }; From bfe106cfa6613c4ab5c6b7aa6a0650e11bc63267 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 4 Jun 2015 17:17:40 -0500 Subject: [PATCH 28/43] Build numpy and scipy with openblas Fixes #6772. --- .../python-modules/numpy-scipy-support.nix | 14 +++++++------- pkgs/top-level/python-packages.nix | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pkgs/development/python-modules/numpy-scipy-support.nix b/pkgs/development/python-modules/numpy-scipy-support.nix index 22be22633c20..915b27cb4cd3 100644 --- a/pkgs/development/python-modules/numpy-scipy-support.nix +++ b/pkgs/development/python-modules/numpy-scipy-support.nix @@ -3,14 +3,14 @@ python, # Name of package (e.g. numpy or scipy) pkgName, - # Atlas math library - atlas + # OpenBLAS math library + openblas }: { - # Re-export atlas here so that it can be sure that the same one will be used + # Re-export openblas here so that it can be sure that the same one will be used # in the propagatedBuildInputs. - inherit atlas; + inherit openblas; # First "install" the package, then import what was installed, and call the # .test() function, which will run the test suite. @@ -48,9 +48,9 @@ preBuild = '' echo "Creating site.cfg file..." cat << EOF > site.cfg - [atlas] - include_dirs = ${atlas}/include - library_dirs = ${atlas}/lib + [openblas] + include_dirs = ${openblas}/include + library_dirs = ${openblas}/lib EOF ''; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index a5ad7e46f4f2..80931ecfe1f6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7798,7 +7798,7 @@ let numpy = let support = import ../development/python-modules/numpy-scipy-support.nix { inherit python; - atlas = pkgs.atlasWithLapack; + openblas = pkgs.openblasCompat; pkgName = "numpy"; }; in buildPythonPackage ( rec { @@ -7821,7 +7821,7 @@ let setupPyBuildFlags = ["--fcompiler='gnu95'"]; buildInputs = [ pkgs.gfortran self.nose ]; - propagatedBuildInputs = [ support.atlas ]; + propagatedBuildInputs = [ support.openblas ]; meta = { description = "Scientific tools for Python"; @@ -11260,7 +11260,7 @@ let scipy = let support = import ../development/python-modules/numpy-scipy-support.nix { inherit python; - atlas = pkgs.atlasWithLapack; + openblas = pkgs.openblasCompat; pkgName = "numpy"; }; in buildPythonPackage rec { From fa290cb741cb23a04024f09e2018d5ea7bc0e3a3 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 7 Jun 2015 13:44:24 -0500 Subject: [PATCH 29/43] qrupdate: build with openblas Replaces ATLAS and LAPACK with OpenBLAS. Also builds both static and shared libraries. (Octave upstream recommends the shared library.) --- .../libraries/qrupdate/default.nix | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix index 465ec7eebb2b..aaa9ab8a61ad 100644 --- a/pkgs/development/libraries/qrupdate/default.nix +++ b/pkgs/development/libraries/qrupdate/default.nix @@ -1,29 +1,34 @@ { stdenv , fetchurl , gfortran -, liblapack +, openblas }: stdenv.mkDerivation { name = "qrupdate-1.1.2"; src = fetchurl { url = mirror://sourceforge/qrupdate/qrupdate-1.1.2.tar.gz ; - sha256 = "024f601685phcm1pg8lhif3lpy5j9j0k6n0r46743g4fvh8wg8g2"; + sha256 = "024f601685phcm1pg8lhif3lpy5j9j0k6n0r46743g4fvh8wg8g2"; }; - - configurePhase = '' - export PREFIX=$out - sed -i -e 's,^BLAS=.*,BLAS=-L${liblapack}/lib -L${liblapack.blas} -lcblas -lf77blas -latlas,' \ - -e 's,^LAPACK=.*,LAPACK=-L${liblapack}/lib -llapack -lcblas -lf77blas -latlas,' \ - Makeconf - ''; + + configurePhase = + '' + export PREFIX=$out + sed -i -e 's,^BLAS=.*,BLAS=-L${openblas}/lib -lopenblas,' \ + -e 's,^LAPACK=.*,LAPACK=-L${openblas}/lib -lopenblas,' \ + Makeconf + '' + + stdenv.lib.optionalString openblas.blas64 + '' + sed -i Makeconf -e '/^FFLAGS=.*/ s/$/-fdefault-integer-8/' + ''; doCheck = true; checkTarget = "test"; - buildTarget = "lib"; + buildFlags = [ "lib" "solib" ]; - installTarget = "install-staticlib"; - - buildInputs = [ gfortran liblapack ]; + installTargets = "install"; + + buildInputs = [ gfortran openblas ]; } From 614c867b29299668dced9ab705bacebcd433bef3 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Sun, 7 Jun 2015 13:45:36 -0500 Subject: [PATCH 30/43] octave: build with openblas The expression inherits integer width from OpenBLAS, so Octave will use 64-bit integers if OpenBLAS supports it. However, this feature in Octave is experimental, so we continue to use OpenBLAS with 32-bit integers by default. (This only applies to the integer width, the pointer width is always the platform-native width.) --- .../interpreters/octave/default.nix | 26 ++++++++++++++++--- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix index 9ad8c2790da6..bdf6f7752777 100644 --- a/pkgs/development/interpreters/octave/default.nix +++ b/pkgs/development/interpreters/octave/default.nix @@ -1,10 +1,22 @@ { stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, texinfo, qhull -, libX11, graphicsmagick, pcre, liblapack, pkgconfig, mesa, fltk -, fftw, fftwSinglePrec, zlib, curl, qrupdate +, libX11, graphicsmagick, pcre, pkgconfig, mesa, fltk +, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas , qt ? null, qscintilla ? null, ghostscript ? null, llvm ? null, hdf5 ? null,glpk ? null , suitesparse ? null, gnuplot ? null, jdk ? null, python ? null }: +let + suitesparseOrig = suitesparse; + qrupdateOrig = qrupdate; +in +# integer width is determined by openblas, so all dependencies must be built +# with exactly the same openblas +let + suitesparse = + if suitesparseOrig != null then suitesparseOrig.override { inherit openblas; } else null; + qrupdate = if qrupdateOrig != null then qrupdateOrig.override { inherit openblas; } else null; +in + stdenv.mkDerivation rec { version = "4.0.0"; name = "octave-${version}"; @@ -14,7 +26,7 @@ stdenv.mkDerivation rec { }; buildInputs = [ gfortran readline ncurses perl flex texinfo qhull libX11 - graphicsmagick pcre liblapack pkgconfig mesa fltk zlib curl + graphicsmagick pcre pkgconfig mesa fltk zlib curl openblas fftw fftwSinglePrec qrupdate ] ++ (stdenv.lib.optional (qt != null) qt) ++ (stdenv.lib.optional (qscintilla != null) qscintilla) @@ -34,7 +46,13 @@ stdenv.mkDerivation rec { # problems on Hydra enableParallelBuilding = false; - configureFlags = [ "--enable-readline" "--enable-dl" ]; + configureFlags = + [ "--enable-readline" + "--enable-dl" + "--with-blas=openblas" + "--with-lapack=openblas" + ] + ++ stdenv.lib.optional openblas.blas64 "--enable-64"; # Keep a copy of the octave tests detailed results in the output # derivation, because someone may care diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9f95e32e9511..69c46414c9e3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -4820,6 +4820,7 @@ let glpk = null; suitesparse = null; jdk = null; + openblas = openblasCompat; }; octaveFull = (lowPrio (callPackage ../development/interpreters/octave { fltk = fltk13.override { cfg.xftSupport = true; }; From 71b848b45dc58d7e75eb7f07b214fb8c62e5f58d Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 06:34:52 -0500 Subject: [PATCH 31/43] openblas: build with USE_OPENMP=0 on Darwin Darwin's clang does not support OpenMP yet. OpenMP is required on other platforms for e.g. Julia. --- pkgs/development/libraries/science/math/openblas/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix index ef76c33fb6d5..a4bf1efbb731 100644 --- a/pkgs/development/libraries/science/math/openblas/default.nix +++ b/pkgs/development/libraries/science/math/openblas/default.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation rec { "CC=${if stdenv.isDarwin then "clang" else "gcc"}" ''PREFIX="''$(out)"'' "BINARY=${binary}" - "USE_OPENMP=1" + "USE_OPENMP=${if stdenv.isDarwin then "0" else "1"}" "INTERFACE64=${if blas64 then "1" else "0"}" ]; From b120a737fd3f2871af7d57c88c010884041ce6d4 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 11:43:00 -0500 Subject: [PATCH 32/43] rPackages.BayesLogit: build with openblas --- pkgs/development/r-modules/default.nix | 1 + pkgs/development/r-modules/patches/BayesLogit_cblas.patch | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 11d7193edee7..4bad1224cc1a 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -1087,6 +1087,7 @@ let BayesLogit = old.BayesLogit.overrideDerivation (attrs: { patches = [ ./patches/BayesLogit.patch ]; + buildInputs = (attrs.buildInputs or []) ++ [ pkgs.openblasCompat ]; }); BayesBridge = old.BayesBridge.overrideDerivation (attrs: { diff --git a/pkgs/development/r-modules/patches/BayesLogit_cblas.patch b/pkgs/development/r-modules/patches/BayesLogit_cblas.patch index 4c8778c46976..ef776f3531da 100644 --- a/pkgs/development/r-modules/patches/BayesLogit_cblas.patch +++ b/pkgs/development/r-modules/patches/BayesLogit_cblas.patch @@ -6,7 +6,7 @@ diff -ru -x '*~' BayesLogit_orig/src/Makevars BayesLogit/src/Makevars OBJECTS = Matrix.o MatrixFrame.o RRNG.o RNG.o FSF_nmix.o LogitWrapper.o \ PolyaGamma.o PolyaGammaAlt.o PolyaGammaSP.o InvertY.o -PKG_LIBS = $(BLAS_LIBS) $(FLIBS) $(LAPACK_LIBS) -+PKG_LIBS = $(BLAS_LIBS) $(FLIBS) $(LAPACK_LIBS) -llapack -lf77blas -lcblas -latlas -lgfortran ++PKG_LIBS = $(BLAS_LIBS) $(FLIBS) $(LAPACK_LIBS) -lopenblas # PKG_CPPFLAGS = -DUSE_R -DNDEBUG -DDISABLE_SINGLE -DNTHROW -Wall -pedantic -Wextra PKG_CPPFLAGS = -DUSE_R -DNDEBUG -DDISABLE_SINGLE -DNTHROW From 77aa1c990ec673446c38b4c733f8ad7db9e66af1 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 11:47:12 -0500 Subject: [PATCH 33/43] rPackages.Mposterior: build with openblas --- pkgs/development/r-modules/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 4bad1224cc1a..2f387599d6df 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -997,7 +997,7 @@ let }); Mposterior = old.Mposterior.overrideDerivation (attrs: { - PKG_LIBS = "-L${pkgs.atlas}/lib -lf77blas -latlas"; + PKG_LIBS = "-L${pkgs.openblasCompat}/lib -lopenblas"; }); qtbase = old.qtbase.overrideDerivation (attrs: { From 58754130cc3f34169de05f7ef14a9102221f5f13 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 11:47:26 -0500 Subject: [PATCH 34/43] rPackages.slfm: build with openblas --- pkgs/development/r-modules/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 2f387599d6df..2d211ed9a5b4 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -1037,7 +1037,7 @@ let }); slfm = old.slfm.overrideDerivation (attrs: { - PKG_LIBS = "-L${pkgs.atlas}/lib -lf77blas -latlas"; + PKG_LIBS = "-L${pkgs.openblasCompat}/lib -lopenblas"; }); SamplerCompare = old.SamplerCompare.overrideDerivation (attrs: { From 8245caedf158ca91997412f8797f1802e2c8a925 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 11:47:40 -0500 Subject: [PATCH 35/43] rPackages.SamplerCompare: build with openblas --- pkgs/development/r-modules/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index 2d211ed9a5b4..2f8c22fe8658 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -1041,7 +1041,7 @@ let }); SamplerCompare = old.SamplerCompare.overrideDerivation (attrs: { - PKG_LIBS = "-L${pkgs.atlas}/lib -lf77blas -latlas"; + PKG_LIBS = "-L${pkgs.openblasCompat}/lib -lopenblas"; }); gputools = old.gputools.overrideDerivation (attrs: { From 406428d6a4641f0a1a05e58a3b09f7d183059cfd Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 13:48:36 -0500 Subject: [PATCH 36/43] haskellPackages.bindings-levmar: build with openblas --- pkgs/development/haskell-modules/configuration-common.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index dbb7aadb4a2b..7f55abc4ddab 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -124,6 +124,14 @@ self: super: { extraLibraries = [ pkgs.openblasCompat ]; }); + bindings-levmar = overrideCabal super.bindings-levmar (drv: { + preConfigure = '' + sed -i bindings-levmar.cabal \ + -e 's,extra-libraries: lapack blas,extra-libraries: openblas,' + ''; + extraLibraries = [ pkgs.openblas ]; + }); + # The Haddock phase fails for one reason or another. attoparsec-conduit = dontHaddock super.attoparsec-conduit; base-noprelude = dontHaddock super.base-noprelude; From 661ce66483b8f8850f50452531e34e5b7d553389 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Tue, 9 Jun 2015 14:31:19 -0500 Subject: [PATCH 37/43] haskellPackages.hmatrix: remove impure openblas path --- pkgs/development/haskell-modules/configuration-common.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 7f55abc4ddab..03359133a5f4 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -122,6 +122,9 @@ self: super: { hmatrix = overrideCabal super.hmatrix (drv: { configureFlags = (drv.configureFlags or []) ++ [ "-fopenblas" ]; extraLibraries = [ pkgs.openblasCompat ]; + preConfigure = '' + sed -i hmatrix.cabal -e 's@/usr/lib/openblas/lib@${pkgs.openblasCompat}/lib@' + ''; }); bindings-levmar = overrideCabal super.bindings-levmar (drv: { From bc3217251e4fb8dd9d648b41d963d8804a0d8f67 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 11 Jun 2015 19:23:25 -0500 Subject: [PATCH 38/43] pythonPackages.scikitlearn: build with openblas --- pkgs/top-level/python-packages.nix | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 80931ecfe1f6..c05aff22a5d6 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -11298,15 +11298,14 @@ let }; buildInputs = with self; [ nose pillow pkgs.gfortran pkgs.glibcLocales ]; - propagatedBuildInputs = with self; [ numpy scipy pkgs.atlas ]; + propagatedBuildInputs = with self; [ numpy scipy pkgs.openblas ]; buildPhase = '' - export ATLAS=${pkgs.atlas} ${self.python.executable} setup.py build_ext -i --fcompiler='gnu95' ''; checkPhase = '' - LC_ALL="en_US.UTF-8" HOME=$TMPDIR ATLAS="" nosetests + LC_ALL="en_US.UTF-8" HOME=$TMPDIR OMP_NUM_THREADS=1 nosetests ''; meta = { From 29db05132b5e0921e3fae35d62c30634e85a271f Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 11 Jun 2015 19:35:35 -0500 Subject: [PATCH 39/43] pythonPackages.cvxopt: build with openblas --- pkgs/top-level/python-packages.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index c05aff22a5d6..cb649a2ec972 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1011,7 +1011,12 @@ let sha256 = "f856ea2e9e2947abc1a6557625cc6b0e45228984f397a90c420b2f468dc4cb97"; }; doCheck = false; - buildInputs = with pkgs; [ liblapack blas ]; + buildInputs = with pkgs; [ openblasCompat ]; + preConfigure = '' + export CVXOPT_BLAS_LIB_DIR=${pkgs.openblasCompat}/lib + export CVXOPT_BLAS_LIB=openblas + export CVXOPT_LAPACK_LIB=openblas + ''; meta = { homepage = "http://cvxopt.org/"; description = "Python Software for Convex Optimization"; From 089f9d6486b9c0d5f27b116468ca131697ef8e16 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Thu, 11 Jun 2015 22:00:13 -0500 Subject: [PATCH 40/43] gnuapl: latest version doesn't require liblapack --- pkgs/development/interpreters/gnu-apl/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/interpreters/gnu-apl/default.nix b/pkgs/development/interpreters/gnu-apl/default.nix index 687b7319cf48..444621614071 100644 --- a/pkgs/development/interpreters/gnu-apl/default.nix +++ b/pkgs/development/interpreters/gnu-apl/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, liblapack, readline, gettext, ncurses }: +{ stdenv, fetchurl, readline, gettext, ncurses }: stdenv.mkDerivation rec { name = "gnu-apl-${version}"; @@ -9,7 +9,7 @@ stdenv.mkDerivation rec { sha256 = "0h4diq3wfbdwxp5nm0z4b0p1zq13lwip0y7v28r9v0mbbk8xsfh1"; }; - buildInputs = [ liblapack readline gettext ncurses ]; + buildInputs = [ readline gettext ncurses ]; postInstall = '' cp -r support-files/ $out/share/doc/ From 74e4f6befab4514c6ee5bef7a4f3cfdae302ce68 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 12 Jun 2015 07:26:47 -0500 Subject: [PATCH 41/43] ipopt: build with openblas --- .../development/libraries/science/math/ipopt/default.nix | 9 +++++++-- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix index 4dd1ca46e956..89d2a242f963 100644 --- a/pkgs/development/libraries/science/math/ipopt/default.nix +++ b/pkgs/development/libraries/science/math/ipopt/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, unzip, blas, liblapack, gfortran }: +{ stdenv, fetchurl, unzip, openblas, gfortran }: stdenv.mkDerivation rec { version = "3.12.3"; @@ -13,9 +13,14 @@ stdenv.mkDerivation rec { export CXXDEFS="-DHAVE_RAND -DHAVE_CSTRING -DHAVE_CSTDIO" ''; + configureFlags = [ + "--with-blas-lib=-lopenblas" + "--with-lapack-lib=-lopenblas" + ]; + nativeBuildInputs = [ unzip ]; - buildInputs = [ gfortran blas liblapack ]; + buildInputs = [ gfortran openblas ]; enableParallelBuilding = true; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 69c46414c9e3..937c404d74f6 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13883,7 +13883,7 @@ let suitesparse_4_4 = callPackage ../development/libraries/science/math/suitesparse {}; suitesparse = suitesparse_4_4; - ipopt = callPackage ../development/libraries/science/math/ipopt { }; + ipopt = callPackage ../development/libraries/science/math/ipopt { openblas = openblasCompat; }; ### SCIENCE/MOLECULAR-DYNAMICS From 4fb98dd6a760315f5219e15d599200271d890ef3 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 12 Jun 2015 07:56:04 -0500 Subject: [PATCH 42/43] jags: build with openblas --- pkgs/applications/science/math/jags/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/science/math/jags/default.nix b/pkgs/applications/science/math/jags/default.nix index 785c2460bb49..9d70d2686911 100644 --- a/pkgs/applications/science/math/jags/default.nix +++ b/pkgs/applications/science/math/jags/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, gfortran, liblapack, blas}: +{stdenv, fetchurl, gfortran, openblas}: stdenv.mkDerivation rec { name = "JAGS-3.4.0"; @@ -6,7 +6,8 @@ stdenv.mkDerivation rec { url = "mirror://sourceforge/mcmc-jags/${name}.tar.gz"; sha256 = "0ayqsz9kkmbss7mxlwr34ch2z1vsb65lryjzqpprab1ccyiaksib"; }; - buildInputs = [gfortran liblapack blas]; + buildInputs = [gfortran openblas]; + configureFlags = [ "--with-blas=-lopenblas" "--with-lapack=-lopenblas" ]; meta = { description = "Just Another Gibbs Sampler"; From c02dd4a7260f36901088830ae23d9723968ed066 Mon Sep 17 00:00:00 2001 From: Thomas Tuegel Date: Fri, 12 Jun 2015 08:04:02 -0500 Subject: [PATCH 43/43] Update release notes about OpenBLAS --- nixos/doc/manual/release-notes/rl-unstable.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/nixos/doc/manual/release-notes/rl-unstable.xml b/nixos/doc/manual/release-notes/rl-unstable.xml index cf67014a69dd..fcbf6ed0addc 100644 --- a/nixos/doc/manual/release-notes/rl-unstable.xml +++ b/nixos/doc/manual/release-notes/rl-unstable.xml @@ -153,6 +153,19 @@ nix-env -f "<nixpkgs>" -iA haskellPackages.cabal-install + + + The OpenBLAS library has been updated to version + 0.2.14. Support for the + x86_64-darwin platform was added. Dynamic + architecture detection was enabled; OpenBLAS now selects + microarchitecture-optimized routines at runtime, so optimal + performance is achieved without the need to rebuild OpenBLAS + locally. OpenBLAS has replaced ATLAS in most packages which use an + optimized BLAS or LAPACK implementation. + + +