Skip to content

Commit

Permalink
julia: start with a single thread for OpenBLAS
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
donald committed Jun 30, 2017
1 parent 0fbeae7 commit 7a6d04e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions julia.be0
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 7a6d04e

Please sign in to comment.