unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#32681: OpenBLAS with ILP64 storage model
@ 2018-09-10 13:41 Eric Brown
  2018-09-11 10:18 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Brown @ 2018-09-10 13:41 UTC (permalink / raw)
  To: 32681

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

This patch introduces a new package named `openblas-ilp64', which uses
the ILP64 model.

The library name contains the suffix "_ilp64" to the library name and so
hopefully may co-exist with the existing `openblas' port.


[-- Attachment #2: openblas-ilp64 patch --]
[-- Type: text/x-diff, Size: 4554 bytes --]

From 8c9728eb66a45fd42f208df66d323981837c9c0c Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Mon, 10 Sep 2018 08:33:43 -0500
Subject: [PATCH] gnu: Add openblas-ilp64.

* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/maths.scm | 71 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 01bd03c60..5f1dfec8a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2909,6 +2910,76 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
+                           version "%20version.tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0b20km2jv7m6qiylrlvhq2vnmkmilb633mr8rhqmgbn1wqrp58jq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "i686" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   '("DYNAMIC_ARCH=1" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  (else '("INTERFACE64=1" "LIBNAMESUFFIX=ilp64")))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (inputs
+     `(("fortran-lib" ,gfortran "lib")))
+    (native-inputs
+     `(("cunit" ,cunit)
+       ("fortran" ,gfortran)
+       ("perl" ,perl)))
+    (home-page "http://www.openblas.net/")
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
-- 
2.18.0


[-- Attachment #3: openblas-ilp64 patch --]
[-- Type: text/x-diff, Size: 4554 bytes --]

From 8c9728eb66a45fd42f208df66d323981837c9c0c Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Mon, 10 Sep 2018 08:33:43 -0500
Subject: [PATCH] gnu: Add openblas-ilp64.

* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/maths.scm | 71 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 01bd03c60..5f1dfec8a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2909,6 +2910,76 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://sourceforge/openblas/v" version "/OpenBLAS%20"
+                           version "%20version.tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "0b20km2jv7m6qiylrlvhq2vnmkmilb633mr8rhqmgbn1wqrp58jq"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "i686" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   '("DYNAMIC_ARCH=1" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8" "INTERFACE64=1" "LIBNAMESUFFIX=ilp64"))
+                  (else '("INTERFACE64=1" "LIBNAMESUFFIX=ilp64")))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (inputs
+     `(("fortran-lib" ,gfortran "lib")))
+    (native-inputs
+     `(("cunit" ,cunit)
+       ("fortran" ,gfortran)
+       ("perl" ,perl)))
+    (home-page "http://www.openblas.net/")
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
-- 
2.18.0


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

* bug#32681: OpenBLAS with ILP64 storage model
  2018-09-10 13:41 bug#32681: OpenBLAS with ILP64 storage model Eric Brown
@ 2018-09-11 10:18 ` Ludovic Courtès
  2018-09-13 14:16   ` Eric Brown
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2018-09-11 10:18 UTC (permalink / raw)
  To: Eric Brown; +Cc: Eric Bavier, 32681

Hi Eric,

(Cc Eric Bavier and Markus who may be familiar with OpenBLAS.)

Eric Brown <brown@fastmail.com> skribis:

>From 8c9728eb66a45fd42f208df66d323981837c9c0c Mon Sep 17 00:00:00 2001
> From: Eric Brown <brown@fastmail.com>
> Date: Mon, 10 Sep 2018 08:33:43 -0500
> Subject: [PATCH] gnu: Add openblas-ilp64.
>
> * gnu/packages/maths.scm (openblas-ilp64): New variable.

[...]

