-
Notifications
You must be signed in to change notification settings - Fork 1
/
julia.bash
140 lines (115 loc) · 3.79 KB
/
julia.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
jV=1.5
IjV=$jV.0
add_package -package julia \
-directory julia-$IjV \
https://github.com/JuliaLang/julia/releases/download/v$IjV/julia-$IjV-full.tar.gz
# The settings
pack_set -s $MAKE_PARALLEL -s $IS_MODULE
pack_set -module-requirement suitesparse
pack_set -install-query $(pack_get -prefix)/bin/julia
# User has to specify thread count
pack_set --module-opt "--set-ENV JULIA_NUM_THREADS=1"
pack_set --module-opt "--set-ENV JULIA_CPU_THREADS=1"
pack_set --module-opt "--set-ENV JULIA_EXCLUSIVE=0"
# Create user makefile
pack_cmd "echo '# BBUILD' > Make.user"
pack_cmd "sed -i '1 a\
prefix = $(pack_get -prefix)\n\
USE_SYSTEM_GMP = 1\n\
USE_SYSTEM_MPFR = 1\n\
USE_SYSTEM_SUITESPARSE = 1\n\
LDFLAGS += $(list -LD-rp suitesparse)\n\
JULIA_NUM_THREADS = 1\n\
' Make.user"
if $(is_c intel) ; then
pack_cmd "sed -i '1 a\
USEICC = 1\n\
USEIFC = 1\n\
USE_SYSTEM_BLAS = 1\n\
LIBBLAS = $MKL_LIB -mkl=parallel\n\
LIBBLASNAME = libmkl_rt\n\
USE_SYSTEM_LAPACK = 1\n\
LIBLAPACK = $MKL_LIB -mkl=parallel\n\
LIBLAPACKNAME = libmkl_rt\n\
' Make.user"
else
la=$(pack_choice -i linalg)
case $la in
openblas)
noop
;;
*)
# always prefer openblas (for now)
la=openblas
;;
esac
pack_set -module-requirement lapack-$la
pack_cmd "sed -i '1 a\
USEGCC = 1\n\
USE_SYSTEM_BLAS = 1\n\
LIBBLAS = $(list -LD-rp-lib[omp] +lapack-$la)\n\
LIBBLASNAME = lib${la}_omp\n\
USE_SYSTEM_LAPACK = 1\n\
LIBLAPACK = $(list -LD-rp-lib[omp] +lapack-$la)\n\
LIBLAPACKNAME = \$(LIBBLASNAME)\n\
LDFLAGS += $(list -LD-rp lapack-$la)\n\
' Make.user"
pack_cmd "make -C deps distclean-openblas"
fi
pack_cmd "make $(get_make_parallel)"
pack_cmd "make install"
if ! $(is_host nicpa) ; then
# limit number of julia processors for tests
pack_cmd "export JULIA_NUM_THREADS=$NPROCS"
pack_cmd "export JULIA_CPU_THREADS=$NPROCS"
pack_cmd "make test 2>&1 | tee julia.test"
pack_store julia.test
fi
pack_store Make.user
# Create a new build with this module
new_build -name _internal-julia$IjV \
-module-path $(build_get -module-path)-julia/$IjV \
-source $(build_get -source) \
$(list -prefix "-default-module " $(pack_get -mod-req-module) julia[$IjV]) \
-installation-path $(dirname $(pack_get -prefix $(get_parent)))/packages \
-build-module-path "-package -version" \
-build-installation-path "$IjV -package -version" \
-build-path $(build_get -build-path)/jul-$jV
mkdir -p $(build_get -module-path[_internal-julia$IjV])-apps
build_set -default-setting[_internal-julia$IjV] $(build_get -default-setting)
# Now add options to ensure that loading this module will enable the path for the *new build*
pack_set -module-opt "-use-path $(build_get -module-path[_internal-julia$IjV])"
case $_mod_format in
$_mod_format_ENVMOD)
;;
*)
pack_set -module-opt "-use-path $(build_get -module-path[_internal-julia$IjV])-apps"
;;
esac
pack_install
create_module \
-module-path $(build_get -module-path)-apps \
-n $(pack_get -alias).$(pack_get -version) \
-W "Script for loading $(pack_get -package): $(get_c)" \
-v $(pack_get -version) \
-M $(pack_get -alias).$(pack_get -version) \
-P "/directory/should/not/exist" \
$(list -prefix '-L ' $(pack_get -module-requirement)) \
-L $(pack_get -alias)
# The lookup name in the list for version number etc...
set_parent $(pack_get -alias)[$IjV]
set_parent_exec $(pack_get -prefix)/bin/julia
# Save the default build index
def_idx=$(build_get -default-build)
# Change to the new build default
build_set -default-build _internal-julia$IjV
# Install all julia packages
source julia-install.bash
clear_parent
# Initialize the module read path
old_path=$(build_get -module-path)
build_set -module-path $old_path-apps
source julia/julia-mods.bash
build_set -module-path $old_path
# Reset default build
build_set -default-build $def_idx