Subject: bug#32681: closed (Re: bug#32681: OpenBLAS with ILP64 storage model)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 14 Sep 2018 09:25:02 +0000

Your bug report

#32681: OpenBLAS with ILP64 storage model

which was filed against the guix package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
32681: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=32681
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#32681: OpenBLAS with ILP64 storage model
From: [email-masked] (Ludovic Courtès)
To: Eric Brown <[email-masked]>
Cc: Eric Bavier <[email-masked]>, [email-masked]
Date: Fri, 14 Sep 2018 11:24:07 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Eric,

Eric Brown <[email-masked]> skribis:

> Please find a patch attached which incorporates your suggestions.

I simplified it further and pushed as
daa6036fda502460f626b7beb0afa93a0bac6d01.

Thanks!

Ludo’.

Subject: OpenBLAS with ILP64 storage model
From: Eric Brown <[email-masked]>
To: [email-masked]
Date: Mon, 10 Sep 2018 08:41:41 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

>From 8c9728eb66a45fd42f208df66d323981837c9c0c Mon Sep 17 00:00:00 2001
From: Eric Brown <[email-masked]>
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 <[email-masked]>
 ;;; Copyright © 2018 Adam Massmann <[email-masked]>
 ;;; Copyright © 2018 Marius Bakke <[email-masked]>
+;;; Copyright © 2018 Eric Brown <[email-masked]>
 ;;;
 ;;; 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

>From 8c9728eb66a45fd42f208df66d323981837c9c0c Mon Sep 17 00:00:00 2001
From: Eric Brown <[email-masked]>
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 <[email-masked]>
 ;;; Copyright © 2018 Adam Massmann <[email-masked]>
 ;;; Copyright © 2018 Marius Bakke <[email-masked]>
+;;; Copyright © 2018 Eric Brown <[email-masked]>
 ;;;
 ;;; 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