all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Add Julia.
@ 2015-03-20 11:16 Ricardo Wurmus
  2015-03-23  9:29 ` Ludovic Courtès
  2015-03-23 21:35 ` Mark H Weaver
  0 siblings, 2 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2015-03-20 11:16 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1770 bytes --]

Hi Guix,

attached is a patch to add Julia, a language for technical computing,
and one more library it depends on: double-conversion.

The release tarball comes with all dependencies bundled, but I tried
hard to make it build against system libraries.  This didn't always
work, unfortunately.

libuv : Julia comes with a modified version of libuv and it won't build
        with our libuv package at this point.  This has been confirmed
        upstream[1].

dSMFT : Upstream's Makefile does not have targets to build dSMFT as a
        library.  The Makefile is only used to build test programmes.  I
        have a rudimentary package for dSMFT ready, but it would have to
        include a patch to the Makefile to actually build libraries.

rmath : Julia uses a version of rmath that is patched to use the dSMFT
        random number generator.  Upstream highly recommends using the
        patched library.

suitesparse : Unfortunately, suitesparse only builds static libraries,
        not shared ones, while Julia expects to find shared libraries.
        I'm not sure what to patch here: Julia's build system so that it
        builds shared libs from the suitesparse package output (rather
        than the bundled tarball) or suitesparse such that it also
        provides shared libs.

This package depends on a couple of other packages that are still
awaiting review:

- double-conversion (patch attached below)
- openblas[2] (needed because Julia doesn't build against Atlas)
- utf8proc[3]

TIA for the review!

~~ Ricardo

----------
[1]: https://github.com/JuliaLang/julia/issues/10246#issuecomment-75029026
[2]: http://lists.gnu.org/archive/html/guix-devel/2015-03/msg00557.html
[3]: http://lists.gnu.org/archive/html/guix-devel/2015-03/msg00563.html



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-double-conversion.patch --]
[-- Type: text/x-patch, Size: 1818 bytes --]

From dfe39329d60b38b684141cc0ce1d2bccd7ab637e Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 20 Mar 2015 12:11:35 +0100
Subject: [PATCH 1/2] gnu: Add double-conversion.

* gnu/packages/maths.scm (double-conversion): New variable.
---
 gnu/packages/maths.scm | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0d2efdd..cb6fa66 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -92,6 +92,32 @@ effectively as a scientific calculator.")
    (license license:gpl3+)
    (home-page "http://www.gnu.org/software/units/")))
 
