From ba05be22495478c6ea3307d0dde6dd635a84e7cd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 13 Sep 2019 10:10:37 +0200 Subject: 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(-) (limited to 'gnu') 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 @@ (define-public muparser (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 @@ (define-public openblas (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 @@ (define-public openblas-ilp64 (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.) -- cgit v1.2.3