Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 114 lines (97 sloc) 3.58 KB
#! /bin/bash
PKG=julia
VERSION=1.6.1
BUILD=0
PREFIX=/pkg/$PKG-$VERSION-$BUILD
if [ -n "$TESTING" ]; then PREFIX=/dev/shm/$PKG-$VERSION-$BUILD ; fi
set -xe
umask 022
BUILD_TMPDIR=/dev/shm/$PKG-$VERSION-$BUILD.build.tmp
test -d $BUILD_TMPDIR && rm -rf $BUILD_TMPDIR
mkdir -p $BUILD_TMPDIR/home
export TMPDIR=$BUILD_TMPDIR
export HOME=$BUILD_TMPDIR/home
exec </dev/null
mkdir -p $PREFIX
cat >$PREFIX/profile <<-EOF
PATH=$PREFIX/bin:\$PATH
export LD_LIBRARY_PATH=$PREFIX/lib64\${LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH
if [ -d $PREFIX/.compatlibs ]; then export LD_LIBRARY_PATH=$PREFIX/.compatlibs\${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH} ; fi
EOF
. $PREFIX/profile
export MAKEFLAGS="-j $(nproc)"
BUILDDIR=$PREFIX/build
mkdir -p $BUILDDIR
cd $BUILDDIR
test -e julia-${VERSION}-full.tar.gz || wget https://github.com/JuliaLang/julia/releases/download/v${VERSION}/julia-${VERSION}-full.tar.gz
test -d julia || tar xvf julia-${VERSION}-full.tar.gz
cd julia-${VERSION}
# see also 7a6d04e3946c212f2e0213dd24f18c5c6af5abbf in mariux64/bee-files
patch -p1 <<'EOF'
From 44d590277454035841803083f57af1b861192595 Mon Sep 17 00:00:00 2001
From: Donald Buczek <buczek@molgen.mpg.de>
Date: Fri, 30 Jun 2017 11:41:41 +0200
Subject: [PATCH 1/2] Allow OpenBLAS NUM_THREADS to be overwritten
When building OpenBLAS we have some default for its NUM_THREADS build
option. Allow this default to be overwritten by a new
OPENBLAS_NUM_THREADS make variable.
---
deps/blas.mk | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/deps/blas.mk b/deps/blas.mk
index 55216c8..b9bf8ed 100644
--- a/deps/blas.mk
+++ b/deps/blas.mk
@@ -14,17 +14,18 @@ OPENBLAS_BUILD_OPTS += GEMM_MULTITHREADING_THRESHOLD=50
ifneq ($(ARCH),x86_64)
# Assume we can't address much memory to spawn many threads
# It is also unlikely that 32-bit architectures have too many cores
-OPENBLAS_BUILD_OPTS += NUM_THREADS=8
+OPENBLAS_NUM_THREADS:=8
else ifeq ($(OS),WINNT)
# Windows seems unable to handle very many
-OPENBLAS_BUILD_OPTS += NUM_THREADS=16
+OPENBLAS_NUM_THREADS:=16
else ifeq ($(OS),Darwin)
# This should suffice for the largest macs
-OPENBLAS_BUILD_OPTS += NUM_THREADS=16
+OPENBLAS_NUM_THREADS:=16
else
# On linux, try to provision for the largest possible machine currently
-OPENBLAS_BUILD_OPTS += NUM_THREADS=16
+OPENBLAS_NUM_THREADS:=16
endif
+OPENBLAS_BUILD_OPTS += NUM_THREADS=$(OPENBLAS_NUM_THREADS)
else
OPENBLAS_BUILD_OPTS += USE_THREAD=0
endif
--
2.4.1
---
ist etwas runtergehackt
aber dadurch dass auf all unseren Servern mehr als 8 threads sind, sollte es
immer greifen
mit `OPENBLAS_NUM_THREADS=x julia` kann man es zur laufzeit erhoehen
# diff --git a/base/sysimg.jl b/base/sysimg.jl
index dd605b0..ed3c7b2 100644
--- a/base/Base.jl
+++ b/base/Base.jl
@@ -459,7 +459,7 @@ function __init__()
if !haskey(ENV, "OPENBLAS_NUM_THREADS") && !haskey(ENV, "OMP_NUM_THREADS")
cpu_threads = Sys.CPU_THREADS::Int
if cpu_threads > 8 # always at most 8
- ENV["OPENBLAS_NUM_THREADS"] = "8"
+ ENV["OPENBLAS_NUM_THREADS"] = "1"
elseif haskey(ENV, "JULIA_CPU_THREADS") # or exactly as specified
ENV["OPENBLAS_NUM_THREADS"] = cpu_threads
end # otherwise, trust that openblas will pick CPU_THREADS anyways, without any intervention
--
EOF
# Note: Here OPENBLAS_NUM_THREADS defines an arbitrary upper limit, that is build into julia.
# Not the documented library runtime setting for OpenBLAS
make -j $(nproc) prefix="${PREFIX}" MARCH=x86-64 OPENBLAS_NUM_THREADS=80
make install prefix=${PREFIX} MARCH=x86-64
for i in `ls ${PREFIX}/bin`; do
ln -sv ${PREFIX}/bin/$i{,-$VERSION}
done
exit