From 26792d2096ce0736a53bef6b8bf4ff0206ac3efa Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 21:47:55 +0200 Subject: [PATCH 1/9] Copy BUILD_* directives to the compiler options to allow ifdef in tests --- cmake/system.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmake/system.cmake b/cmake/system.cmake index c0f3c6ed2..aa342c3d2 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -393,6 +393,18 @@ set(REVISION "-r${OpenBLAS_VERSION}") set(MAJOR_VERSION ${OpenBLAS_MAJOR_VERSION}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CCOMMON_OPT}") +if (BUILD_SINGLE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_SINGLE") +endif() +if (BUILD_DOUBLE) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_DOUBLE") +endif() +if (BUILD_COMPLEX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_COMPLEX") +endif() +if (BUILD_COMPLEX16) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBUILD_COMPLEX16") +endif() if(NOT MSVC) set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} ${CCOMMON_OPT}") endif() From 74e358bcd514cff2e9b32c13571c09176b56a3d8 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 21:49:01 +0200 Subject: [PATCH 2/9] Remove spurious complex16 tests --- ctest/c_dblas1.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ctest/c_dblas1.c b/ctest/c_dblas1.c index e49ae6007..8e13afcaa 100644 --- a/ctest/c_dblas1.c +++ b/ctest/c_dblas1.c @@ -74,16 +74,6 @@ void F77_dswap( const int *N, double *X, const int *incX, return; } -double F77_dzasum(const int *N, void *X, const int *incX) -{ - return cblas_dzasum(*N, X, *incX); -} - -double F77_dznrm2(const int *N, OPENBLAS_CONST void *X, const int *incX) -{ - return cblas_dznrm2(*N, X, *incX); -} - int F77_idamax(const int *N, OPENBLAS_CONST double *X, const int *incX) { if (*N < 1 || *incX < 1) return(0); From 593ce9e23786796a483f44436e4aca57d042f05d Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 21:50:12 +0200 Subject: [PATCH 3/9] Make building individual tests depend on BUILD_SINGLE etc defines --- test/CMakeLists.txt | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index adeee3452..f1f773cba 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -3,11 +3,18 @@ include_directories(${PROJECT_BINARY_DIR}) enable_language(Fortran) -set(OpenBLAS_Tests - sblat1 sblat2 sblat3 - dblat1 dblat2 dblat3 - cblat1 cblat2 cblat3 - zblat1 zblat2 zblat3) +if (BUILD_SINGLE) + list( APPEND OpenBLAS_Tests sblat1 sblat2 sblat3) +endif() +if (BUILD_DOUBLE) + list (APPEND OpenBLAS_Tests dblat1 dblat2 dblat3) +endif() +if (BUILD_COMPLEX) + list (APPEND OpenBLAS_Tests cblat1 cblat2 cblat3) +endif() +if (BUILD_COMPLEX16) + list (APPEND OpenBLAS_Tests zblat1 zblat2 zblat3) +endif() foreach(test_bin ${OpenBLAS_Tests}) add_executable(${test_bin} ${test_bin}.f) From ce8939863626d3a194890e87edc9b7280f73b660 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 21:52:18 +0200 Subject: [PATCH 4/9] Make tests for individual variable types conditional on the respective BUILD_ option --- utest/test_amax.c | 6 +++++- utest/test_axpy.c | 9 +++++++++ utest/test_dotu.c | 3 +++ utest/test_ismin.c | 2 ++ utest/test_min.c | 13 +++++++++++-- utest/test_potrs.c | 39 ++++++++++++++++++++++++++++++--------- utest/test_rot.c | 9 +++++++++ utest/test_swap.c | 9 +++++++++ 8 files changed, 78 insertions(+), 12 deletions(-) diff --git a/utest/test_amax.c b/utest/test_amax.c index 831804027..a9e5a1c85 100644 --- a/utest/test_amax.c +++ b/utest/test_amax.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_SINGLE CTEST(amax, samax){ blasint N=3, inc=1; float te_max=0.0, tr_max=0.0; @@ -43,7 +44,8 @@ CTEST(amax, samax){ ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS); } - +#endif +#ifdef BUILD_DOUBLE CTEST(amax, damax){ blasint N=3, inc=1; double te_max=0.0, tr_max=0.0; @@ -54,3 +56,5 @@ CTEST(amax, damax){ ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), DOUBLE_EPS); } +#endif + diff --git a/utest/test_axpy.c b/utest/test_axpy.c index 603043073..5fd7c1b04 100644 --- a/utest/test_axpy.c +++ b/utest/test_axpy.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_DOUBLE CTEST(axpy,daxpy_inc_0) { blasint i; @@ -52,7 +53,9 @@ CTEST(axpy,daxpy_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX16 CTEST(axpy,zaxpy_inc_0) { blasint i; @@ -71,7 +74,9 @@ CTEST(axpy,zaxpy_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_SINGLE CTEST(axpy,saxpy_inc_0) { blasint i; @@ -90,7 +95,9 @@ CTEST(axpy,saxpy_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX CTEST(axpy,caxpy_inc_0) { blasint i; @@ -109,3 +116,5 @@ CTEST(axpy,caxpy_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif + diff --git a/utest/test_dotu.c b/utest/test_dotu.c index 918541848..542286403 100644 --- a/utest/test_dotu.c +++ b/utest/test_dotu.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_COMPLEX16 CTEST( zdotu,zdotu_n_1) { blasint N=1,incX=1,incY=1; @@ -80,3 +81,5 @@ CTEST(zdotu, zdotu_offset_1) #endif } +#endif + diff --git a/utest/test_ismin.c b/utest/test_ismin.c index f23d6b545..af597807f 100644 --- a/utest/test_ismin.c +++ b/utest/test_ismin.c @@ -36,6 +36,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define ELEMENTS 50 #define INCREMENT 2 +#ifdef BUILD_SINGLE CTEST(ismin, positive_step_2){ blasint i; blasint N = ELEMENTS, inc = INCREMENT; @@ -87,3 +88,4 @@ CTEST(ismax, negative_step_2){ blasint index = BLASFUNC(ismax)(&N, x, &inc); ASSERT_EQUAL(9, index); } +#endif diff --git a/utest/test_min.c b/utest/test_min.c index fd31b5982..a627674ae 100644 --- a/utest/test_min.c +++ b/utest/test_min.c @@ -32,7 +32,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********************************************************************************/ #include "openblas_utest.h" - +#ifdef BUILD_SINGLE CTEST(min, smin_negative){ blasint N=3, inc=1; float te_min=0.0, tr_min=0.0; @@ -43,7 +43,9 @@ CTEST(min, smin_negative){ ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS); } +#endif +#ifdef BUILD_DOUBLE CTEST(min, dmin_positive){ blasint N=3, inc=1; double te_min=0.0, tr_min=0.0; @@ -54,7 +56,9 @@ CTEST(min, dmin_positive){ ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS); } +#endif +#ifdef BUILD_SINGLE CTEST(min, smin_zero){ blasint N=3, inc=1; float te_min=0.0, tr_min=0.0; @@ -76,7 +80,9 @@ CTEST(max, smax_negative){ ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS); } +#endif +#ifdef BUILD_DOUBLE CTEST(max, dmax_positive){ blasint N=3, inc=1; double te_max=0.0, tr_max=0.0; @@ -87,7 +93,8 @@ CTEST(max, dmax_positive){ ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), DOUBLE_EPS); } - +#endif +#ifdef BUILD_SINGLE CTEST(max, smax_zero){ blasint N=3, inc=1; float te_max=0.0, tr_max=0.0; @@ -98,3 +105,5 @@ CTEST(max, smax_zero){ ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS); } +#endif + diff --git a/utest/test_potrs.c b/utest/test_potrs.c index 7afeb4c9d..05ce3037b 100644 --- a/utest/test_potrs.c +++ b/utest/test_potrs.c @@ -39,10 +39,10 @@ void BLASFUNC(zpotrs_(char*, BLASINT*, BLASINT*, complex double*, BLASINT*, complex double*, BLASINT*, BLASINT*); */ - //https://github.com/xianyi/OpenBLAS/issues/695 CTEST(potrf, bug_695){ +#ifdef BUILD_COMPLEX openblas_complex_float A1[100] = { openblas_make_complex_float(5.8525753, +0.0), @@ -153,7 +153,9 @@ CTEST(potrf, bug_695){ blasint info[1]; BLASFUNC(cpotrf)(&up, &n, (float*)(A1), &n, info); //printf("%g+%g*I\n", creal(A1[91]), cimag(A1[91])); +#endif +#ifdef BUILD_COMPLEX16 openblas_complex_double A2[100] = { openblas_make_complex_double(3.0607147216796875, +0.0), @@ -283,7 +285,8 @@ CTEST(potrf, bug_695){ char lo = 'L'; blasint nrhs = 2; BLASFUNC(zpotrs)(&lo, &n, &nrhs, (double*)(A2), &n, (double*)(B), &n, info); - +#endif +#ifdef BUILD_COMPLEX // note that this is exactly equal to A1 openblas_complex_float A3[100] = { @@ -393,9 +396,9 @@ CTEST(potrf, bug_695){ if(isnan(CREAL(A3[91])) || isnan(CIMAG(A3[91]))) { CTEST_ERR("%s:%d got NaN", __FILE__, __LINE__); } +#endif } - // Check potrf factorizes a small problem correctly CTEST(potrf, smoketest_trivial){ float A1s[4] = {2, 0.3, 0.3, 3}; @@ -439,31 +442,43 @@ CTEST(potrf, smoketest_trivial){ uplo = 'U'; } +#ifdef BUILD_SINGLE BLASFUNC(scopy)(&nv, A1s, &inc, As, &inc); +#endif +#ifdef BUILD_DOUBLE BLASFUNC(dcopy)(&nv, A1d, &inc, Ad, &inc); +#endif +#ifdef BUILD_COMPLEX BLASFUNC(ccopy)(&nv, (float *)A1c, &inc, (float *)Ac, &inc); +#endif +#ifdef BUILD_COMPLEX16 BLASFUNC(zcopy)(&nv, (double *)A1z, &inc, (double *)Az, &inc); +#endif +#ifdef BUILD_SINGLE BLASFUNC(spotrf)(&uplo, &n, As, &n, &info); if (info != 0) { CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__); } - +#endif +#ifdef BUILD_DOUBLE BLASFUNC(dpotrf)(&uplo, &n, Ad, &n, &info); if (info != 0) { CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__); } - +#endif +#ifdef BUILD_COMPLEX BLASFUNC(cpotrf)(&uplo, &n, (float *)Ac, &n, &info); if (info != 0) { CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__); } - +#endif +#ifdef BUILD_COMPLEX16 BLASFUNC(zpotrf)(&uplo, &n, (double *)Az, &n, &info); if (info != 0) { CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__); } - +#endif /* Fill the other triangle */ if (uplo == 'L') { for (i = 0; i < n; ++i) { @@ -495,14 +510,20 @@ CTEST(potrf, smoketest_trivial){ trans1 = 'C'; trans2 = 'N'; } - +#ifdef BUILD_SINGLE BLASFUNC(sgemm)(&trans1, &trans2, &n, &n, &n, &ones, As, &n, As, &n, &zeros, Bs, &n); +#endif +#ifdef BUILD_DOUBLE BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, Ad, &n, Ad, &n, &zerod, Bd, &n); +#endif +#ifdef BUILD_COMPLEX BLASFUNC(cgemm)(&trans1, &trans2, &n, &n, &n, (float *)&onec, (float *)Ac, &n, (float *)Ac, &n, (float *)&zeroc, (float *)Bc, &n); +#endif +#ifdef BUILD_COMPLEX16 BLASFUNC(zgemm)(&trans1, &trans2, &n, &n, &n, (double *)&onez, (double *)Az, &n, (double *)Az, &n, (double *)&zeroz, (double *)Bz, &n); - +#endif /* Check result is close to original */ for (i = 0; i < n; ++i) { for (j = 0; j < n; ++j) { diff --git a/utest/test_rot.c b/utest/test_rot.c index cf72ad22d..0e74ecbb3 100644 --- a/utest/test_rot.c +++ b/utest/test_rot.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_DOUBLE CTEST(rot,drot_inc_0) { blasint i=0; @@ -52,7 +53,9 @@ CTEST(rot,drot_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX16 CTEST(rot,zdrot_inc_0) { blasint i=0; @@ -72,7 +75,9 @@ CTEST(rot,zdrot_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_SINGLE CTEST(rot,srot_inc_0) { blasint i=0; @@ -91,7 +96,9 @@ CTEST(rot,srot_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX CTEST(rot, csrot_inc_0) { blasint i=0; @@ -110,3 +117,5 @@ CTEST(rot, csrot_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS); } } +#endif + diff --git a/utest/test_swap.c b/utest/test_swap.c index 259c83a5c..6d8ae8056 100644 --- a/utest/test_swap.c +++ b/utest/test_swap.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_DOUBLE CTEST(swap,dswap_inc_0) { blasint i=0; @@ -50,7 +51,9 @@ CTEST(swap,dswap_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX16 CTEST(swap,zswap_inc_0) { blasint i=0; @@ -68,7 +71,9 @@ CTEST(swap,zswap_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS); } } +#endif +#ifdef BUILD_SINGLE CTEST(swap,sswap_inc_0) { blasint i=0; @@ -86,7 +91,9 @@ CTEST(swap,sswap_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS); } } +#endif +#ifdef BUILD_COMPLEX CTEST(swap,cswap_inc_0) { blasint i=0; @@ -104,3 +111,5 @@ CTEST(swap,cswap_inc_0) ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS); } } +#endif + From ec2948f14784c3559b11f9aed07646396c3527cf Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 22:17:46 +0200 Subject: [PATCH 5/9] Make tests conditional on BUILD_DOUBLE --- utest/test_kernel_regress.c | 2 ++ utest/test_rotmg.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/utest/test_kernel_regress.c b/utest/test_kernel_regress.c index 93a30b30c..5b131bb2c 100644 --- a/utest/test_kernel_regress.c +++ b/utest/test_kernel_regress.c @@ -22,6 +22,7 @@ double m[DATASIZE*DATASIZE]; CTEST(kernel_regress,skx_avx) { +#ifdef BUILD_DOUBLE double norm; int i, j, info; srand(0); @@ -47,4 +48,5 @@ CTEST(kernel_regress,skx_avx) norm = cblas_dnrm2(DATASIZE*DATASIZE, X, 1); ASSERT_DBL_NEAR_TOL(0.0, norm, 1e-10); +#endif } diff --git a/utest/test_rotmg.c b/utest/test_rotmg.c index e5ec78983..ad435f6b0 100644 --- a/utest/test_rotmg.c +++ b/utest/test_rotmg.c @@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "openblas_utest.h" +#ifdef BUILD_DOUBLE CTEST (drotmg,rotmg) { double te_d1, tr_d1; @@ -204,3 +205,4 @@ CTEST(drotmg, drotmg_D1_big_D2_big_flag_zero) ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS); } } +#endif From de139337b8bcb1c76cd157afd4d5fd035a76efdf Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 22:20:41 +0200 Subject: [PATCH 6/9] Remove spurious tests for complex ASUM and NRM2 --- ctest/c_sblas1.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ctest/c_sblas1.c b/ctest/c_sblas1.c index 1a433b287..a562014a4 100644 --- a/ctest/c_sblas1.c +++ b/ctest/c_sblas1.c @@ -21,16 +21,6 @@ void F77_saxpy(blasint *N, const float *alpha, OPENBLAS_CONST float *X, return; } -float F77_scasum(blasint *N, float *X, blasint *incX) -{ - return cblas_scasum(*N, X, *incX); -} - -float F77_scnrm2(blasint *N, OPENBLAS_CONST float *X, blasint *incX) -{ - return cblas_scnrm2(*N, X, *incX); -} - void F77_scopy(blasint *N, OPENBLAS_CONST float *X, blasint *incX, float *Y, blasint *incY) { From 4d250d0cdf9f0d234aa9c3eeff246bbe1b9edd3b Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 23:29:01 +0200 Subject: [PATCH 7/9] Rearrange ifdefs --- utest/test_potrs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utest/test_potrs.c b/utest/test_potrs.c index 05ce3037b..2681615f4 100644 --- a/utest/test_potrs.c +++ b/utest/test_potrs.c @@ -42,7 +42,6 @@ void BLASFUNC(zpotrs_(char*, BLASINT*, BLASINT*, complex double*, //https://github.com/xianyi/OpenBLAS/issues/695 CTEST(potrf, bug_695){ -#ifdef BUILD_COMPLEX openblas_complex_float A1[100] = { openblas_make_complex_float(5.8525753, +0.0), @@ -151,11 +150,11 @@ CTEST(potrf, bug_695){ blasint n=10; blasint info[1]; +#ifdef BUILD_COMPLEX BLASFUNC(cpotrf)(&up, &n, (float*)(A1), &n, info); //printf("%g+%g*I\n", creal(A1[91]), cimag(A1[91])); #endif -#ifdef BUILD_COMPLEX16 openblas_complex_double A2[100] = { openblas_make_complex_double(3.0607147216796875, +0.0), @@ -284,9 +283,9 @@ CTEST(potrf, bug_695){ }; char lo = 'L'; blasint nrhs = 2; +#ifdef BUILD_COMPLEX16 BLASFUNC(zpotrs)(&lo, &n, &nrhs, (double*)(A2), &n, (double*)(B), &n, info); #endif -#ifdef BUILD_COMPLEX // note that this is exactly equal to A1 openblas_complex_float A3[100] = { @@ -391,6 +390,7 @@ CTEST(potrf, bug_695){ openblas_make_complex_float(-0.9617417, -1.2486815), openblas_make_complex_float(3.4629636, +0.0) }; +#ifdef BUILD_COMPLEX BLASFUNC(cpotrf)(&up, &n, (float*)(A3), &n, info); // printf("%g+%g*I\n", creal(A3[91]), cimag(A3[91])); if(isnan(CREAL(A3[91])) || isnan(CIMAG(A3[91]))) { From 9e11c2d62f23ef2483d206aaf3952e0bd09d30cb Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 13 Sep 2020 23:55:11 +0200 Subject: [PATCH 8/9] Add BUILD_SINGLE etc --- Makefile.rule | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile.rule b/Makefile.rule index 2c12177ee..40bd1a854 100644 --- a/Makefile.rule +++ b/Makefile.rule @@ -277,5 +277,10 @@ COMMON_PROF = -pg # If you want to enable the experimental BFLOAT16 support # BUILD_HALF = 1 # +# the below is not yet configurable, use cmake if you need to build only select types +BUILD_SINGLE = 1 +BUILD_DOUBLE = 1 +BUILD_COMPLEX = 1 +BUILD_COMPLEX16 = 1 # End of user configuration # From ba644378dce720f6bb946aa2b585c9e71f257e1f Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Mon, 14 Sep 2020 00:03:33 +0200 Subject: [PATCH 9/9] Copy BUILD_ options available to the compiler flags --- Makefile.system | 53 +++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/Makefile.system b/Makefile.system index 1b832ba41..0ccf9eaed 100644 --- a/Makefile.system +++ b/Makefile.system @@ -295,6 +295,7 @@ endif ifeq ($(C_COMPILER), GCC) GCCVERSIONGTEQ4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 4) GCCVERSIONGT4 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 4) +GCCVERSIONEQ5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` = 5) GCCVERSIONGT5 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \> 5) GCCVERSIONGTEQ7 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 7) GCCVERSIONGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9) @@ -593,35 +594,33 @@ endif ifeq ($(ARCH), zarch) DYNAMIC_CORE = ZARCH_GENERIC -# if the compiler accepts -march=arch11 or -march=z13 and can compile a file -# with z13-specific inline assembly, then we can include support for Z13. -# note: -march=z13 is equivalent to -march=arch11 yet some compiler releases -# only support one or the other. -# note: LLVM version 6.x supported -march=z13 yet could not handle vector -# registers in inline assembly, so the check for supporting the -march flag is -# not enough. -ZARCH_TEST_COMPILE=-c $(TOPDIR)/kernel/zarch/damin_z13.c -I$(TOPDIR) -o /dev/null > /dev/null 2> /dev/null -ZARCH_CC_SUPPORTS_ARCH11=$(shell $(CC) -march=arch11 $(ZARCH_TEST_COMPILE) && echo 1) -ZARCH_CC_SUPPORTS_Z13=$(shell $(CC) -march=z13 $(ZARCH_TEST_COMPILE) && echo 1) +# Z13 is supported since gcc-5.2, gcc-6, and in RHEL 7.3 and newer +ifeq ($(GCCVERSIONGT5), 1) + ZARCH_SUPPORT_Z13 := 1 +else ifeq ($(GCCVERSIONEQ5), 1) +ifeq ($(GCCMINORVERSIONGTEQ2), 1) + ZARCH_SUPPORT_Z13 := 1 +endif +endif -ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH11), $(ZARCH_CC_SUPPORTS_Z13)), 1) +ifeq ($(wildcard /etc/redhat-release), /etc/redhat-release) +ifeq ($(shell source /etc/os-release ; expr $$VERSION_ID \>= "7.3"), 1) + ZARCH_SUPPORT_Z13 := 1 +endif +endif + +ifeq ($(ZARCH_SUPPORT_Z13), 1) DYNAMIC_CORE += Z13 -CCOMMON_OPT += -DDYN_Z13 else -$(info OpenBLAS: Not building Z13 kernels because the compiler $(CC) does not support it) +$(info OpenBLAS: Not building Z13 kernels because gcc is older than 5.2 or 6.x) endif -# as above for z13, check for -march=arch12 and z14 support in the compiler. -ZARCH_CC_SUPPORTS_ARCH12=$(shell $(CC) -march=arch12 $(ZARCH_TEST_COMPILE) && echo 1) -ZARCH_CC_SUPPORTS_Z14=$(shell $(CC) -march=z14 $(ZARCH_TEST_COMPILE) && echo 1) -ifeq ($(or $(ZARCH_CC_SUPPORTS_ARCH12), $(ZARCH_CC_SUPPORTS_Z14)), 1) +ifeq ($(GCCVERSIONGTEQ7), 1) DYNAMIC_CORE += Z14 -CCOMMON_OPT += -DDYN_Z14 else -$(info OpenBLAS: Not building Z14 kernels because the compiler $(CC) does not support it) +$(info OpenBLAS: Not building Z14 kernels because gcc is older than 7.x) +endif endif - -endif # ARCH zarch ifeq ($(ARCH), power) DYNAMIC_CORE = POWER6 @@ -1223,6 +1222,18 @@ endif ifeq ($(BUILD_HALF), 1) CCOMMON_OPT += -DBUILD_HALF endif +ifeq ($(BUILD_SINGLE), 1) +CCOMMON_OPT += -DBUILD_SINGLE +endif +ifeq ($(BUILD_DOUBLE), 1) +CCOMMON_OPT += -DBUILD_DOUBLE +endif +ifeq ($(BUILD_COMPLEX), 1) +CCOMMON_OPT += -DBUILD_COMPLEX +endif +ifeq ($(BUILD_COMPLEX16), 1) +CCOMMON_OPT += -DBUILD_COMPLEX16 +endif CCOMMON_OPT += -DVERSION=\"$(VERSION)\"