diff options
author | Ludovic Courtès <ludovic.courtes@inria.fr> | 2019-09-13 10:10:37 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2019-09-13 10:50:11 +0200 |
commit | ba05be22495478c6ea3307d0dde6dd635a84e7cd (patch) | |
tree | bb5fbd1bcc54d60072ecc0a2e4b5a0d7fc0a7d34 | |
parent | 5ad0a4522116007420aeb288f76da241f43cb6bf (diff) | |
download | guix-ba05be22495478c6ea3307d0dde6dd635a84e7cd.tar.gz |
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'.
-rw-r--r-- | gnu/packages/maths.scm | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 487f53ead1..761cb70abd 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.) |