Skip to content

Commit a211bc9

Browse files
committedMay 14, 2019
TST: add SkylakeX AVX512 CI test
* adapt the C-level reproducer code for some recent SkylakeX AVX512 kernel issues, provided by Isuru Fernando and modified by Martin Kroeker, for usage in the utest suite * add an Intel SDE SkylakeX emulation utest run to the Azure CI matrix; a custom Docker build was required because Ubuntu image provided by Azure does not support AVX512VL instructions
1 parent 9208ab8 commit a211bc9

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed
 

‎azure-pipelines.yml

+24
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,27 @@ jobs:
2525
make -C utest $COMMON_FLAGS $BTYPE" > Dockerfile
2626
docker build .
2727
displayName: Run manylinux1 docker build
28+
- job: Intel_SDE_skx
29+
pool:
30+
vmImage: 'ubuntu-16.04'
31+
steps:
32+
- script: |
33+
# at the time of writing the available Azure Ubuntu vm image
34+
# does not support AVX512VL, so use more recent LTS version
35+
echo "FROM ubuntu:bionic
36+
COPY . /tmp/openblas
37+
RUN apt-get -y update && apt-get -y install \\
38+
cmake \\
39+
gfortran \\
40+
make \\
41+
wget
42+
RUN mkdir /tmp/SDE && cd /tmp/SDE && \\
43+
mkdir sde-external-8.35.0-2019-03-11-lin && \\
44+
wget --quiet -O sde-external-8.35.0-2019-03-11-lin.tar.bz2 https://www.dropbox.com/s/fopsnzj67572sj5/sde-external-8.35.0-2019-03-11-lin.tar.bz2?dl=0 && \\
45+
tar -xjvf sde-external-8.35.0-2019-03-11-lin.tar.bz2 -C /tmp/SDE/sde-external-8.35.0-2019-03-11-lin --strip-components=1
46+
RUN cd /tmp/openblas && CC=gcc make QUIET_MAKE=1 DYNAMIC_ARCH=1 NUM_THREADS=32 BINARY=64
47+
CMD cd /tmp/openblas && echo 0 > /proc/sys/kernel/yama/ptrace_scope && CC=gcc OPENBLAS_VERBOSE=2 /tmp/SDE/sde-external-8.35.0-2019-03-11-lin/sde64 -cpuid_in /tmp/SDE/sde-external-8.35.0-2019-03-11-lin/misc/cpuid/skx/cpuid.def -- make -C utest DYNAMIC_ARCH=1 NUM_THREADS=32 BINARY=64" > Dockerfile
48+
docker build -t intel_sde .
49+
# we need a privileged docker run for sde process attachment
50+
docker run --privileged intel_sde
51+
displayName: 'Run AVX512 SkylakeX docker build / test'

‎utest/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ if (NOT NO_LAPACK)
3838
set(OpenBLAS_utest_src
3939
${OpenBLAS_utest_src}
4040
test_potrs.c
41+
test_kernel_regress.c
4142
)
4243
endif()
4344

‎utest/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ OBJS=utest_main.o test_amax.o test_rotmg.o test_axpy.o test_dotu.o test_dsdot.o
1313

1414
ifneq ($(NO_LAPACK), 1)
1515
OBJS += test_potrs.o
16+
OBJS += test_kernel_regress.o
1617
endif
1718

1819
#this does not work with OpenMP nor with native Windows or Android threads

‎utest/test_kernel_regress.c

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#include "openblas_utest.h"
2+
#include <stdio.h>
3+
#include <stdlib.h>
4+
#include <cblas.h>
5+
6+
#define LAPACK_ROW_MAJOR 101
7+
blasint LAPACKE_dgesvd( blasint matrix_layout, char jobu, char jobvt,
8+
blasint m, blasint n, double* a,
9+
blasint lda, double* s, double* u, blasint ldu,
10+
double* vt, blasint ldvt, double* superb );
11+
12+
13+
#define DATASIZE 100
14+
15+
double s[DATASIZE];
16+
double u[DATASIZE*DATASIZE];
17+
double vt[DATASIZE*DATASIZE];
18+
double X[DATASIZE*DATASIZE];
19+
double superb[DATASIZE];
20+
double tmp[DATASIZE*DATASIZE];
21+
double m[DATASIZE*DATASIZE];
22+
23+
CTEST(kernel_regress,skx_avx)
24+
{
25+
double norm;
26+
int i, j, info;
27+
srand(0);
28+
for (i = 0; i < DATASIZE*DATASIZE; i++) {
29+
m[i] = (rand()+0.0)/RAND_MAX * 10;
30+
tmp[i] = m[i];
31+
}
32+
33+
info = LAPACKE_dgesvd( LAPACK_ROW_MAJOR, 'A', 'A', DATASIZE, DATASIZE, m, DATASIZE,
34+
s, u, DATASIZE, vt, DATASIZE, superb);
35+
36+
for (i = 0; i < DATASIZE; i++) {
37+
for (j = 0; j < DATASIZE; j++) {
38+
u[i*DATASIZE+j] = u[i*DATASIZE+j]*s[j];
39+
}
40+
}
41+
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans,
42+
DATASIZE, DATASIZE, DATASIZE, 1, u, DATASIZE, vt, DATASIZE, 0, X, DATASIZE);
43+
44+
for (i = 0; i < DATASIZE*DATASIZE; i++) {
45+
X[i] = X[i] - tmp[i];
46+
}
47+
48+
norm = cblas_dnrm2(DATASIZE*DATASIZE, X, 1);
49+
ASSERT_DBL_NEAR_TOL(0.0, norm, 1e-10);
50+
}

0 commit comments

Comments
 (0)
Please sign in to comment.