From 7a6d04e3946c212f2e0213dd24f18c5c6af5abbf Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Fri, 30 Jun 2017 16:18:53 +0200 Subject: [PATCH] julia: start with a single thread for OpenBLAS Add patch julia-0001-Allow-OpenBLAS-NUM_THREADS-to-be-overwritten.patch which makes it possible to specify the maximum number of threads to be used by OpenBLAS on the make command line instead of using the values computed by the julia build system which depend on the build host. Set the maxmum number of threads to be used by OpenBLAS to 80. Add patch julia-0002-Start-up-OpenBLAS-with-1-thread-per-default.patch which configures OpenBLAS to use only one thread instead of the maximum possible number from julia startup. To use more threads, julia can be started with and environment variable OPENBLAS_NUM_THREADS, e.g. OPENBLAS_NUM_THREADS=8 julia As a result, we default to one thread but can scale up to 80. buczek@nomatophobie:~$ julia -q julia> ccall((:openblas_get_num_threads64_, Base.libblas_name), Cint, ()) 1 julia> BLAS.set_num_threads(9999) julia> ccall((:openblas_get_num_threads64_, Base.libblas_name), Cint, ()) 80 julia> buczek@nomatophobie:~$ OPENBLAS_NUM_THREADS=8 julia -q julia> ccall((:openblas_get_num_threads64_, Base.libblas_name), Cint, ()) 8 julia> --- julia.be0 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/julia.be0 b/julia.be0 index 2b8b98c28..108be2aed 100755 --- a/julia.be0 +++ b/julia.be0 @@ -15,7 +15,8 @@ SRCURL[0]="https://github.com/JuliaLang/julia/releases/download/v${PKGVERSION}/j ## Add URLs/pathes to patch files to the PATCHURL array. ## The sources will be patched in the order of the array. -# PATCHURL+=() +PATCHURL+=(/src/mariux/patches/julia-0001-Allow-OpenBLAS-NUM_THREADS-to-be-overwritten.patch) +PATCHURL+=(/src/mariux/patches/julia-0002-Start-up-OpenBLAS-with-1-thread-per-default.patch) ############################################################################### ## Add filename patterns to the EXCLUDE array of files that should not @@ -63,7 +64,8 @@ mee_build() { # own purpose. # julias Makefile wants prefix lower case # - start_cmd make ${BEE_MAKEFLAGS} prefix="${PREFIX}" MARCH=x86-64 + start_cmd make ${BEE_MAKEFLAGS} prefix="${PREFIX}" MARCH=x86-64 \ + OPENBLAS_NUM_THREADS=80 } mee_install() {