Enable GEMM3M tests when the architecture supports GEMM3Mtags/v0.3.27
| @@ -42,6 +42,7 @@ jobs: | |||
| - name: Install Dependencies | |||
| run: | | |||
| if [ "$RUNNER_OS" == "Linux" ]; then | |||
| sudo apt-get update | |||
| sudo apt-get install -y gfortran cmake ccache libtinfo5 | |||
| elif [ "$RUNNER_OS" == "macOS" ]; then | |||
| # It looks like "gfortran" isn't working correctly unless "gcc" is re-installed. | |||
| @@ -88,6 +88,17 @@ if (NOT NOFORTRAN) | |||
| auxiliary.c | |||
| c_xerbla.c | |||
| constant.c) | |||
| if (USE_GEMM3M) | |||
| if ((${float_char} STREQUAL "c") OR (${float_char} STREQUAL "z")) | |||
| add_executable(x${float_char}cblat3_3m | |||
| c_${float_char}blat3_3m.f | |||
| c_${float_char}blas3_3m.c | |||
| c_${float_char}3chke_3m.c | |||
| auxiliary.c | |||
| c_xerbla.c | |||
| constant.c) | |||
| endif() | |||
| endif() | |||
| else() | |||
| add_executable(x${float_char}cblat3 | |||
| c_${float_char}blat3c.c | |||
| @@ -96,6 +107,17 @@ else() | |||
| auxiliary.c | |||
| c_xerbla.c | |||
| constant.c) | |||
| if (USE_GEMM3M) | |||
| if ((${float_char} STREQUAL "c") OR (${float_char} STREQUAL "z")) | |||
| add_executable(x${float_char}cblat3_3m | |||
| c_${float_char}blat3c_3m.c | |||
| c_${float_char}blas3_3m.c | |||
| c_${float_char}3chke_3m.c | |||
| auxiliary.c | |||
| c_xerbla.c | |||
| constant.c) | |||
| endif() | |||
| endif() | |||
| endif() | |||
| target_link_libraries(x${float_char}cblat3 ${OpenBLAS_LIBNAME}) | |||
| if (USE_OPENMP AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL GNU) AND (${CMAKE_C_COMPILER_ID} STREQUAL Clang)) | |||
| @@ -105,7 +127,24 @@ endif() | |||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX") | |||
| target_link_libraries(x${float_char}cblat3 m) | |||
| endif() | |||
| if (USE_GEMM3M) | |||
| if ((${float_char} STREQUAL "c") OR (${float_char} STREQUAL "z")) | |||
| target_link_libraries(x${float_char}cblat3_3m ${OpenBLAS_LIBNAME}) | |||
| if (USE_OPENMP AND (${CMAKE_Fortran_COMPILER_ID} STREQUAL GNU) AND (${CMAKE_C_COMPILER_ID} STREQUAL Clang)) | |||
| string(REGEX REPLACE "-fopenmp" "" CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS}") | |||
| target_link_libraries(x${float_char}cblat3 omp pthread) | |||
| endif() | |||
| if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" OR ${CMAKE_SYSTEM_NAME} MATCHES "QNX") | |||
| target_link_libraries(x${float_char}cblat3_3m m) | |||
| endif() | |||
| endif() | |||
| endif() | |||
| add_test(NAME "x${float_char}cblat3" | |||
| COMMAND ${test_helper} $<TARGET_FILE:x${float_char}cblat3> "${PROJECT_SOURCE_DIR}/ctest/${float_char}in3") | |||
| if (USE_GEMM3M) | |||
| if ((${float_char} STREQUAL "c") OR (${float_char} STREQUAL "z")) | |||
| add_test(NAME "x${float_char}cblat3_3m" | |||
| COMMAND ${test_helper} $<TARGET_FILE:x${float_char}cblat3_3m> "${PROJECT_SOURCE_DIR}/ctest/${float_char}in3_3m") | |||
| endif() | |||
| endif() | |||
| endforeach() | |||
| @@ -5,6 +5,24 @@ | |||
| TOPDIR = .. | |||
| include $(TOPDIR)/Makefile.system | |||
| SUPPORT_GEMM3M = 0 | |||
| ifeq ($(ARCH), x86) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), x86_64) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), ia64) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), MIPS) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| override CFLAGS += -DADD$(BU) -DCBLAS | |||
| ifeq ($(F_COMPILER),GFORTRAN) | |||
| override FFLAGS += -fno-tree-vectorize | |||
| @@ -144,9 +162,15 @@ all3targets += xdcblat3 | |||
| endif | |||
| ifeq ($(BUILD_COMPLEX),1) | |||
| all3targets += xccblat3 | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| all3targets += xccblat3_3m | |||
| endif | |||
| endif | |||
| ifeq ($(BUILD_COMPLEX16),1) | |||
| all3targets += xzcblat3 | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| all3targets += xzcblat3_3m | |||
| endif | |||
| endif | |||
| all3: $(all3targets) | |||
| @@ -181,9 +205,9 @@ endif | |||
| endif | |||
| endif | |||
| all3_3m: xzcblat3_3m xccblat3_3m | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| ifeq ($(USE_OPENMP), 1) | |||
| ifeq ($(BUILD_SINGLE),1) | |||
| ifeq ($(BUILD_COMPLEX),1) | |||
| OMP_NUM_THREADS=2 ./xccblat3_3m < cin3_3m | |||
| endif | |||
| ifeq ($(BUILD_COMPLEX16),1) | |||
| @@ -197,6 +221,7 @@ ifeq ($(BUILD_COMPLEX16),1) | |||
| OPENBLAS_NUM_THREADS=2 ./xzcblat3_3m < zin3_3m | |||
| endif | |||
| endif | |||
| endif | |||
| @@ -271,8 +296,10 @@ xccblat2: $(ctestl2o) c_cblat2.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xccblat2 c_cblat2.o $(ctestl2o) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| xccblat3: $(ctestl3o) c_cblat3.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xccblat3 c_cblat3.o $(ctestl3o) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| xccblat3_3m: $(ctestl3o_3m) c_cblat3_3m.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xccblat3_3m c_cblat3_3m.o $(ctestl3o_3m) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| endif | |||
| else | |||
| xccblat1: $(ctestl1o) c_cblat1c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xccblat1 c_cblat1c.o $(ctestl1o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| @@ -280,6 +307,10 @@ xccblat2: $(ctestl2o) c_cblat2c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xccblat2 c_cblat2c.o $(ctestl2o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| xccblat3: $(ctestl3o) c_cblat3c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xccblat3 c_cblat3c.o $(ctestl3o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| xccblat3_3m: $(ctestl3o_3m) c_cblat3c_3m.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xccblat3_3m c_cblat3c_3m.o $(ctestl3o_3m) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| endif | |||
| endif | |||
| endif | |||
| @@ -293,8 +324,10 @@ xzcblat2: $(ztestl2o) c_zblat2.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xzcblat2 c_zblat2.o $(ztestl2o) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| xzcblat3: $(ztestl3o) c_zblat3.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xzcblat3 c_zblat3.o $(ztestl3o) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| xzcblat3_3m: $(ztestl3o_3m) c_zblat3_3m.o $(TOPDIR)/$(LIBNAME) | |||
| $(FC) $(FLDFLAGS) -o xzcblat3_3m c_zblat3_3m.o $(ztestl3o_3m) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| endif | |||
| else | |||
| xzcblat1: $(ztestl1o) c_zblat1c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xzcblat1 c_zblat1c.o $(ztestl1o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| @@ -302,6 +335,10 @@ xzcblat2: $(ztestl2o) c_zblat2c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xzcblat2 c_zblat2c.o $(ztestl2o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| xzcblat3: $(ztestl3o) c_zblat3c.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xzcblat3 c_zblat3c.o $(ztestl3o) $(LIB) $(CEXTRALIB) $(filter-out -lgfortran,$(EXTRALIB)) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| xzcblat3_3m: $(ztestl3o_3m) c_zblat3c_3m.o $(TOPDIR)/$(LIBNAME) | |||
| $(CC) $(CFLAGS) -o xzcblat3_3m c_zblat3c_3m.o $(ztestl3o_3m) $(LIB) $(EXTRALIB) $(CEXTRALIB) | |||
| endif | |||
| endif | |||
| endif | |||
| @@ -21,7 +21,16 @@ endif() | |||
| if (BUILD_COMPLEX16) | |||
| list (APPEND OpenBLAS_Tests zblat1 zblat2 zblat3) | |||
| endif() | |||
| message (STATUS CCOMP ${CMAKE_C_COMPILER_ID} FCOMP ${CMAKE_Fortran_COMPILER_ID}) | |||
| if (USE_GEMM3M) | |||
| if (BUILD_COMPLEX) | |||
| list (APPEND OpenBLAS_Tests cblat3_3m) | |||
| endif () | |||
| if (BUILD_COMPLEX16) | |||
| list (APPEND OpenBLAS_Tests zblat3_3m) | |||
| endif () | |||
| endif () | |||
| foreach(test_bin ${OpenBLAS_Tests}) | |||
| add_executable(${test_bin} ${test_bin}.f) | |||
| target_link_libraries(${test_bin} ${OpenBLAS_LIBNAME}) | |||
| @@ -82,4 +91,10 @@ add_test(NAME "${float_type}blas2" | |||
| COMMAND ${helper_prefix} $<TARGET_FILE:${float_type}blat2> "${PROJECT_SOURCE_DIR}/test/${float_type}blat2.dat" ${float_type_upper}BLAT2.SUMM) | |||
| add_test(NAME "${float_type}blas3" | |||
| COMMAND ${helper_prefix} $<TARGET_FILE:${float_type}blat3> "${PROJECT_SOURCE_DIR}/test/${float_type}blat3.dat" ${float_type_upper}BLAT3.SUMM) | |||
| if (USE_GEMM3M) | |||
| if ((${float_type} STREQUAL "c") OR (${float_type} STREQUAL "z")) | |||
| add_test(NAME "${float_type}blas3_3m" | |||
| COMMAND ${helper_prefix} $<TARGET_FILE:${float_type}blat3_3m> "${PROJECT_SOURCE_DIR}/test/${float_type}blat3_3m.dat" ${float_type_upper}BLAT3_3M.SUMM) | |||
| endif() | |||
| endif() | |||
| endforeach() | |||
| @@ -4,6 +4,24 @@ ifeq ($(F_COMPILER),GFORTRAN) | |||
| override FFLAGS += -fno-tree-vectorize | |||
| endif | |||
| SUPPORT_GEMM3M = 0 | |||
| ifeq ($(ARCH), x86) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), x86_64) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), ia64) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(ARCH), MIPS) | |||
| SUPPORT_GEMM3M = 1 | |||
| endif | |||
| ifeq ($(NOFORTRAN),1) | |||
| all :: | |||
| else | |||
| @@ -153,11 +171,20 @@ ifeq ($(BUILD_DOUBLE),1) | |||
| D3=dblat3 | |||
| endif | |||
| ifeq ($(BUILD_COMPLEX),1) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| C3=cblat3 cblat3_3m | |||
| else | |||
| C3=cblat3 | |||
| endif | |||
| endif | |||
| ifeq ($(BUILD_COMPLEX16),1) | |||
| ifeq ($(SUPPORT_GEMM3M),1) | |||
| Z3=zblat3 zblat3_3m | |||
| else | |||
| Z3=zblat3 | |||
| endif | |||
| endif | |||
| level3: $(B3) $(S3) $(D3) $(C3) $(Z3) | |||
| @@ -126,7 +126,7 @@ static float check_cgemv(char api, char order, char trans, blasint m, blasint n, | |||
| srand_generate(data_cgemv_t.y_test, m * inc_y * 2); | |||
| // Copy vector y for reference funcs | |||
| for (int i = 0; i < m * inc_y * 2; i++) { | |||
| for (i = 0; i < m * inc_y * 2; i++) { | |||
| data_cgemv_t.y_verify[i] = data_cgemv_t.y_test[i]; | |||
| } | |||
| @@ -1129,4 +1129,4 @@ CTEST(cgemv, c_api_xerbla_invalid_order_col_major) | |||
| int passed = c_api_check_badargs(corder, ctrans, m, n, lda, inc_x, inc_y, expected_info); | |||
| ASSERT_EQUAL(TRUE, passed); | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -188,7 +188,7 @@ static float check_csbmv(char uplo, blasint n, blasint k, float *alpha, blasint | |||
| char trans = 'N'; | |||
| // Symmetric band packed matrix for sbmv | |||
| float a[lda * n * 2]; | |||
| float *a = (float*) malloc(lda * n * 2 * sizeof(float)); | |||
| // Fill symmetric packed matrix sp_matrix, vector b_test, vector c_test | |||
| srand_generate(data_csbmv.sp_matrix, n * (n + 1)); | |||
| @@ -216,7 +216,7 @@ static float check_csbmv(char uplo, blasint n, blasint k, float *alpha, blasint | |||
| // Find the differences between output vector caculated by csbmv and cgemv | |||
| for (i = 0; i < n * inc_c * 2; i++) | |||
| data_csbmv.c_test[i] -= data_csbmv.c_verify[i]; | |||
| free(a); | |||
| // Find the norm of differences | |||
| return BLASFUNC(scnrm2)(&n, data_csbmv.c_test, &inc_c); | |||
| } | |||
| @@ -603,4 +603,4 @@ CTEST(csbmv, xerbla_lda_invalid) | |||
| int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info); | |||
| ASSERT_EQUAL(TRUE, passed); | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -402,13 +402,14 @@ CTEST(idamin, min_idx_in_vec_tail){ | |||
| CTEST(idamin, min_idx_in_vec_tail_inc_1){ | |||
| blasint i; | |||
| blasint N = ELEMENTS, inc = 1; | |||
| double x[ELEMENTS * inc]; | |||
| double *x = (double*)malloc(ELEMENTS * inc * sizeof(double)); | |||
| for (i = 0; i < N * inc; i ++) { | |||
| x[i] = i + 1000; | |||
| } | |||
| x[(N - 1) * inc] = 0.0f; | |||
| blasint index = BLASFUNC(idamin)(&N, x, &inc); | |||
| free(x); | |||
| ASSERT_EQUAL(N, index); | |||
| } | |||
| @@ -775,13 +776,14 @@ CTEST(idamin, c_api_min_idx_in_vec_tail){ | |||
| CTEST(idamin, c_api_min_idx_in_vec_tail_inc_1){ | |||
| blasint i; | |||
| blasint N = ELEMENTS, inc = 1; | |||
| double x[ELEMENTS * inc]; | |||
| double *x = (double*) malloc(ELEMENTS * inc * sizeof(double)); | |||
| for (i = 0; i < N * inc; i ++) { | |||
| x[i] = i + 1000; | |||
| } | |||
| x[(N - 1) * inc] = 0.0; | |||
| blasint index = cblas_idamin(N, x, inc); | |||
| free(x); | |||
| ASSERT_EQUAL(N - 1, index); | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -402,13 +402,14 @@ CTEST(isamin, min_idx_in_vec_tail){ | |||
| CTEST(isamin, min_idx_in_vec_tail_inc_1){ | |||
| blasint i; | |||
| blasint N = ELEMENTS, inc = 1; | |||
| float x[ELEMENTS * inc]; | |||
| float *x = (float*) malloc(ELEMENTS * inc * sizeof(float)); | |||
| for (i = 0; i < N * inc; i ++) { | |||
| x[i] = i + 1000; | |||
| } | |||
| x[(N - 1) * inc] = 0.0f; | |||
| blasint index = BLASFUNC(isamin)(&N, x, &inc); | |||
| free(x); | |||
| ASSERT_EQUAL(N, index); | |||
| } | |||
| @@ -775,13 +776,14 @@ CTEST(isamin, c_api_min_idx_in_vec_tail){ | |||
| CTEST(isamin, c_api_min_idx_in_vec_tail_inc_1){ | |||
| blasint i; | |||
| blasint N = ELEMENTS, inc = 1; | |||
| float x[ELEMENTS * inc]; | |||
| float *x = (float*)malloc(ELEMENTS * inc * sizeof(float)); | |||
| for (i = 0; i < N * inc; i ++) { | |||
| x[i] = i + 1000; | |||
| } | |||
| x[(N - 1) * inc] = 0.0f; | |||
| blasint index = cblas_isamin(N, x, inc); | |||
| free(x); | |||
| ASSERT_EQUAL(N - 1, index); | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -126,7 +126,7 @@ static double check_zgemv(char api, char order, char trans, blasint m, blasint n | |||
| drand_generate(data_zgemv_t.y_test, m * inc_y * 2); | |||
| // Copy vector y for reference funcs | |||
| for (int i = 0; i < m * inc_y * 2; i++) | |||
| for (i = 0; i < m * inc_y * 2; i++) | |||
| { | |||
| data_zgemv_t.y_verify[i] = data_zgemv_t.y_test[i]; | |||
| } | |||
| @@ -1133,4 +1133,4 @@ CTEST(zgemv, c_api_xerbla_invalid_order_col_major) | |||
| int passed = c_api_check_badargs(corder, ctrans, m, n, lda, inc_x, inc_y, expected_info); | |||
| ASSERT_EQUAL(TRUE, passed); | |||
| } | |||
| #endif | |||
| #endif | |||
| @@ -188,7 +188,7 @@ static double check_zsbmv(char uplo, blasint n, blasint k, double *alpha, blasin | |||
| char trans = 'N'; | |||
| // Symmetric band packed matrix for sbmv | |||
| double a[lda * n * 2]; | |||
| double *a = (double*) malloc(lda * n * 2 * sizeof(double)); | |||
| // Fill symmetric packed matrix sp_matrix, vector b_test, vector c_test | |||
| drand_generate(data_zsbmv.sp_matrix, n * (n + 1)); | |||
| @@ -213,6 +213,7 @@ static double check_zsbmv(char uplo, blasint n, blasint k, double *alpha, blasin | |||
| BLASFUNC(zsbmv)(&uplo, &n, &k, alpha, a, &lda, | |||
| data_zsbmv.b_test, &inc_b, beta, data_zsbmv.c_test, &inc_c); | |||
| free(a); | |||
| // Find the differences between output vector caculated by zsbmv and zgemv | |||
| for (i = 0; i < n * inc_c * 2; i++) | |||
| data_zsbmv.c_test[i] -= data_zsbmv.c_verify[i]; | |||
| @@ -603,4 +604,4 @@ CTEST(zsbmv, xerbla_lda_invalid) | |||
| int passed = check_badargs(uplo, n, k, lda, inc_b, inc_c, expected_info); | |||
| ASSERT_EQUAL(TRUE, passed); | |||
| } | |||
| #endif | |||
| #endif | |||