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'.
This commit is contained in:
Ludovic Courtès 2019-09-13 10:10:37 +02:00 committed by Ludovic Courtès
parent 5ad0a45221
commit ba05be2249
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 23 additions and 1 deletions

View File

@ -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.)