Skip to content

Commit 226bc6e

Browse files
committed
ct: test different BLAS libraries: MKL LP64 and ILP64, OpenBLAS, BLIS (future)
1 parent 0472444 commit 226bc6e

File tree

5 files changed

+218
-40
lines changed

5 files changed

+218
-40
lines changed

.github/workflows/build.sh

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash -x
22

3-
maker=$1
4-
device=$2
5-
63
mydir=$(dirname $0)
74
source ${mydir}/setup_env.sh
85

@@ -29,5 +26,17 @@ else
2926
echo "${ldd_result}" | grep -P "cublas|rocblas" && exit 15
3027
fi
3128

29+
# Verify that tester linked with intended CPU BLAS.
30+
echo "${ldd_result}" | grep -P "lib\S*${blas}" || exit 16
31+
32+
# Verify that tester linked with intended ilp64 library, or not.
33+
if [ "${blas_int}" = "int64" ] \
34+
|| [[ "${bla_vendor}" = *64ilp* ]] \
35+
|| [[ "${bla_vendor}" = *ilp64* ]]; then
36+
echo "${ldd_result}" | grep -P "libmkl_\S+_ilp64" || exit 17
37+
else
38+
echo "${ldd_result}" | grep -P "libmkl_\S+_ilp64" && exit 18
39+
fi
40+
3241
print "======================================== Finished build"
3342
exit 0

.github/workflows/configure.sh

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash -x
22

3-
maker=$1
4-
device=$2
5-
63
if [ "${maker}" = "cmake" ]; then
74
rm -rf build
85
mkdir -p build
@@ -35,13 +32,41 @@ print "======================================== Setup build"
3532
rm -rf ${top}/install
3633
if [ "${maker}" = "make" ]; then
3734
make distclean
38-
make config prefix=${top}/install \
39-
|| exit 10
35+
make config prefix=${top}/install
36+
err=$?
37+
if [ $err -ne 0 ]; then
38+
echo "<<<<<<<<<<<<<<<<<<<< begin config/log.txt"
39+
cat config/log.txt
40+
echo ">>>>>>>>>>>>>>>>>>>> end config/log.txt"
41+
exit 10
42+
fi
4043

4144
elif [ "${maker}" = "cmake" ]; then
45+
46+
if [ "${blas}" != "" ]; then
47+
export cmake_blas="-Dblas=${blas}"
48+
fi
49+
if [ "${blas_int}" != "" ]; then
50+
export cmake_blas_int="-Dblas_int=${blas_int}"
51+
fi
52+
if [ "${blas_threaded}" != "" ]; then
53+
export cmake_blas_threaded="-Dblas_threaded=${blas_threaded}"
54+
fi
55+
if [ "${blas_libraries}" != "" ]; then
56+
export cmake_blas_libraries="-DBLAS_LIBRARIES=${blas_libraries}"
57+
fi
58+
if [ "${bla_vendor}" != "" ]; then
59+
unset cmake_blas
60+
unset cmake_blas_int
61+
unset cmake_blas_threaded
62+
unset cmake_blas_libraries
63+
export cmake_bla_vendor="-DBLA_VENDOR=${bla_vendor}"
64+
fi
65+
4266
cmake -Dcolor=no \
4367
-DCMAKE_INSTALL_PREFIX=${top}/install \
44-
-Dblas_int=${blas_int} \
68+
${cmake_blas} ${cmake_blas_int} ${cmake_blas_threaded} \
69+
${cmake_blas_libraries} ${cmake_bla_vendor} \
4570
-Dgpu_backend=${gpu_backend} .. \
4671
|| exit 12
4772
fi

.github/workflows/main.yml

Lines changed: 92 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# This is a basic workflow to help you get started with Actions
2-
31
name: CI
42

