all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Efraim Flashner <efraim@flashner.co.il>
To: Simon Tournier <zimon.toutoune@gmail.com>
Cc: "Ludovic Courtès" <ludovic.courtes@inria.fr>,
	63986@debbugs.gnu.org, "Nicolas Graves" <ngraves@ngraves.fr>,
	csantosb@inventati.org
Subject: bug#63986: Julia is very slow
Date: Thu, 22 Jun 2023 23:13:07 +0300	[thread overview]
Message-ID: <ZJSrU5ZqofMV3t4T@3900XT> (raw)
In-Reply-To: <875y7f8hbf.fsf@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 2443 bytes --]

On Thu, Jun 22, 2023 at 08:47:48PM +0200, Simon Tournier wrote:
> Hi,
> 
> On Thu, 22 Jun 2023 at 19:25, Efraim Flashner <efraim@flashner.co.il> wrote:
> 
> > (ins)efraim@3900XT ~/workspace/guix$ cat /gnu/store/v6z5ykkjfzbc72x1x900xflspqc5wd5r-openblas-ilp64-0.3.20/lib/pkgconfig/openblas.pc
> > libdir=/gnu/store/v6z5ykkjfzbc72x1x900xflspqc5wd5r-openblas-ilp64-0.3.20/lib
> > includedir=/gnu/store/v6z5ykkjfzbc72x1x900xflspqc5wd5r-openblas-ilp64-0.3.20/include
> > openblas_config= USE_64BITINT= DYNAMIC_ARCH=1 DYNAMIC_OLDER=1 NO_CBLAS= NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= generic MAX_THREADS=128
> > version=0.3.20
> > extralib=-lm -lpthread -lgfortran -lm -lpthread -lgfortran
> > Name: openblas
> > Description: OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version
> > Version: ${version}
> > URL: https://github.com/xianyi/OpenBLAS
> > Libs: -L${libdir} -lopenblas
> > Libs.private: ${extralib}
> > Cflags: -I${includedir}
> >
> > Looks like it should be "LIBBLAS=-lopenblas"
> 
> I propose to tweak openblas-ilp64.  Currently it looks like:
> 
> --8<---------------cut here---------------start------------->8---
> $ tree $(guix build openblas-ilp64)/lib
> /gnu/store/v6z5ykkjfzbc72x1x900xflspqc5wd5r-openblas-ilp64-0.3.20/lib
> ├── cmake
> │   └── openblas
> │       ├── OpenBLASConfig.cmake
> │       └── OpenBLASConfigVersion.cmake
> ├── libopenblas_ilp64p-r0.3.20.so
> ├── libopenblas_ilp64.so -> libopenblas_ilp64p-r0.3.20.so
> ├── libopenblas_ilp64.so.0 -> libopenblas_ilp64p-r0.3.20.so
> └── pkgconfig
>     └── openblas.pc
> --8<---------------cut here---------------end--------------->8---
> 
> which is inconsistent with pkgconfig as you noticed above.  Therefore, I
> am proposing the addition of a symlink of libopenblas_ilp64p.so to
> libopenblas.so.  For instance this attached patch.

I've attached the patch that I've made it to. julia is built with
openblas-ilp64 on 64-bit architectures, openblas-ilp64 has its
configure-flags adjusted to match what other programs are expecting, and
I've also patched python-numpy to use openblas-ilp64 as another test
target.

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #1.2: julia-openblas-ilp64.patch --]
[-- Type: text/plain, Size: 5334 bytes --]

diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index ba54175822..e96131dfc0 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -269,7 +269,10 @@ (define-public julia
                (substitute* (jlpath "nghttp2")
                  (((from "libnghttp2")) (to "libnghttp2" "libnghttp2")))
                (substitute* (jlpath "OpenBLAS")
-                 (((from "libopenblas")) (to "openblas" "libopenblas")))
+                 (((from "libopenblas"))
+                  ,@(if (target-64bit?)
+                      `((to "openblas" "libopenblas64_" "libopenblas"))
+                      `((to "openblas" "libopenblas")))))
                (substitute* (jlpath "OpenLibm")
                  (((from "libopenlibm")) (to "openlibm" "libopenlibm")))
                (substitute* (jlpath "PCRE2")
@@ -479,12 +482,12 @@ (define-public julia
          "NO_GIT=1"             ; build from release tarball.
          "USE_GPL_LIBS=1"       ; proudly
 
-         ,@(if (target-aarch64?)
-             `("USE_BLAS64=0")
-             '())
-
-         "LIBBLAS=-lopenblas"
-         "LIBBLASNAME=libopenblas"
+         ,@(if (target-64bit?)
+             `("USE_BLAS64=1"
+               "LIBBLAS=-lopenblas64_"
+               "LIBBLASNAME=libopenblas64_")
+             `("LIBBLAS=-lopenblas"
+               "LIBBLASNAME=libopenblas"))
 
          (string-append "UTF8PROC_INC="
                         (assoc-ref %build-inputs "utf8proc")
@@ -513,7 +516,9 @@ (define-public julia
        ("llvm" ,llvm-julia)
        ("mbedtls-apache" ,mbedtls-apache)
        ("mpfr" ,mpfr)
-       ("openblas" ,openblas)
+       ,@(if (target-64bit?)
+             `(("openblas" ,openblas-ilp64))
+             `(("openblas" ,openblas)))
        ("openlibm" ,openlibm)
        ("p7zip" ,p7zip)
        ("pcre2" ,pcre2)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index f5a2181905..2d3ce41cb7 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -4645,7 +4645,9 @@ (define-public openblas-ilp64
     (arguments
      (substitute-keyword-arguments (package-arguments openblas)
        ((#:make-flags flags #~'())
-        #~(append (list "INTERFACE64=1" "LIBNAMESUFFIX=ilp64")
+        #~(append (list "INTERFACE64=1"
+                        "SYMBOLSUFFIX=64_"
+                        "LIBPREFIX=libopenblas64_")
                  #$flags))))
     (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
     (license license:bsd-3)))
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index b650b71f3b..deeffb67ae 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -6953,19 +6953,36 @@ (define-public python-numpy
             (lambda _
               (setenv "NPY_NUM_BUILD_JOBS"
                       (number->string (parallel-job-count)))))
-          (add-before 'build 'configure-blas
-            (lambda* (#:key inputs #:allow-other-keys)
-              (call-with-output-file "site.cfg"
-                (lambda (port)
-                  (format port
-                          "\
+          #$@(if (target-64bit?)
+               #~((add-before 'build 'configure-blas
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "NPY_USE_BLAS_ILP64" "1")
+                      (setenv "NPY_BLAS_ILP64_ORDER" "openblas64_")
+                      (setenv "NPY_LAPACK_ILP64_ORDER" "openblas64_")
+                      (call-with-output-file "site.cfg"
+                        (lambda (port)
+                          (format port
+                                  "\
+[openblas64_]
+libraries = openblas64_
+library_dirs = ~a/lib
+include_dirs = ~:*~a/include~%"
+                          (dirname (dirname
+                                    (search-input-file
+                                     inputs "include/openblas_config.h")))))))))
+               #~((add-before 'build 'configure-blas
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (call-with-output-file "site.cfg"
+                        (lambda (port)
+                          (format port
+                                  "\
 [openblas]
 libraries = openblas
 library_dirs = ~a/lib
 include_dirs = ~:*~a/include~%"
                           (dirname (dirname
                                     (search-input-file
-                                     inputs "include/openblas_config.h"))))))))
+                                     inputs "include/openblas_config.h"))))))))))
           (add-before 'build 'fix-executable-paths
             (lambda* (#:key inputs #:allow-other-keys)
               ;; Make /gnu/store/...-bash-.../bin/sh the default shell,
@@ -7021,7 +7038,11 @@ (define-public python-numpy
            python-pytest-xdist
            python-typing-extensions
            gfortran))
-    (inputs (list bash openblas))
+    (inputs
+     (list bash
+           (if (target-64bit?)
+             openblas-ilp64
+             openblas)))
     (home-page "https://numpy.org")
     (synopsis "Fundamental package for scientific computing with Python")
     (description "NumPy is the fundamental package for scientific computing

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2023-06-22 20:14 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 21:42 bug#63986: Julia is very slow Cayetano Santos via Bug reports for GNU Guix
2023-06-14 16:00 ` Ludovic Courtès
2023-06-19 16:13   ` Simon Tournier
2023-06-21 14:36     ` Ludovic Courtès
2023-06-21 20:39       ` Cayetano Santos via Bug reports for GNU Guix
2023-06-22 13:26         ` Cayetano Santos via Bug reports for GNU Guix
2023-06-22 14:37           ` Efraim Flashner
2023-06-22 15:52           ` Simon Tournier
2023-06-22 16:25             ` Efraim Flashner
2023-06-22 16:56               ` Cayetano Santos via Bug reports for GNU Guix
2023-06-22 17:12               ` Simon Tournier
2023-06-23  9:09                 ` Ludovic Courtès
2023-06-23  9:16                   ` Efraim Flashner
2023-06-23 12:11                     ` Simon Tournier
2023-06-23 13:23                     ` Simon Tournier
2023-06-23 14:16                       ` Efraim Flashner
2023-07-06 14:13                         ` Ludovic Courtès
2023-08-20 20:53                           ` Ludovic Courtès
2023-09-14 10:33                             ` Efraim Flashner
2023-09-15 19:45                               ` Cayetano Santos via Bug reports for GNU Guix
2023-09-16 10:47                               ` Simon Tournier
2023-09-16 11:18                                 ` Simon Tournier
2023-09-20 15:57                               ` Simon Tournier
2023-09-24  8:37                                 ` Cayetano Santos via Bug reports for GNU Guix
2023-09-25 14:46                                 ` Ludovic Courtès
2023-09-26  9:27                                   ` Efraim Flashner
2023-09-29  8:46                                     ` Ludovic Courtès
2023-09-29 10:12                                       ` Efraim Flashner
2023-09-28 11:41                                 ` Efraim Flashner
2023-06-22 18:47               ` Simon Tournier
2023-06-22 18:55                 ` Efraim Flashner
2023-06-22 20:13                 ` Efraim Flashner [this message]
2023-06-23 12:06                   ` Simon Tournier
2023-09-15 19:49 ` bug#63986: Fixed Cayetano Santos via Bug reports for GNU Guix
2023-09-16 10:23 ` bug#63986: [PATCH 0/2] Fix bug#63986: Julia is very slow Simon Tournier
2023-09-16 10:55   ` [bug#66030] [PATCH 1/2] gnu: openblas-ilp64: Add symbol suffix Simon Tournier
2023-09-16 10:55   ` [bug#66030] [PATCH 2/2] gnu: julia: Conditionally use openblas with ILP64 support Simon Tournier
2023-09-17 11:49   ` [bug#66030] [PATCH 0/2] Fix: Julia is very slow Simon Tournier
2023-09-17 11:52   ` [bug#66030] [PATCH v2 1/3] gnu: openblas-ilp64: Add symbol suffix Simon Tournier
2023-09-17 11:52     ` [bug#66030] [PATCH v2 2/3] gnu: julia: Conditionally use openblas with ILP64 support Simon Tournier
2023-09-17 11:52     ` [bug#66030] [PATCH v2 3/3] gnu: julia-arraylayouts: Fix tests Simon Tournier
2023-09-17 19:12   ` [bug#66030] [PATCH v3 1/6] gnu: openblas-ilp64: Add symbol suffix Simon Tournier
2023-09-17 19:12     ` [bug#66030] [PATCH v3 2/6] gnu: julia: Conditionally use openblas with ILP64 support Simon Tournier
2023-09-17 19:12     ` [bug#66030] [PATCH v3 3/6] gnu: julia-arraylayouts: Fix tests Simon Tournier
2023-09-17 19:12     ` [bug#66030] [PATCH v3 4/6] gnu: julia-scanbyte: Update to 0.4.0 Simon Tournier
2023-09-17 19:12     ` [bug#66030] [PATCH v3 5/6] gnu: Add wcslib-7.12 Simon Tournier
2023-09-17 19:12     ` [bug#66030] [PATCH v3 6/6] gnu: julia-wcslib-jll: Downgrade wcslib version Simon Tournier
     [not found] ` <handler.63986.D63986.169480740431199.notifdone@debbugs.gnu.org>
2023-09-16 11:03   ` bug#63986: Julia is very slow Simon Tournier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZJSrU5ZqofMV3t4T@3900XT \
    --to=efraim@flashner.co.il \
    --cc=63986@debbugs.gnu.org \
    --cc=csantosb@inventati.org \
    --cc=ludovic.courtes@inria.fr \
    --cc=ngraves@ngraves.fr \
    --cc=zimon.toutoune@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.