> +(define-public openblas-ilp64
> +  (package
> +    (name "openblas-ilp64")
> +    (version "0.3.2")

Should we write it as:

  (package
    (inherit openblas)
    …)

?  That would avoid duplication with the ‘openblas’ package.

Also, should we add a ‘supported-systems’ field to restrict builds to
x86_64-linux, aarch64-linux, and mips64el-linux?

Apart from that it LGTM.

Thanks for the patch!

Ludo’.

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

* bug#32681: OpenBLAS with ILP64 storage model
  2018-09-11 10:18 ` Ludovic Courtès
@ 2018-09-13 14:16   ` Eric Brown
  2018-09-14  9:24     ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Brown @ 2018-09-13 14:16 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Eric Bavier, 32681

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

ludovic.courtes@inria.fr (Ludovic Courtès) writes:

> Should we write it as:
>
>   (package
>     (inherit openblas)
>     …)
>
> ?  That would avoid duplication with the ‘openblas’ package.
>
> Also, should we add a ‘supported-systems’ field to restrict builds to
> x86_64-linux, aarch64-linux, and mips64el-linux?
>
> Apart from that it LGTM.
>
> Thanks for the patch!
>
> Ludo’.

Hi Ludo',

Please find a patch attached which incorporates your suggestions.

Best regards,
Eric


[-- Attachment #2: 0001-openblas-ilp64-Add-support-for-the-ILP64-storage-mod.patch --]
[-- Type: text/x-diff, Size: 3960 bytes --]

From 08ec9c94431af425d5dfc2cafc428bee10904ff6 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Thu, 13 Sep 2018 08:54:36 -0500
Subject: [PATCH] openblas-ilp64: Add support for the ILP64 storage model.

* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/maths.scm | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index af41093fb..7f1034dc4 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2873,6 +2874,64 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package (inherit openblas)
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (supported-systems (list
+                        "x86_64-linux"
+                        "aarch64-linux"
+                        "mips64el-linux"))
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             "INTERFACE64=1"
+             "LIBNAMESUFFIX=ilp64"
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((string-prefix? "x86_64" system)
+                   '("DYNAMIC_ARCH=1"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8"))
+                  (else '()))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
-- 
2.19.0


[-- Attachment #3: 0001-openblas-ilp64-Add-support-for-the-ILP64-storage-mod.patch --]
[-- Type: text/x-diff, Size: 3960 bytes --]

From 08ec9c94431af425d5dfc2cafc428bee10904ff6 Mon Sep 17 00:00:00 2001
From: Eric Brown <brown@fastmail.com>
Date: Thu, 13 Sep 2018 08:54:36 -0500
Subject: [PATCH] openblas-ilp64: Add support for the ILP64 storage model.

* gnu/packages/maths.scm (openblas-ilp64): New variable.
---
 gnu/packages/maths.scm | 59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index af41093fb..7f1034dc4 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2018 Nadya Voronova <voronovank@gmail.com>
 ;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
+;;; Copyright © 2018 Eric Brown <brown@fastmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2873,6 +2874,64 @@ parts of it.")
      "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version.")
     (license license:bsd-3)))
 
+(define-public openblas-ilp64
+  (package (inherit openblas)
+    (name "openblas-ilp64")
+    (version "0.3.2")
+    (supported-systems (list
+                        "x86_64-linux"
+                        "aarch64-linux"
+                        "mips64el-linux"))
+    (arguments
+     `(#:test-target "test"
+       ;; DYNAMIC_ARCH is only supported on x86.  When it is disabled and no
+       ;; TARGET is specified, OpenBLAS will tune itself to the build host, so
+       ;; we need to disable substitutions.
+       #:substitutable?
+        ,(let ((system (or (%current-target-system) (%current-system))))
+           (or (string-prefix? "x86_64" system)
+               (string-prefix? "mips" system)
+               (string-prefix? "aarch64" system)))
+       #:make-flags
+       (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
+             "SHELL=bash"
+             ;; Build the library for all supported CPUs.  This allows
+             ;; switching CPU targets at runtime with the environment variable
+             ;; OPENBLAS_CORETYPE=<type>, where "type" is a supported CPU type.
+             ;; Unfortunately, this is not supported on non-x86 architectures,
+             ;; where it leads to failed builds.
+             "INTERFACE64=1"
+             "LIBNAMESUFFIX=ilp64"
+             ,@(let ((system (or (%current-target-system) (%current-system))))
+                 (cond
+                  ((string-prefix? "x86_64" system)
+                   '("DYNAMIC_ARCH=1"))
+                  ;; On MIPS we force the "SICORTEX" TARGET, as for the other
+                  ;; two available MIPS targets special extended instructions
+                  ;; for Loongson cores are used.
+                  ((string-prefix? "mips" system)
+                   '("TARGET=SICORTEX"))
+                  ;; On aarch64 force the generic 'armv8-a' target
+                  ((string-prefix? "aarch64" system)
+                   '("TARGET=ARMV8"))
+                  (else '()))))
+       ;; no configure script
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'set-extralib
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Get libgfortran found when building in utest.
+             (setenv "FEXTRALIB"
+                     (string-append "-L" (assoc-ref inputs "fortran-lib")
+                                    "/lib"))
+             #t)))))
+    (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
+    (description
+     "OpenBLAS is a BLAS library forked from the GotoBLAS2-1.13 BSD version. (ILP64 version)")
+    (license license:bsd-3)))
+
+
 (define* (make-blis implementation #:optional substitutable?)
   "Return a BLIS package with the given IMPLEMENTATION (see config/ in the
 source tree for a list of implementations.)
-- 
2.19.0


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

* bug#32681: OpenBLAS with ILP64 storage model
  2018-09-13 14:16   ` Eric Brown
@ 2018-09-14  9:24     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2018-09-14  9:24 UTC (permalink / raw)
  To: Eric Brown; +Cc: Eric Bavier, 32681-done

Hi Eric,

Eric Brown <brown@fastmail.com> skribis:

> Please find a patch attached which incorporates your suggestions.

I simplified it further and pushed as
daa6036fda502460f626b7beb0afa93a0bac6d01.

Thanks!

Ludo’.

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

end of thread, other threads:[~2018-09-14  9:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-10 13:41 bug#32681: OpenBLAS with ILP64 storage model Eric Brown
2018-09-11 10:18 ` Ludovic Courtès
2018-09-13 14:16   ` Eric Brown
2018-09-14  9:24     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).