53
# Controls when the workflow will run
@@ -19,15 +17,103 @@ jobs:
1917
timeout-minutes: 120
2018
strategy:
2119
matrix:
22-
maker: [make, cmake]
20+
maker: [make, cmake]
2321
device: [cpu, gpu_nvidia, gpu_amd, gpu_intel]
22+
blas: [mkl]
23+
24+
include:
25+
# These includes just add blas_int to existing configurations.
26+
- maker: make
27+
device: gpu_nvidia
28+
blas_int: int64
29+
30+
- maker: cmake
31+
device: gpu_amd
32+
blas_int: int64
33+
34+
# By changing blas, these includes add new configurations.
35+
# They test only a quick sanity and smoke check, not full testing.
36+
- maker: make
37+
device: cpu
38+
blas: openblas
39+
check: sanity
40+
41+
- maker: cmake
42+
device: cpu
43+
blas: openblas
44+
check: sanity
45+
46+
# These ignore `blas` and instead use CMake's `bla_vendor`.
47+
# https://cmake.org/cmake/help/latest/module/FindBLAS.html
48+
- maker: cmake
49+
device: cpu
50+
blas:
51+
bla_vendor: Intel10_64lp
52+
check: sanity
53+
54+
- maker: cmake
55+
device: cpu
56+
blas:
57+
bla_vendor: Intel10_64ilp
58+
check: sanity
59+
60+
- maker: cmake
61+
device: cpu
62+
blas:
63+
bla_vendor: OpenBLAS
64+
check: sanity
65+
66+
# BLIS doesn't currently run on all ICL machines, because the
67+
# Spack package doesn't honor the requested architecture.
68+
# https://github.com/spack/spack/issues/49376
69+
#
70+
#- maker: make
71+
# device: cpu
72+
# blas: blis
73+
# check: sanity
74+
#
75+
#- maker: cmake
76+
# device: cpu
77+
# blas: blis
78+
# check: sanity
79+
#
80+
#- maker: cmake
81+
# device: cpu
82+
# blas:
83+
# bla_vendor: AOCL
84+
# check: sanity
85+
#
86+
#- maker: cmake
87+
# device: cpu
88+
# blas:
89+
# bla_vendor: AOCL_mt
90+
# check: sanity
91+
#
92+
#- maker: cmake
93+
# device: cpu
94+
# blas:
95+
# bla_vendor: FLAME
96+
# check: sanity
97+
2498
fail-fast: false
2599
runs-on: ${{ matrix.device }}
100+
101+
env:
102+
maker: ${{matrix.maker}}
103+
device: ${{matrix.device}}
104+
blas: ${{matrix.blas}}
105+
blas_int: ${{matrix.blas_int}}
106+
bla_vendor: ${{matrix.bla_vendor}}
107+
check: ${{matrix.check}}
108+
26109
steps:
27110
- uses: actions/checkout@v4
111+
28112
- name: Configure
29-
run: .github/workflows/configure.sh ${{matrix.maker}} ${{matrix.device}}
113+
run: .github/workflows/configure.sh
114+
30115
- name: Build
31-
run: .github/workflows/build.sh ${{matrix.maker}} ${{matrix.device}}
116+
run: .github/workflows/build.sh
117+
32118
- name: Test
33-
run: .github/workflows/test.sh ${{matrix.maker}} ${{matrix.device}}
119+
run: .github/workflows/test.sh

.github/workflows/setup_env.sh

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,36 @@ echo_and_restore() {
2323
}
2424
alias print='{ save_flags="$-"; set +x; } 2> /dev/null; echo_and_restore'
2525

26+
# append-path VAR PATH
27+
append-path() {
28+
var=$1
29+
path=$2
30+
if [ "${!var}" != "" ]; then
31+
eval $var+=:$path
32+
else
33+
eval $var+=$path
34+
fi
35+
}
36+
37+
# prepend-path VAR PATH
38+
prepend-path() {
39+
var=$1
40+
path=$2
41+
if [ "${!var}" != "" ]; then
42+
eval $var=$path:${!var}
43+
else
44+
eval $var=$path
45+
fi
46+
}
47+
48+
# remove-path VAR PATH
49+
remove-path() {
50+
var=$1
51+
path=$2
52+
val=$(echo ${!var} | perl -pe "s%:$path|$path:?%%")
53+
eval $var=$val
54+
}
55+
2656

2757
#-------------------------------------------------------------------------------
2858
quiet source /etc/profile
@@ -32,8 +62,40 @@ export top=$(pwd)
3262

3363
shopt -s expand_aliases
3464

