guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: gnu: openblas: Set 'NUM_THREADS'.


From: guix-commits
Subject: 01/03: gnu: openblas: Set 'NUM_THREADS'.
Date: Fri, 13 Sep 2019 04:50:18 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit ba05be22495478c6ea3307d0dde6dd635a84e7cd
Author: Ludovic Courtès <address@hidden>
Date:   Fri Sep 13 10:10:37 2019 +0200

    gnu: openblas: Set 'NUM_THREADS'.
    
    Until now, OpenBLAS would use at most the N threads, where N is the
    number of cores that happened to be available on the build
    machine (typically N=8).
    
    * gnu/packages/maths.scm (openblas/fixed-num-threads): New variable.
    (openblas)[replacement]: New field.
    (openblas-ilp64): Use 'package/inherit'.
---
 gnu/packages/maths.scm | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 487f53e..761cb70 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -3096,6 +3096,10 @@ parts of it.")
 
 (define-public openblas
   (package
+    ;; TODO: Incorporate 'openblas/fixed-num-threads' changes on the next
+    ;; rebuild cycle.
+    (replacement openblas/fixed-num-threads)
+
     (name "openblas")
     (version "0.3.5")
     (source
@@ -3166,7 +3170,7 @@ parts of it.")
     (license license:bsd-3)))
 
 (define-public openblas-ilp64
-  (package (inherit openblas)
+  (package/inherit openblas
     (name "openblas-ilp64")
     (supported-systems '("x86_64-linux" "aarch64-linux" "mips64el-linux"))
     (arguments
@@ -3177,6 +3181,24 @@ parts of it.")
     (synopsis "Optimized BLAS library based on GotoBLAS (ILP64 version)")
     (license license:bsd-3)))
 
+(define openblas/fixed-num-threads
+  ;; TODO: Move that to 'openblas' proper on the next rebuild cycle.
+  (package
+    (inherit openblas)
+    (version (match (string-split (package-version openblas) #\.)
+               ((numbers ... (= string-length len))
+                (string-join (append numbers
+                                     (list (make-string len #\a)))
+                             "."))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments openblas)
+       ((#:make-flags flags ''())
+        ;; This is the maximum number of threads OpenBLAS will ever use (that
+        ;; is, if $OPENBLAS_NUM_THREADS is greater than that, then NUM_THREADS
+        ;; is used.)  If we don't set it, the makefile sets it to the number
+        ;; of cores of the build machine, which is obviously wrong.
+        `(cons "NUM_THREADS=128" ,flags))))))
+
 (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.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]