-
Notifications
You must be signed in to change notification settings - Fork 224
Expand file tree
/
Copy pathtest-devel.sh
More file actions
executable file
·143 lines (121 loc) · 5.04 KB
/
test-devel.sh
File metadata and controls
executable file
·143 lines (121 loc) · 5.04 KB
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
141
142
143
#!/usr/bin/env sh
#===============================================================================
# Copyright contributors to the oneDAL project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#===============================================================================
test -f $CONDA_PREFIX/lib/pkgconfig/dal-dynamic-threading-host.pc
test -f $CONDA_PREFIX/lib/pkgconfig/dal-static-threading-host.pc
source $CONDA_PREFIX/env/vars.sh
run_examples() {
local interface_name=$1
local linking_type=$2
local extra_cmake_args=${3:-""}
if [ "$linking_type" == "dynamic" ]; then
library_postfix="so"
else
library_postfix="a"
fi
(
cd examples/$interface_name/cpp
mkdir build_$linking_type
(
cd build_$linking_type
cmake_args="-DONEDAL_LINK=$linking_type"
# Note: MKL cmake config is required for static build only and
# doesn't work with conda-forge distribution of tbb-devel.
# Thus, tbb is set to "found" manually.
if [ "$linking_type" == "static" ]; then
cmake_args="$cmake_args -DTBB_tbb_FOUND=YES"
fi
cmake_args="$cmake_args $extra_cmake_args"
cmake .. $cmake_args
make -j$(nproc)
)
for example in _cmake_results/intel_intel64_$library_postfix/*; do
echo "================"
echo "Running example: $interface_name-$linking_type-$(basename $example)"
echo "================"
$example
done
)
}
run_dpc_examples() {
local linking_type=$1
if [ "$linking_type" == "dynamic" ]; then
library_postfix="so"
else
library_postfix="a"
fi
(
cd examples/oneapi/dpc
mkdir build_$linking_type
(
cd build_$linking_type
cmake_args="-DONEDAL_LINK=$linking_type"
# Note: MKL cmake config (incl. SYCL variant) requires TBB to be findable at configure time.
# conda-forge tbb-devel does not ship TBBConfig.cmake, so we set TBB as found manually
# (same approach as for the static CPU build above).
cmake_args="$cmake_args -DTBB_tbb_FOUND=YES"
cmake .. $cmake_args
make -j$(nproc)
)
for example in _cmake_results/intel_intel64_$library_postfix/*; do
echo "================"
echo "Running example: oneapi-dpc-$linking_type-$(basename $example)"
echo "================"
$example
done
)
}
# ============================================================
# CPU-only tests: oneapi/cpp + daal (no GPU lib required)
# These must pass even without dal-gpu installed.
# ============================================================
echo "========================================"
echo "Running CPU examples: oneapi/cpp dynamic"
echo "========================================"
run_examples oneapi dynamic
echo "========================================"
echo "Running CPU examples: oneapi/cpp static"
echo "========================================"
run_examples oneapi static
echo "========================================"
echo "Running CPU examples: daal/cpp dynamic"
echo "========================================"
run_examples daal dynamic
echo "========================================"
echo "Running CPU examples: daal/cpp static"
echo "========================================"
run_examples daal static
# ============================================================
# GPU/DPC++ tests: oneapi/dpc (requires dal-gpu / libonedal_dpc.so)
# Skipped if GPU library is not installed.
# ============================================================
if [ -f "$CONDA_PREFIX/lib/libonedal_dpc.so" ] && [ -f "$CONDA_PREFIX/lib/libonedal_parameters_dpc.so" ]; then
# Workaround: MKL cmake config requires unversioned libtbb.so for tbb_thread threading.
# conda-forge tbb-devel may only provide versioned soname (libtbb.so.<N>).
if [ ! -f "$CONDA_PREFIX/lib/libtbb.so" ]; then
tbb_so=$(find "$CONDA_PREFIX/lib" -maxdepth 1 -name "libtbb.so.*" | head -1)
[ -n "$tbb_so" ] && ln -sf "$(basename "$tbb_so")" "$CONDA_PREFIX/lib/libtbb.so"
fi
echo "========================================"
echo "Running GPU/DPC++ examples: oneapi/dpc dynamic"
echo "========================================"
run_dpc_examples dynamic
else
echo "========================================"
echo "Skipping GPU/DPC++ examples: dal-gpu is not fully installed"
echo "========================================"
fi
# TODO: add testing for samples