+(define-public double-conversion
+  (package
+    (name "double-conversion")
+    (version "1.1.5")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/floitsch/double-conversion/archive/v"
+                    version ".tar.gz"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0cnr8xhyjfxijay8ymkqcph3672wp2lj23qhdmr3m4kia5kpdf83"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:test-target "test"
+       #:configure-flags '("-DBUILD_SHARED_LIBS=ON"
+                           "-DBUILD_TESTING=ON")))
+    (home-page "https://github.com/floitsch/double-conversion")
+    (synopsis "Conversion routines for IEEE doubles")
+    (description
+     "The double-conversion library provides binary-decimal and decimal-binary
+routines for IEEE doubles.  The library consists of efficient conversion
+routines that have been extracted from the V8 JavaScript engine.")
+    (license license:bsd-3)))
+
 (define-public dionysus
   (package
     (name "dionysus")
-- 
2.1.0


[-- Attachment #3: 0002-gnu-Add-Julia.patch --]
[-- Type: text/x-patch, Size: 8457 bytes --]

From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
Date: Fri, 20 Mar 2015 11:26:23 +0100
Subject: [PATCH 2/2] gnu: Add Julia.

* gnu/packages/julia.scm: New file.
* gnu-system.am (GNU_SYSTEM_MODULES): Add it.
---
 gnu-system.am          |   1 +
 gnu/packages/julia.scm | 172 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 gnu/packages/julia.scm

diff --git a/gnu-system.am b/gnu-system.am
index 2bed50f..75a98bf 100644
--- a/gnu-system.am
+++ b/gnu-system.am
@@ -156,6 +156,7 @@ GNU_SYSTEM_MODULES =				\
   gnu/packages/iso-codes.scm			\
   gnu/packages/java.scm				\
   gnu/packages/jrnl.scm				\
+  gnu/packages/julia.scm			\
   gnu/packages/kde.scm				\
   gnu/packages/key-mon.scm			\
   gnu/packages/language.scm			\
diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
new file mode 100644
index 0000000..844f1b2
--- /dev/null
+++ b/gnu/packages/julia.scm
@@ -0,0 +1,172 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
+;;;
+;;; This file is part of GNU Guix.
+;;;
+;;; GNU Guix is free software; you can redistribute it and/or modify it
+;;; under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 3 of the License, or (at
+;;; your option) any later version.
+;;;
+;;; GNU Guix is distributed in the hope that it will be useful, but
+;;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
+
+(define-module (gnu packages julia)
+  #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages algebra)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages elf)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages llvm)
+  #:use-module (gnu packages libunwind)
+  #:use-module (gnu packages maths)
+  #:use-module (gnu packages multiprecision) ; mpfr
+  #:use-module (gnu packages pcre)
+  #:use-module (gnu packages perl)
+  #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages python)
+  #:use-module (gnu packages textutils)
+  #:use-module (gnu packages version-control))
+
+(define-public julia
+  (package
+    (name "julia")
+    (version "0.3.6")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "https://github.com/JuliaLang/julia/releases/download/v"
+                    version "/julia-" version "_0c24dca65c.tar.gz"))
+              (sha256
+               (base32
+                "1hnbc2blzr9bc27m3vsr127fhg0h5imgqlrx00jakf0my0ccw8gr"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:test-target "test"
+       #:modules ((ice-9 match)
+                  (guix build gnu-build-system)
+                  (guix build utils))
+       #:phases
+       (alist-cons-after
+        'unpack 'hardcode-soname-map
+        ;; ./src/ccall.cpp creates a map from library names to paths using the
+        ;; output of "/sbin/ldconfig -p".  Since ldconfig is not used in Guix,
+        ;; we patch ccall.cpp to contain a static map.
+        (lambda* (#:key inputs #:allow-other-keys)
+          (use-modules (ice-9 match))
+          (substitute* "src/ccall.cpp"
+            (("jl_read_sonames.*;")
+             (string-join
+              (map (match-lambda
+                    ((input libname soname)
+                     (string-append
+                      "sonameMap[\"" libname "\"] = "
+                      "\"" (assoc-ref inputs input) "/lib/" soname "\";")))
+                   '(("libc"        "libc"           "libc.so.6")
+                     ("pcre"        "libpcre"        "libpcre.so")
+                     ("mpfr"        "libmpfr"        "libmpfr.so")
+                     ("openblas"    "libblas"        "libopenblas.so")
+                     ("arpack-ng"   "libarpack"      "libarpack.so")
+                     ("lapack"      "liblapack"      "liblapack.so")
+                     ("gmp"         "libgmp"         "libgmp.so")
+                     ("openlibm"    "libopenlibm"    "libopenlibm.so")
+                     ("openspecfun" "libopenspecfun" "libopenspecfun.so")
+                     ("fftw"        "libfftw3"       "libfftw3.so")
+                     ("fftwf"       "libfftw3f"      "libfftw3f.so")))))))
+        (alist-cons-before
+         'build 'replace-default-shell
+         (lambda _
+           (substitute* "base/client.jl"
+             (("/bin/sh") (which "sh"))))
+         (alist-cons-before
+          'build 'patch-include-path
+          (lambda _
+            (substitute* "deps/Makefile"
+              (("/usr/include/double-conversion")
+               (string-append (assoc-ref %build-inputs "double-conversion")
+                              "/include/double-conversion"))))
+          (alist-cons-before
+           'check 'disable-broken-test
+           ;; One test fails because it produces slightly different output.
+           (lambda _
+             (substitute* "test/repl.jl"
+               (("@test output") "# @test output")))
+           ;; no configure script
+           (alist-delete 'configure %standard-phases)))))
+       #:make-flags
+       (list
+        (string-append "prefix=" (assoc-ref %outputs "out"))
+        "CONFIG_SHELL=bash"     ;needed to build bundled libraries
+        "USE_SYSTEM_LIBUV=0"    ;Julia expects a modified libuv
+        "USE_SYSTEM_DSFMT=0"    ;not packaged for Guix and upstream has no
+                                ;build system for a shared library.
+        "USE_SYSTEM_RMATH=0"    ;Julia uses a bundled version of R's math
+                                ;library, patched to use the DSFMT RNG.
+
+        "USE_SYSTEM_LAPACK=1"
+        "USE_SYSTEM_BLAS=1"
+        "USE_BLAS64=0"          ;needed when USE_SYSTEM_BLAS=1
+
+        "USE_SYSTEM_FFTW=1"
+        "LIBFFTWNAME=libfftw3"
+        "LIBFFTWFNAME=libfftw3f"
+
+        ;; TODO: Suitesparse does not install shared libraries, so we cannot
+        ;; use the suitesparse package.
+        ;; "USE_SYSTEM_SUITESPARSE=1"
+        ;; (string-append "SUITESPARSE_INC=-I "
+        ;;                (assoc-ref %build-inputs "suitesparse")
+        ;;                "/include")
+
+        "USE_SYSTEM_GRISU=1"    ;for double-conversion
+        "USE_SYSTEM_UTF8PROC=1"
+        "USE_SYSTEM_LLVM=1"
+        "USE_SYSTEM_LIBUNWIND=1"
+        "USE_SYSTEM_PCRE=1"
+        "USE_SYSTEM_OPENLIBM=1"
+        "USE_SYSTEM_GMP=1"
+        "USE_SYSTEM_MPFR=1"
+        "USE_SYSTEM_ARPACK=1"
+        "USE_SYSTEM_LIBGIT2=1"
+        "USE_SYSTEM_OPENSPECFUN=1")))
+    (inputs
+     `(("llvm" ,llvm-3.5)
+       ("arpack-ng" ,arpack-ng)
+       ("lapack" ,lapack)
+       ("openblas" ,openblas) ;Julia does not build with Atlas
+       ("libunwind" ,libunwind)
+       ("openlibm" ,openlibm)
+       ("openspecfun" ,openspecfun)
+       ("double-conversion" ,double-conversion)
+       ("fftw" ,fftw)
+       ("fftwf" ,fftwf)
+       ("fortran" ,gfortran-4.8)
+       ("pcre" ,pcre)
+       ("utf8proc" ,utf8proc)
+       ("git" ,git)
+       ("mpfr" ,mpfr)
+       ("gmp" ,gmp)))
+    (native-inputs
+     `(("perl" ,perl)
+       ("patchelf" ,patchelf)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-2)
+       ("which" ,which)))
+    (home-page "http://julialang.org/")
+    (synopsis "High-performance dynamic language for technical computing")
+    (description
+     "Julia is a high-level, high-performance dynamic programming language for
+technical computing, with syntax that is familiar to users of other technical
+computing environments.  It provides a sophisticated compiler, distributed
+parallel execution, numerical accuracy, and an extensive mathematical function
+library.")
+    (license license:expat)))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-20 11:16 [PATCH] Add Julia Ricardo Wurmus
@ 2015-03-23  9:29 ` Ludovic Courtès
  2015-03-23 21:35 ` Mark H Weaver
  1 sibling, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2015-03-23  9:29 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> The release tarball comes with all dependencies bundled, but I tried
> hard to make it build against system libraries.  This didn't always
> work, unfortunately.
>
> libuv : Julia comes with a modified version of libuv and it won't build
>         with our libuv package at this point.  This has been confirmed
>         upstream[1].
>
> dSMFT : Upstream's Makefile does not have targets to build dSMFT as a
>         library.  The Makefile is only used to build test programmes.  I
>         have a rudimentary package for dSMFT ready, but it would have to
>         include a patch to the Makefile to actually build libraries.
>
> rmath : Julia uses a version of rmath that is patched to use the dSMFT
>         random number generator.  Upstream highly recommends using the
>         patched library.

OK.  It’s reasonable to leave them as is, perhaps with a link to your
message in a comment.

> suitesparse : Unfortunately, suitesparse only builds static libraries,
>         not shared ones, while Julia expects to find shared libraries.
>         I'm not sure what to patch here: Julia's build system so that it
>         builds shared libs from the suitesparse package output (rather
>         than the bundled tarball) or suitesparse such that it also
>         provides shared libs.

I would patch suitesparse to produce shared libs, but if it’s a
“hand-made” build system, it’ll probably have to produce either shared
libs or static libs, but not both (which would require building both PIC
and non-PIC objects, etc.)  Having it build shared libs only is probably
OK.

Regardless, it’s OK to push Julia as is for now, and adjust suitesparse
and Julia in eventual commits.

> This package depends on a couple of other packages that are still
> awaiting review:
>
> - double-conversion (patch attached below)
> - openblas[2] (needed because Julia doesn't build against Atlas)
> - utf8proc[3]

I think these two are done now, no?

> From dfe39329d60b38b684141cc0ce1d2bccd7ab637e Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Fri, 20 Mar 2015 12:11:35 +0100
> Subject: [PATCH 1/2] gnu: Add double-conversion.
>
> * gnu/packages/maths.scm (double-conversion): New variable.

LGTM.

> From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Fri, 20 Mar 2015 11:26:23 +0100
> Subject: [PATCH 2/2] gnu: Add Julia.
>
> * gnu/packages/julia.scm: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

LGTM.

Thank you!

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-20 11:16 [PATCH] Add Julia Ricardo Wurmus
  2015-03-23  9:29 ` Ludovic Courtès
@ 2015-03-23 21:35 ` Mark H Weaver
  2015-03-24 14:56   ` Mark H Weaver
  1 sibling, 1 reply; 13+ messages in thread
From: Mark H Weaver @ 2015-03-23 21:35 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
> Date: Fri, 20 Mar 2015 11:26:23 +0100
> Subject: [PATCH 2/2] gnu: Add Julia.
>
> * gnu/packages/julia.scm: New file.
> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.

Hydra was unable to successfully build Julia on any platform.  See:

  http://hydra.gnu.org/build/339221
  http://hydra.gnu.org/build/339192

     Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-23 21:35 ` Mark H Weaver
@ 2015-03-24 14:56   ` Mark H Weaver
  2015-03-24 17:14     ` Ricardo Wurmus
  0 siblings, 1 reply; 13+ messages in thread
From: Mark H Weaver @ 2015-03-24 14:56 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
>> From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
>> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
>> Date: Fri, 20 Mar 2015 11:26:23 +0100
>> Subject: [PATCH 2/2] gnu: Add Julia.
>>
>> * gnu/packages/julia.scm: New file.
>> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
>
> Hydra was unable to successfully build Julia on any platform.  See:
>
>   http://hydra.gnu.org/build/339221
>   http://hydra.gnu.org/build/339192

The illegal instruction errors are in openblas, which is marked
non-substitutable because it apparently builds itself customized to the
CPU on the build machine.  So, I guess openblas might have been built on
a build slave with more processor features than the one used to build
Julia.

Perhaps the answer is that Julia shouldn't be built by Hydra, because
one of its transitive inputs is non-substitutable.

   Thoughts?
      Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-24 14:56   ` Mark H Weaver
@ 2015-03-24 17:14     ` Ricardo Wurmus
  2015-03-24 20:45       ` Ludovic Courtès
  2015-03-25 16:20       ` Mark H Weaver
  0 siblings, 2 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2015-03-24 17:14 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel


Mark H Weaver writes:

> Mark H Weaver <mhw@netris.org> writes:
>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>>
>>> From 41550ffafa8da05b2cf8dfad66d44e6f43c9042c Mon Sep 17 00:00:00 2001
>>> From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
>>> Date: Fri, 20 Mar 2015 11:26:23 +0100
>>> Subject: [PATCH 2/2] gnu: Add Julia.
>>>
>>> * gnu/packages/julia.scm: New file.
>>> * gnu-system.am (GNU_SYSTEM_MODULES): Add it.
>>
>> Hydra was unable to successfully build Julia on any platform.  See:
>>
>>   http://hydra.gnu.org/build/339221
>>   http://hydra.gnu.org/build/339192
>
> The illegal instruction errors are in openblas, which is marked
> non-substitutable because it apparently builds itself customized to the
> CPU on the build machine.  So, I guess openblas might have been built on
> a build slave with more processor features than the one used to build
> Julia.
>
> Perhaps the answer is that Julia shouldn't be built by Hydra, because
> one of its transitive inputs is non-substitutable.

I encountered build failures trying to install openblas on a virtual
machine (works fine on my workstation).  While looking for a solution I
stumbled upon the openblas make flag "DYNAMIC_ARCH=1" which asks
openblas to build modules for all(?) supported CPUs.

After modifying the openblas package in this manner it was built on the
virtual machine without issues and I could use it with Julia (so far
without problems).

May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
instead of propagating non-substitutability to Julia?  When built with
"DYNAMIC_ARCH=1" the CPU type can be picked with the environment
variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
substitutions for openblas possible.

What do you think?

~~ Ricardo

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-24 17:14     ` Ricardo Wurmus
@ 2015-03-24 20:45       ` Ludovic Courtès
  2015-03-25 16:20       ` Mark H Weaver
  1 sibling, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2015-03-24 20:45 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
> instead of propagating non-substitutability to Julia?  When built with
> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
> substitutions for openblas possible.
>
> What do you think?

I think that this is the preferred option, when possible.  (Likewise
glibc uses IFUNCs to choose the right implementation of various
functions at load time; GMP is built --enable-fat, which works
similarly.)

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-24 17:14     ` Ricardo Wurmus
  2015-03-24 20:45       ` Ludovic Courtès
@ 2015-03-25 16:20       ` Mark H Weaver
  2015-03-25 18:24         ` Ricardo Wurmus
  2015-03-26 15:19         ` Mark H Weaver
  1 sibling, 2 replies; 13+ messages in thread
From: Mark H Weaver @ 2015-03-25 16:20 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
> instead of propagating non-substitutability to Julia?  When built with
> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
> substitutions for openblas possible.
>
> What do you think?

Yes, we should do this.

    Thanks!
      Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-25 16:20       ` Mark H Weaver
@ 2015-03-25 18:24         ` Ricardo Wurmus
  2015-03-25 21:00           ` Mark H Weaver
  2015-03-26 15:19         ` Mark H Weaver
  1 sibling, 1 reply; 13+ messages in thread
From: Ricardo Wurmus @ 2015-03-25 18:24 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]


Mark H Weaver writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
>> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
>> instead of propagating non-substitutability to Julia?  When built with
>> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
>> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
>> substitutions for openblas possible.
>>
>> What do you think?
>
> Yes, we should do this.

Attached is a patch to make openblas substitutable.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-openblas-build-for-all-supported-CPUs.patch --]
[-- Type: text/x-patch, Size: 1076 bytes --]

From 326fa66415fe8e9ed2b28a249b903f4a654b769e Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Wed, 25 Mar 2015 19:20:11 +0100
Subject: [PATCH] gnu: openblas: build for all supported CPUs.

* gnu/packages/maths.scm (openblas)[arguments]: Pass make flag
  "DYNAMIC_ARCH=1" to build library for all CPUs, making it substitutable.
---
 gnu/packages/maths.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 49667cc..57c1e9f 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -1033,10 +1033,10 @@ constant parts of it.")
     (build-system gnu-build-system)
     (arguments
      '(#:tests? #f  ;no "check" target
-       #:substitutable? #f ;force local build because of CPU detection
        #:make-flags
        (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
              "SHELL=bash"
+             "DYNAMIC_ARCH=1"
              "NO_LAPACK=1")
        ;; no configure script
        #:phases (alist-delete 'configure %standard-phases)))
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-25 18:24         ` Ricardo Wurmus
@ 2015-03-25 21:00           ` Mark H Weaver
  0 siblings, 0 replies; 13+ messages in thread
From: Mark H Weaver @ 2015-03-25 21:00 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:

> Mark H Weaver writes:
>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>>
>>> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
>>> instead of propagating non-substitutability to Julia?  When built with
>>> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
>>> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
>>> substitutions for openblas possible.
>>>
>>> What do you think?
>>
>> Yes, we should do this.
>
> Attached is a patch to make openblas substitutable.
>
> From 326fa66415fe8e9ed2b28a249b903f4a654b769e Mon Sep 17 00:00:00 2001
> From: Ricardo Wurmus <rekado@elephly.net>
> Date: Wed, 25 Mar 2015 19:20:11 +0100
> Subject: [PATCH] gnu: openblas: build for all supported CPUs.
>
> * gnu/packages/maths.scm (openblas)[arguments]: Pass make flag
>   "DYNAMIC_ARCH=1" to build library for all CPUs, making it substitutable.

This explanation of the purpose of "DYNAMIC_ARCH=1" belongs as a comment
in the source code, rather than in the commit log.  You might also make
it clear that this enables runtime CPU detection.

The commit log should only summarize what changed, maybe something along
these lines:

* gnu/packages/maths.scm (openblas)[arguments]: Add "DYNAMIC_ARCH=1" to
  make flags.  Remove "#:substitutable? #f".

Otherwise it looks good to me.  Please push with these changes.

    Thanks!
      Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-25 16:20       ` Mark H Weaver
  2015-03-25 18:24         ` Ricardo Wurmus
@ 2015-03-26 15:19         ` Mark H Weaver
  2015-03-26 16:58           ` Ludovic Courtès
  2015-03-26 21:14           ` Ricardo Wurmus
  1 sibling, 2 replies; 13+ messages in thread
From: Mark H Weaver @ 2015-03-26 15:19 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> writes:

> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>
>> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
>> instead of propagating non-substitutability to Julia?  When built with
>> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
>> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
>> substitutions for openblas possible.
>>
>> What do you think?
>
> Yes, we should do this.

When reading this the first time, somehow I managed to miss the fact
that users will have to set OPENBLAS_CORETYPE to their CPU type.  Does
that mean that openblas is unable to detect the CPU type automatically?
What does it do if OPENBLAS_CORETYPE is unset?

Will we have to set it during the build of packages that use openblas,
such as Julia?

    Thanks,
      Mark

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-26 15:19         ` Mark H Weaver
@ 2015-03-26 16:58           ` Ludovic Courtès
  2015-03-26 21:14           ` Ricardo Wurmus
  1 sibling, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2015-03-26 16:58 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel

Mark H Weaver <mhw@netris.org> skribis:

> Mark H Weaver <mhw@netris.org> writes:
>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>>
>>> May I suggest adding passing the "DYNAMIC_ARCH=1" flag in openblas
>>> instead of propagating non-substitutability to Julia?  When built with
>>> "DYNAMIC_ARCH=1" the CPU type can be picked with the environment
>>> variable OPENBLAS_CORETYPE=<type>.  If I'm not mistaken this makes
>>> substitutions for openblas possible.
>>>
>>> What do you think?
>>
>> Yes, we should do this.
>
> When reading this the first time, somehow I managed to miss the fact
> that users will have to set OPENBLAS_CORETYPE to their CPU type.

Me too actually.

> Does that mean that openblas is unable to detect the CPU type
> automatically?  What does it do if OPENBLAS_CORETYPE is unset?
>
> Will we have to set it during the build of packages that use openblas,
> such as Julia?

Good points, this is a bit scary.  I assumed openblas would just detect
the CPU automatically at run time.

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-26 15:19         ` Mark H Weaver
  2015-03-26 16:58           ` Ludovic Courtès
@ 2015-03-26 21:14           ` Ricardo Wurmus
  2015-03-29 13:21             ` Ludovic Courtès
  1 sibling, 1 reply; 13+ messages in thread
From: Ricardo Wurmus @ 2015-03-26 21:14 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: guix-devel


Mark H Weaver writes:

> When reading this the first time, somehow I managed to miss the fact
> that users will have to set OPENBLAS_CORETYPE to their CPU type.  Does
> that mean that openblas is unable to detect the CPU type automatically?
> What does it do if OPENBLAS_CORETYPE is unset?
>
> Will we have to set it during the build of packages that use openblas,
> such as Julia?

It appears that this is not necessary.  I downloaded the OpenBLAS
substitute from hydra and built Julia locally on my notebook.  Julia
runs without problems.  It appears that OpenBLAS does detect the CPU
type automatically.

(There is a problem with our Julia package, which made me build Julia
myself.  Also seems to be related to CPU tuning.  Passing a make-flag to
force a generic build should fix this.)

~~ Ricardo

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] Add Julia.
  2015-03-26 21:14           ` Ricardo Wurmus
@ 2015-03-29 13:21             ` Ludovic Courtès
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2015-03-29 13:21 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

> Mark H Weaver writes:
>
>> When reading this the first time, somehow I managed to miss the fact
>> that users will have to set OPENBLAS_CORETYPE to their CPU type.  Does
>> that mean that openblas is unable to detect the CPU type automatically?
>> What does it do if OPENBLAS_CORETYPE is unset?
>>
>> Will we have to set it during the build of packages that use openblas,
>> such as Julia?
>
> It appears that this is not necessary.  I downloaded the OpenBLAS
> substitute from hydra and built Julia locally on my notebook.  Julia
> runs without problems.  It appears that OpenBLAS does detect the CPU
> type automatically.

That’s good news.

> (There is a problem with our Julia package, which made me build Julia
> myself.  Also seems to be related to CPU tuning.  Passing a make-flag to
> force a generic build should fix this.)

OK.

Ludo’.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2015-03-29 13:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-20 11:16 [PATCH] Add Julia Ricardo Wurmus
2015-03-23  9:29 ` Ludovic Courtès
2015-03-23 21:35 ` Mark H Weaver
2015-03-24 14:56   ` Mark H Weaver
2015-03-24 17:14     ` Ricardo Wurmus
2015-03-24 20:45       ` Ludovic Courtès
2015-03-25 16:20       ` Mark H Weaver
2015-03-25 18:24         ` Ricardo Wurmus
2015-03-25 21:00           ` Mark H Weaver
2015-03-26 15:19         ` Mark H Weaver
2015-03-26 16:58           ` Ludovic Courtès
2015-03-26 21:14           ` Ricardo Wurmus
2015-03-29 13:21             ` Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.