35-
quiet module load intel-oneapi-mkl
36-
print "MKLROOT=${MKLROOT}"
65+
print "maker = '${maker}'"
66+
print "device = '${device}'"
67+
print "blas = '${blas}'"
68+
print "blas_int = '${blas_int}'"
69+
print "bla_vendor = '${bla_vendor}'"
70+
print "check = '${check}'"
71+
72+
export CPATH LIBRARY_PATH LD_LIBRARY_PATH
73+
74+
if [ "${blas}" = "mkl" ] || [[ "${bla_vendor}" = Intel* ]]; then
75+
# See also Intel compiler below.
76+
quiet module load intel-oneapi-mkl
77+
print "MKLROOT=${MKLROOT}"
78+
79+
elif [ "${blas}" = "openblas" -o "${bla_vendor}" = "OpenBLAS" ]; then
80+
# 2025-04: This is int32 version.
81+
# The openblas/0.3.27/gcc-11.4.1-y3rjih module has libopenblas64_.so
82+
quiet module load openblas/0.3.27/gcc-11.4.1-jfkp5p
83+
84+
quiet append-path CPATH ${ICL_OPENBLAS_ROOT}/include
85+
quiet append-path LIBRARY_PATH ${ICL_OPENBLAS_ROOT}/lib
86+
quiet append-path LD_LIBRARY_PATH ${ICL_OPENBLAS_ROOT}/lib
87+
88+
elif [ "${blas}" = "blis" -o "${bla_vendor}" = "AOCL" -o "${bla_vendor}" = "FLAME" ]; then
89+
quiet module load amd-aocl
90+
91+
quiet append-path CPATH ${ICL_AMDBLIS_ROOT}/include/blis
92+
quiet append-path LIBRARY_PATH ${ICL_AMDBLIS_ROOT}/lib
93+
quiet append-path LD_LIBRARY_PATH ${ICL_AMDBLIS_ROOT}/lib
94+
95+
quiet append-path CPATH ${ICL_AMDLIBFLAME_ROOT}/include
96+
quiet append-path LIBRARY_PATH ${ICL_AMDLIBFLAME_ROOT}/lib
97+
quiet append-path LD_LIBRARY_PATH ${ICL_AMDLIBFLAME_ROOT}/lib
98+
fi
3799

38100
quiet module load python
39101
quiet which python
@@ -49,18 +111,11 @@ export gpu_backend=none
49111
export color=no
50112
export CXXFLAGS="-Werror -Wno-unused-command-line-argument"
51113

52-
# Test int64 build with make/cuda and cmake/amd.
53-
# Test int32 build with cmake/cuda and make/amd and all others.
54-
if [ "${maker}" = "make" -a "${device}" = "gpu_nvidia" ]; then
55-
export blas_int=int64
56-
elif [ "${maker}" = "cmake" -a "${device}" = "gpu_amd" ]; then
57-
export blas_int=int64
58-
else
59-
export blas_int=int32
60-
fi
61-
62114
#----------------------------------------------------------------- Compiler
63-
if [ "${device}" = "gpu_intel" ]; then
115+
if [ "${device}" = "gpu_intel" ] || [[ "${bla_vendor}" = Intel* ]]; then
116+
# Re: bla_vendor = Intel*, apparently, CMake can't find MKL using g++,
117+
# only using Intel icpx.
118+
# This is one reason BLAS++ implements its own BLASFinder.
64119
print "======================================== Load Intel oneAPI compiler"
65120
quiet module load intel-oneapi-compilers
66121
else

.github/workflows/test.sh

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash -x
22

3-
maker=$1
4-
device=$2
5-
63
mydir=$(dirname $0)
74
source ${mydir}/setup_env.sh
85

@@ -21,18 +18,24 @@ if [ "${device}" = "gpu_intel" ]; then
2118
args+=" --type s,c"
2219
fi
2320

24-
./run_tests.py ${args} --blas1 --blas2 --blas3
25-
(( err += $? ))
21+
if [ "${check}" = "sanity" ]; then
22+
echo "Running only sanity checks"
23+
./run_tests.py ${args} herk dev-herk
24+
(( err += $? ))
25+
else
26+
./run_tests.py ${args} --blas1 --blas2 --blas3
27+
(( err += $? ))
2628

27-
./run_tests.py ${args} --batch-blas3
28-
(( err += $? ))
29+
./run_tests.py ${args} --batch-blas3
30+
(( err += $? ))
2931

30-
# CUDA, HIP, or SYCL. These fail gracefully when GPUs are absent.
31-
./run_tests.py ${args} --blas1-device --blas3-device
32-
(( err += $? ))
32+
# CUDA, HIP, or SYCL. These fail gracefully when GPUs are absent.
33+
./run_tests.py ${args} --blas1-device --blas3-device
34+
(( err += $? ))
3335

34-
./run_tests.py ${args} --batch-blas3-device
35-
(( err += $? ))
36+
./run_tests.py ${args} --batch-blas3-device
37+
(( err += $? ))
38+
fi
3639

3740
print "======================================== Smoke tests"
3841
cd ${top}/examples

0 commit comments

Comments
 (0)