Support compilation without CBLAS

This commit is contained in:
Martin Kroeker 2024-05-11 13:10:54 +02:00 committed by GitHub
parent a6c184d150
commit d8baf2f2ea
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
45 changed files with 220 additions and 62 deletions

View File

@ -69,7 +69,7 @@ float smatrix_difference(float *a, float *b, blasint cols, blasint rows, blasint
for (j = 0; j < cols; j++) { for (j = 0; j < cols; j++) {
a_ptr[j] -= b_ptr[j]; a_ptr[j] -= b_ptr[j];
} }
norm += cblas_snrm2(cols, a_ptr, inc); norm += BLASFUNC(snrm2)(&cols, a_ptr, &inc);
a_ptr += ld; a_ptr += ld;
b_ptr += ld; b_ptr += ld;
@ -92,7 +92,7 @@ double dmatrix_difference(double *a, double *b, blasint cols, blasint rows, blas
for (j = 0; j < cols; j++) { for (j = 0; j < cols; j++) {
a_ptr[j] -= b_ptr[j]; a_ptr[j] -= b_ptr[j];
} }
norm += cblas_dnrm2(cols, a_ptr, inc); norm += BLASFUNC(dnrm2)(&cols, a_ptr, &inc);
a_ptr += ld; a_ptr += ld;
b_ptr += ld; b_ptr += ld;
@ -256,4 +256,4 @@ void zcopy(blasint rows, blasint cols, double *alpha, double *a_src, int lda_src
a_dst[i*lda_dst+j+1] = (-1.0) * conj *alpha[0] * a_src[i*lda_src+j+1] + alpha[1] * a_src[i*lda_src+j]; a_dst[i*lda_dst+j+1] = (-1.0) * conj *alpha[0] * a_src[i*lda_src+j+1] + alpha[1] * a_src[i*lda_src+j];
} }
} }
} }

View File

@ -96,7 +96,7 @@ static float check_caxpby(blasint n, float *alpha, blasint incx, float *beta, bl
// Find the norm of differences // Find the norm of differences
return BLASFUNC(scnrm2)(&n, data_caxpby.y_test, &incy_abs); return BLASFUNC(scnrm2)(&n, data_caxpby.y_test, &incy_abs);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Test caxpby by comparing it with cscal and caxpy. * Test caxpby by comparing it with cscal and caxpy.
@ -146,7 +146,7 @@ static float c_api_check_caxpby(blasint n, float *alpha, blasint incx, float *be
// Find the norm of differences // Find the norm of differences
return cblas_scnrm2(n, data_caxpby.y_test, incy_abs); return cblas_scnrm2(n, data_caxpby.y_test, incy_abs);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
* Test caxpby by comparing it with cscal and caxpy. * Test caxpby by comparing it with cscal and caxpy.
@ -388,6 +388,7 @@ CTEST(caxpby, check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test caxpby by comparing it with cscal and caxpy. * Test caxpby by comparing it with cscal and caxpy.
@ -629,3 +630,4 @@ CTEST(caxpby, c_api_check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -62,13 +62,14 @@ static void cgeadd_trusted(blasint m, blasint n, float *alpha, float *aptr,
blasint lda, float *beta, float *cptr, blasint ldc) blasint lda, float *beta, float *cptr, blasint ldc)
{ {
blasint i; blasint i;
blasint one=1;
lda *= 2; lda *= 2;
ldc *= 2; ldc *= 2;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
cblas_caxpby(m, alpha, aptr, 1, beta, cptr, 1); BLASFUNC(caxpby)(&m, alpha, aptr, &one, beta, cptr, &one);
aptr += lda; aptr += lda;
cptr += ldc; cptr += ldc;
} }
@ -116,9 +117,11 @@ static float check_cgeadd(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(cgeadd)(&m, &n, alpha, data_cgeadd.a_test, &lda, BLASFUNC(cgeadd)(&m, &n, alpha, data_cgeadd.a_test, &lda,
beta, data_cgeadd.c_test, &ldc); beta, data_cgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_cgeadd(order, m, n, alpha, data_cgeadd.a_test, lda, cblas_cgeadd(order, m, n, alpha, data_cgeadd.a_test, lda,
beta, data_cgeadd.c_test, ldc); beta, data_cgeadd.c_test, ldc);
#endif
// Find the differences between output matrix caculated by cgeadd and sgemm // Find the differences between output matrix caculated by cgeadd and sgemm
return smatrix_difference(data_cgeadd.c_test, data_cgeadd.c_verify, cols, rows, ldc*2); return smatrix_difference(data_cgeadd.c_test, data_cgeadd.c_verify, cols, rows, ldc*2);
@ -150,9 +153,11 @@ static int check_badargs(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(cgeadd)(&m, &n, alpha, data_cgeadd.a_test, &lda, BLASFUNC(cgeadd)(&m, &n, alpha, data_cgeadd.a_test, &lda,
beta, data_cgeadd.c_test, &ldc); beta, data_cgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_cgeadd(order, m, n, alpha, data_cgeadd.a_test, lda, cblas_cgeadd(order, m, n, alpha, data_cgeadd.a_test, lda,
beta, data_cgeadd.c_test, ldc); beta, data_cgeadd.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -419,7 +424,7 @@ CTEST(cgeadd, m_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test cgeadd by comparing it against sgemm * Test cgeadd by comparing it against sgemm
@ -877,4 +882,5 @@ CTEST(cgeadd, c_api_m_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -73,6 +73,7 @@ static float check_cgemm(char transa, char transb, blasint m, blasint n, blasint
float alpha_conj[] = {1.0f, 0.0f}; float alpha_conj[] = {1.0f, 0.0f};
char transa_verify = transa; char transa_verify = transa;
char transb_verify = transb; char transb_verify = transb;
char cc[2]="C", cr[2]="R";
int arows = k, acols = m; int arows = k, acols = m;
int brows = n, bcols = k; int brows = n, bcols = k;
@ -99,12 +100,12 @@ static float check_cgemm(char transa, char transb, blasint m, blasint n, blasint
data_cgemm.c_verify[i] = data_cgemm.c_test[i]; data_cgemm.c_verify[i] = data_cgemm.c_test[i];
if (transa == 'R'){ if (transa == 'R'){
cblas_cimatcopy(CblasColMajor, CblasConjNoTrans, arows, acols, alpha_conj, data_cgemm.a_verify, lda, lda); BLASFUNC(cimatcopy)(cc, cr, &arows, &acols, alpha_conj, data_cgemm.a_verify, &lda, &lda);
transa_verify = 'N'; transa_verify = 'N';
} }
if (transb == 'R'){ if (transb == 'R'){
cblas_cimatcopy(CblasColMajor, CblasConjNoTrans, brows, bcols, alpha_conj, data_cgemm.b_verify, ldb, ldb); BLASFUNC(cimatcopy)(cc, cr, &brows, &bcols, alpha_conj, data_cgemm.b_verify, &ldb, &ldb);
transb_verify = 'N'; transb_verify = 'N';
} }
@ -270,4 +271,4 @@ CTEST(cgemm, transa_conjnotransb)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif

View File

@ -73,9 +73,11 @@ static void cgemmt_trusted(char api, enum CBLAS_ORDER order, char uplo, char tra
if(api == 'F') if(api == 'F')
BLASFUNC(cgemm)(&transa, &transb, &m, &m, &k, alpha, data_cgemmt.a_test, &lda, BLASFUNC(cgemm)(&transa, &transb, &m, &m, &k, alpha, data_cgemmt.a_test, &lda,
data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_gemm, &ldc); data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_gemm, &ldc);
#ifndef NO_CBLAS
else else
cblas_cgemm(order, transa, transb, m, m, k, alpha, data_cgemmt.a_test, lda, cblas_cgemm(order, transa, transb, m, m, k, alpha, data_cgemmt.a_test, lda,
data_cgemmt.b_test, ldb, beta, data_cgemmt.c_gemm, ldc); data_cgemmt.b_test, ldb, beta, data_cgemmt.c_gemm, ldc);
#endif
ldc *= 2; ldc *= 2;
@ -160,9 +162,11 @@ static float check_cgemmt(char api, enum CBLAS_ORDER order, char uplo, char tran
if (api == 'F') if (api == 'F')
BLASFUNC(cgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_cgemmt.a_test, BLASFUNC(cgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_cgemmt.a_test,
&lda, data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_test, &ldc); &lda, data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_cgemmt(order, uplo, transa, transb, m, k, alpha, data_cgemmt.a_test, lda, cblas_cgemmt(order, uplo, transa, transb, m, k, alpha, data_cgemmt.a_test, lda,
data_cgemmt.b_test, ldb, beta, data_cgemmt.c_test, ldc); data_cgemmt.b_test, ldb, beta, data_cgemmt.c_test, ldc);
#endif
for (i = 0; i < m * ldc * 2; i++) for (i = 0; i < m * ldc * 2; i++)
data_cgemmt.c_verify[i] -= data_cgemmt.c_test[i]; data_cgemmt.c_verify[i] -= data_cgemmt.c_test[i];
@ -197,9 +201,11 @@ static int check_badargs(char api, enum CBLAS_ORDER order, char uplo, char trans
if (api == 'F') if (api == 'F')
BLASFUNC(cgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_cgemmt.a_test, BLASFUNC(cgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_cgemmt.a_test,
&lda, data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_test, &ldc); &lda, data_cgemmt.b_test, &ldb, beta, data_cgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_cgemmt(order, uplo, transa, transb, m, k, alpha, data_cgemmt.a_test, lda, cblas_cgemmt(order, uplo, transa, transb, m, k, alpha, data_cgemmt.a_test, lda,
data_cgemmt.b_test, ldb, beta, data_cgemmt.c_test, ldc); data_cgemmt.b_test, ldb, beta, data_cgemmt.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -680,6 +686,7 @@ CTEST(cgemmt, lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test cgemmt by comparing it against sgemm * Test cgemmt by comparing it against sgemm
@ -1591,6 +1598,7 @@ CTEST(cgemmt, c_api_rowmajor_lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -1736,6 +1744,7 @@ CTEST(cgemmt, xerbla_ldc_invalid)
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test. * C API specific test.
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -2007,4 +2016,5 @@ CTEST(cgemmt, xerbla_c_api_rowmajor_ldc_invalid)
M, K, lda, ldb, ldc, expected_info); M, K, lda, ldb, ldc, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -65,6 +65,7 @@ static struct DATA_CGEMV_T data_cgemv_t;
static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc_x) static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc_x)
{ {
blasint i; blasint i;
blasint one=1;
float *a_ptr = data_cgemv_t.a_verify; float *a_ptr = data_cgemv_t.a_verify;
float *x_ptr = data_cgemv_t.x_test; float *x_ptr = data_cgemv_t.x_test;
float *x_res = data_cgemv_t.x_verify; float *x_res = data_cgemv_t.x_verify;
@ -73,7 +74,7 @@ static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc
for (i = 0; i < n * inc_x; i+= inc_x) for (i = 0; i < n * inc_x; i+= inc_x)
{ {
result = cblas_cdotu(lda, a_ptr, 1, x_ptr, inc_x); result = BLASFUNC(cdotu)(&lda, a_ptr, &one, x_ptr, &inc_x);
x_res[0] = CREAL(result); x_res[0] = CREAL(result);
x_res[1] = CIMAG(result); x_res[1] = CIMAG(result);
a_ptr += lda * 2; a_ptr += lda * 2;
@ -153,6 +154,7 @@ static float check_cgemv(char api, char order, char trans, blasint m, blasint n,
BLASFUNC(cgemv)(&trans, &m, &n, alpha, data_cgemv_t.a_test, BLASFUNC(cgemv)(&trans, &m, &n, alpha, data_cgemv_t.a_test,
&lda, data_cgemv_t.x_test, &inc_x, beta, data_cgemv_t.y_test, &inc_y); &lda, data_cgemv_t.x_test, &inc_x, beta, data_cgemv_t.y_test, &inc_y);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -173,13 +175,14 @@ static float check_cgemv(char api, char order, char trans, blasint m, blasint n,
cblas_cgemv(corder, ctrans, m, n, alpha, data_cgemv_t.a_test, cblas_cgemv(corder, ctrans, m, n, alpha, data_cgemv_t.a_test,
lda, data_cgemv_t.x_test, inc_x, beta, data_cgemv_t.y_test, inc_y); lda, data_cgemv_t.x_test, inc_x, beta, data_cgemv_t.y_test, inc_y);
} }
#endif
// Find the differences between output vector caculated by cgemv and reference funcs // Find the differences between output vector caculated by cgemv and reference funcs
for (i = 0; i < m * inc_y * 2; i++) for (i = 0; i < m * inc_y * 2; i++)
data_cgemv_t.y_test[i] -= data_cgemv_t.y_verify[i]; data_cgemv_t.y_test[i] -= data_cgemv_t.y_verify[i];
// Find the norm of differences // Find the norm of differences
return cblas_scnrm2(m, data_cgemv_t.y_test, inc_y); return BLASFUNC(scnrm2)(&m, data_cgemv_t.y_test, &inc_y);
} }
/** /**
@ -213,6 +216,7 @@ static int check_badargs(char order, char trans, blasint m, blasint n,
return check_error(); return check_error();
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Check if error function was called with expected function name * Check if error function was called with expected function name
@ -1130,3 +1134,4 @@ CTEST(cgemv, c_api_xerbla_invalid_order_col_major)
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -98,6 +98,7 @@ static float check_cimatcopy(char api, char order, char trans, blasint rows, bla
BLASFUNC(cimatcopy)(&order, &trans, &rows, &cols, alpha, data_cimatcopy.a_test, BLASFUNC(cimatcopy)(&order, &trans, &rows, &cols, alpha, data_cimatcopy.a_test,
&lda_src, &lda_dst); &lda_src, &lda_dst);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -108,6 +109,7 @@ static float check_cimatcopy(char api, char order, char trans, blasint rows, bla
cblas_cimatcopy(corder, ctrans, rows, cols, alpha, data_cimatcopy.a_test, cblas_cimatcopy(corder, ctrans, rows, cols, alpha, data_cimatcopy.a_test,
lda_src, lda_dst); lda_src, lda_dst);
} }
#endif
// Find the differences between output matrix computed by cimatcopy and reference func // Find the differences between output matrix computed by cimatcopy and reference func
return smatrix_difference(data_cimatcopy.a_test, data_cimatcopy.a_verify, cols_out, rows_out, 2*lda_dst); return smatrix_difference(data_cimatcopy.a_test, data_cimatcopy.a_verify, cols_out, rows_out, 2*lda_dst);
@ -502,6 +504,7 @@ CTEST(cimatcopy, rowmajor_conjtrans_col_50_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test cimatcopy by comparing it against reference * Test cimatcopy by comparing it against reference
@ -681,6 +684,7 @@ CTEST(cimatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -815,4 +819,4 @@ CTEST(cimatcopy, xerbla_colmajor_trans_invalid_ldb)
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info); int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif

View File

@ -99,6 +99,7 @@ static float check_comatcopy(char api, char order, char trans, blasint rows, bla
BLASFUNC(comatcopy)(&order, &trans, &rows, &cols, alpha, data_comatcopy.a_test, BLASFUNC(comatcopy)(&order, &trans, &rows, &cols, alpha, data_comatcopy.a_test,
&lda, data_comatcopy.b_test, &ldb); &lda, data_comatcopy.b_test, &ldb);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -109,6 +110,7 @@ static float check_comatcopy(char api, char order, char trans, blasint rows, bla
cblas_comatcopy(corder, ctrans, rows, cols, alpha, data_comatcopy.a_test, cblas_comatcopy(corder, ctrans, rows, cols, alpha, data_comatcopy.a_test,
lda, data_comatcopy.b_test, ldb); lda, data_comatcopy.b_test, ldb);
} }
#endif
return smatrix_difference(data_comatcopy.b_test, data_comatcopy.b_verify, b_cols, b_rows, ldb*2); return smatrix_difference(data_comatcopy.b_test, data_comatcopy.b_verify, b_cols, b_rows, ldb*2);
} }
@ -316,6 +318,7 @@ CTEST(comatcopy, rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test comatcopy by comparing it against refernce * Test comatcopy by comparing it against refernce
@ -491,6 +494,7 @@ CTEST(comatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.

View File

@ -107,6 +107,7 @@ static float check_csrot(blasint n, blasint inc_x, blasint inc_y, float *c, floa
return (norm / 2); return (norm / 2);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Comapare results computed by csrot and caxpby * Comapare results computed by csrot and caxpby
@ -789,4 +790,5 @@ CTEST(crot, c_api_check_n_zero)
float norm = c_api_check_csrot(n, inc_x, inc_y, c, s); float norm = c_api_check_csrot(n, inc_x, inc_y, c, s);
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -161,7 +161,7 @@ CTEST(crotg, negative_real_negative_img)
ASSERT_DBL_NEAR_TOL(-5.26498f, sa[0], SINGLE_EPS); ASSERT_DBL_NEAR_TOL(-5.26498f, sa[0], SINGLE_EPS);
ASSERT_DBL_NEAR_TOL(-7.01997f, sa[1], SINGLE_EPS); ASSERT_DBL_NEAR_TOL(-7.01997f, sa[1], SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test crotg by comparing it against pre-calculated values * Test crotg by comparing it against pre-calculated values
@ -287,4 +287,5 @@ CTEST(crotg, c_api_negative_real_negative_img)
ASSERT_DBL_NEAR_TOL(-5.26498f, sa[0], SINGLE_EPS); ASSERT_DBL_NEAR_TOL(-5.26498f, sa[0], SINGLE_EPS);
ASSERT_DBL_NEAR_TOL(-7.01997f, sa[1], SINGLE_EPS); ASSERT_DBL_NEAR_TOL(-7.01997f, sa[1], SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -91,8 +91,10 @@ static float check_cscal(char api, blasint n, float *alpha, blasint inc)
if(api == 'F') if(api == 'F')
BLASFUNC(cscal)(&n, alpha, data_cscal.x_test, &inc); BLASFUNC(cscal)(&n, alpha, data_cscal.x_test, &inc);
#ifndef NO_CBLAS
else else
cblas_cscal(n, alpha, data_cscal.x_test, inc); cblas_cscal(n, alpha, data_cscal.x_test, inc);
#endif
// Find the differences between output vector computed by cscal and cscal_trusted // Find the differences between output vector computed by cscal and cscal_trusted
for (i = 0; i < n * 2 * inc; i++) for (i = 0; i < n * 2 * inc; i++)
@ -132,6 +134,7 @@ CTEST(cscal, alpha_r_zero_alpha_i_zero_inc_2)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test cscal by comparing it against reference * Test cscal by comparing it against reference
@ -161,4 +164,5 @@ CTEST(cscal, c_api_alpha_r_zero_alpha_i_zero_inc_2)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -65,6 +65,7 @@ static float check_ctrmv(char uplo, char trans, char diag, blasint n, blasint ld
blasint i; blasint i;
float alpha_conj[] = {1.0f, 0.0f}; float alpha_conj[] = {1.0f, 0.0f};
char trans_verify = trans; char trans_verify = trans;
char cc[2]="C", cr[2]="R";
srand_generate(data_ctrmv.a_test, n * lda * 2); srand_generate(data_ctrmv.a_test, n * lda * 2);
srand_generate(data_ctrmv.x_test, n * incx * 2); srand_generate(data_ctrmv.x_test, n * incx * 2);
@ -76,7 +77,7 @@ static float check_ctrmv(char uplo, char trans, char diag, blasint n, blasint ld
data_ctrmv.x_verify[i] = data_ctrmv.x_test[i]; data_ctrmv.x_verify[i] = data_ctrmv.x_test[i];
if (trans == 'R'){ if (trans == 'R'){
cblas_cimatcopy(CblasColMajor, CblasConjNoTrans, n, n, alpha_conj, data_ctrmv.a_verify, lda, lda); BLASFUNC(cimatcopy)(cc, cr, &n, &n, alpha_conj, data_ctrmv.a_verify, &lda, &lda);
trans_verify = 'N'; trans_verify = 'N';
} }
@ -263,4 +264,4 @@ CTEST(ctrmv, conj_notrans_lower_unit_triangular_incx_2)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif

View File

@ -65,6 +65,7 @@ static float check_ctrsv(char uplo, char trans, char diag, blasint n, blasint ld
blasint i; blasint i;
float alpha_conj[] = {1.0f, 0.0f}; float alpha_conj[] = {1.0f, 0.0f};
char trans_verify = trans; char trans_verify = trans;
char cc[2]="C", cr[2]="R";
srand_generate(data_ctrsv.a_test, n * lda * 2); srand_generate(data_ctrsv.a_test, n * lda * 2);
srand_generate(data_ctrsv.x_test, n * incx * 2); srand_generate(data_ctrsv.x_test, n * incx * 2);
@ -76,8 +77,8 @@ static float check_ctrsv(char uplo, char trans, char diag, blasint n, blasint ld
data_ctrsv.x_verify[i] = data_ctrsv.x_test[i]; data_ctrsv.x_verify[i] = data_ctrsv.x_test[i];
if (trans == 'R'){ if (trans == 'R'){
cblas_cimatcopy(CblasColMajor, CblasConjNoTrans, n, n, BLASFUNC(cimatcopy)(cc, cr, &n, &n,
alpha_conj, data_ctrsv.a_verify, lda, lda); alpha_conj, data_ctrsv.a_verify, &lda, &lda);
trans_verify = 'N'; trans_verify = 'N';
} }
@ -264,4 +265,4 @@ CTEST(ctrsv, conj_notrans_lower_unit_triangular_incx_2)
ASSERT_DBL_NEAR_TOL(0.0f, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, DOUBLE_EPS);
} }
#endif #endif

View File

@ -97,6 +97,7 @@ static double check_daxpby(blasint n, double alpha, blasint incx, double beta, b
return BLASFUNC(dnrm2)(&n, data_daxpby.y_test, &incy_abs); return BLASFUNC(dnrm2)(&n, data_daxpby.y_test, &incy_abs);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Test daxpby by comparing it with dscal and daxpy. * Test daxpby by comparing it with dscal and daxpy.
@ -142,7 +143,7 @@ static double c_api_check_daxpby(blasint n, double alpha, blasint incx, double b
// Find the norm of differences // Find the norm of differences
return cblas_dnrm2(n, data_daxpby.y_test, incy_abs); return cblas_dnrm2(n, data_daxpby.y_test, incy_abs);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
* Test daxpby by comparing it with dscal and daxpy. * Test daxpby by comparing it with dscal and daxpy.
@ -468,6 +469,7 @@ CTEST(daxpby, check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test daxpby by comparing it with dscal and daxpy. * Test daxpby by comparing it with dscal and daxpy.
@ -796,4 +798,5 @@ CTEST(daxpby, c_api_check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -62,10 +62,11 @@ static void dgeadd_trusted(blasint m, blasint n, double alpha, double *aptr,
blasint lda, double beta, double *cptr, blasint ldc) blasint lda, double beta, double *cptr, blasint ldc)
{ {
blasint i; blasint i;
blasint one=1;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
cblas_daxpby(m, alpha, aptr, 1, beta, cptr, 1); BLASFUNC(daxpby)(&m, &alpha, aptr, &one, &beta, cptr, &one);
aptr += lda; aptr += lda;
cptr += ldc; cptr += ldc;
} }
@ -113,9 +114,11 @@ static double check_dgeadd(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(dgeadd)(&m, &n, &alpha, data_dgeadd.a_test, &lda, BLASFUNC(dgeadd)(&m, &n, &alpha, data_dgeadd.a_test, &lda,
&beta, data_dgeadd.c_test, &ldc); &beta, data_dgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_dgeadd(order, m, n, alpha, data_dgeadd.a_test, lda, cblas_dgeadd(order, m, n, alpha, data_dgeadd.a_test, lda,
beta, data_dgeadd.c_test, ldc); beta, data_dgeadd.c_test, ldc);
#endif
// Find the differences between output matrix caculated by dgeadd and sgemm // Find the differences between output matrix caculated by dgeadd and sgemm
return dmatrix_difference(data_dgeadd.c_test, data_dgeadd.c_verify, cols, rows, ldc); return dmatrix_difference(data_dgeadd.c_test, data_dgeadd.c_verify, cols, rows, ldc);
@ -147,9 +150,11 @@ static int check_badargs(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(dgeadd)(&m, &n, &alpha, data_dgeadd.a_test, &lda, BLASFUNC(dgeadd)(&m, &n, &alpha, data_dgeadd.a_test, &lda,
&beta, data_dgeadd.c_test, &ldc); &beta, data_dgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_dgeadd(order, m, n, alpha, data_dgeadd.a_test, lda, cblas_dgeadd(order, m, n, alpha, data_dgeadd.a_test, lda,
beta, data_dgeadd.c_test, ldc); beta, data_dgeadd.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -417,6 +422,7 @@ CTEST(dgeadd, m_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test dgeadd by comparing it against reference * Test dgeadd by comparing it against reference
@ -875,4 +881,5 @@ CTEST(dgeadd, c_api_m_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -73,9 +73,11 @@ static void dgemmt_trusted(char api, enum CBLAS_ORDER order, char uplo, char tra
if(api == 'F') if(api == 'F')
BLASFUNC(dgemm)(&transa, &transb, &m, &m, &k, &alpha, data_dgemmt.a_test, &lda, BLASFUNC(dgemm)(&transa, &transb, &m, &m, &k, &alpha, data_dgemmt.a_test, &lda,
data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_gemm, &ldc); data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_gemm, &ldc);
#ifndef NO_CBLAS
else else
cblas_dgemm(order, transa, transb, m, m, k, alpha, data_dgemmt.a_test, lda, cblas_dgemm(order, transa, transb, m, m, k, alpha, data_dgemmt.a_test, lda,
data_dgemmt.b_test, ldb, beta, data_dgemmt.c_gemm, ldc); data_dgemmt.b_test, ldb, beta, data_dgemmt.c_gemm, ldc);
#endif
if (uplo == 'L' || uplo == CblasLower) if (uplo == 'L' || uplo == CblasLower)
{ {
@ -152,9 +154,11 @@ static double check_dgemmt(char api, enum CBLAS_ORDER order, char uplo, char tra
if (api == 'F') if (api == 'F')
BLASFUNC(dgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_dgemmt.a_test, BLASFUNC(dgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_dgemmt.a_test,
&lda, data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_test, &ldc); &lda, data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_dgemmt(order, uplo, transa, transb, m, k, alpha, data_dgemmt.a_test, lda, cblas_dgemmt(order, uplo, transa, transb, m, k, alpha, data_dgemmt.a_test, lda,
data_dgemmt.b_test, ldb, beta, data_dgemmt.c_test, ldc); data_dgemmt.b_test, ldb, beta, data_dgemmt.c_test, ldc);
#endif
for (i = 0; i < m * ldc; i++) for (i = 0; i < m * ldc; i++)
data_dgemmt.c_verify[i] -= data_dgemmt.c_test[i]; data_dgemmt.c_verify[i] -= data_dgemmt.c_test[i];
@ -189,9 +193,11 @@ static int check_badargs(char api, enum CBLAS_ORDER order, char uplo, char trans
if (api == 'F') if (api == 'F')
BLASFUNC(dgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_dgemmt.a_test, BLASFUNC(dgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_dgemmt.a_test,
&lda, data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_test, &ldc); &lda, data_dgemmt.b_test, &ldb, &beta, data_dgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_dgemmt(order, uplo, transa, transb, m, k, alpha, data_dgemmt.a_test, lda, cblas_dgemmt(order, uplo, transa, transb, m, k, alpha, data_dgemmt.a_test, lda,
data_dgemmt.b_test, ldb, beta, data_dgemmt.c_test, ldc); data_dgemmt.b_test, ldb, beta, data_dgemmt.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -480,6 +486,7 @@ CTEST(dgemmt, lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test dgemmt by comparing it against dgemm * Test dgemmt by comparing it against dgemm
@ -1023,6 +1030,7 @@ CTEST(dgemmt, c_api_rowmajor_lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -1168,6 +1176,7 @@ CTEST(dgemmt, xerbla_ldc_invalid)
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test. * C API specific test.
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -1439,4 +1448,5 @@ CTEST(dgemmt, xerbla_c_api_rowmajor_ldc_invalid)
M, K, lda, ldb, ldc, expected_info); M, K, lda, ldb, ldc, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -93,6 +93,7 @@ static double check_dimatcopy(char api, char order, char trans, blasint rows, bl
BLASFUNC(dimatcopy)(&order, &trans, &rows, &cols, &alpha, data_dimatcopy.a_test, BLASFUNC(dimatcopy)(&order, &trans, &rows, &cols, &alpha, data_dimatcopy.a_test,
&lda_src, &lda_dst); &lda_src, &lda_dst);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -103,6 +104,7 @@ static double check_dimatcopy(char api, char order, char trans, blasint rows, bl
cblas_dimatcopy(corder, ctrans, rows, cols, alpha, data_dimatcopy.a_test, cblas_dimatcopy(corder, ctrans, rows, cols, alpha, data_dimatcopy.a_test,
lda_src, lda_dst); lda_src, lda_dst);
} }
#endif
// Find the differences between output matrix computed by dimatcopy and reference func // Find the differences between output matrix computed by dimatcopy and reference func
return dmatrix_difference(data_dimatcopy.a_test, data_dimatcopy.a_verify, cols_out, rows_out, lda_dst); return dmatrix_difference(data_dimatcopy.a_test, data_dimatcopy.a_verify, cols_out, rows_out, lda_dst);
@ -687,6 +689,7 @@ CTEST(dimatcopy, rowmajor_notrans_col_100_row_50)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test dimatcopy by comparing it against reference * Test dimatcopy by comparing it against reference
@ -778,6 +781,7 @@ CTEST(dimatcopy, c_api_rowmajor_notrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -912,4 +916,4 @@ CTEST(dimatcopy, xerbla_colmajor_trans_invalid_ldb)
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info); int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif

View File

@ -94,6 +94,7 @@ static double check_domatcopy(char api, char order, char trans, blasint rows, bl
BLASFUNC(domatcopy)(&order, &trans, &rows, &cols, &alpha, data_domatcopy.a_test, BLASFUNC(domatcopy)(&order, &trans, &rows, &cols, &alpha, data_domatcopy.a_test,
&lda, data_domatcopy.b_test, &ldb); &lda, data_domatcopy.b_test, &ldb);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -104,6 +105,7 @@ static double check_domatcopy(char api, char order, char trans, blasint rows, bl
cblas_domatcopy(corder, ctrans, rows, cols, alpha, data_domatcopy.a_test, cblas_domatcopy(corder, ctrans, rows, cols, alpha, data_domatcopy.a_test,
lda, data_domatcopy.b_test, ldb); lda, data_domatcopy.b_test, ldb);
} }
#endif
return dmatrix_difference(data_domatcopy.b_test, data_domatcopy.b_verify, b_cols, b_rows, ldb); return dmatrix_difference(data_domatcopy.b_test, data_domatcopy.b_verify, b_cols, b_rows, ldb);
} }
@ -412,6 +414,7 @@ CTEST(domatcopy, rowmajor_notrans_col_100_row_50)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test domatcopy by comparing it against refernce * Test domatcopy by comparing it against refernce
@ -503,6 +506,7 @@ CTEST(domatcopy, c_api_rowmajor_notrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.

View File

@ -224,6 +224,7 @@ CTEST(drotmg, scaled_y_greater_than_scaled_x)
} }
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test drotmg by comparing it against pre-calculated values * Test drotmg by comparing it against pre-calculated values
@ -411,4 +412,5 @@ CTEST(drotmg, c_api_scaled_y_greater_than_scaled_x)
ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], DOUBLE_EPS);
} }
} }
#endif #endif
#endif

View File

@ -221,6 +221,7 @@ CTEST(dsum, step_2_N_50){
ASSERT_DBL_NEAR_TOL(50.0, sum, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(50.0, sum, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test dsum by comparing it against pre-calculated values * Test dsum by comparing it against pre-calculated values
@ -403,3 +404,4 @@ CTEST(dsum, c_api_step_2_N_50){
ASSERT_DBL_NEAR_TOL(50.0, sum, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(50.0, sum, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -221,6 +221,7 @@ CTEST(dzsum, step_2_N_50){
ASSERT_DBL_NEAR_TOL(0.0, sum, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, sum, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test dzsum by comparing it against pre-calculated values * Test dzsum by comparing it against pre-calculated values
@ -403,3 +404,4 @@ CTEST(dzsum, c_api_step_2_N_50){
ASSERT_DBL_NEAR_TOL(0.0, sum, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, sum, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -331,6 +331,7 @@ CTEST(icamin, min_idx_in_vec_tail){
ASSERT_EQUAL(N, index); ASSERT_EQUAL(N, index);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test icamin by comparing it against pre-calculated values * Test icamin by comparing it against pre-calculated values
@ -622,4 +623,5 @@ CTEST(icamin, c_api_min_idx_in_vec_tail){
blasint index = cblas_icamin(N, x, inc); blasint index = cblas_icamin(N, x, inc);
ASSERT_EQUAL(N - 1, index); ASSERT_EQUAL(N - 1, index);
} }
#endif #endif
#endif

View File

@ -413,6 +413,7 @@ CTEST(idamin, min_idx_in_vec_tail_inc_1){
ASSERT_EQUAL(N, index); ASSERT_EQUAL(N, index);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test idamin by comparing it against pre-calculated values * Test idamin by comparing it against pre-calculated values
@ -787,3 +788,4 @@ CTEST(idamin, c_api_min_idx_in_vec_tail_inc_1){
ASSERT_EQUAL(N - 1, index); ASSERT_EQUAL(N - 1, index);
} }
#endif #endif
#endif

View File

@ -412,7 +412,7 @@ CTEST(isamin, min_idx_in_vec_tail_inc_1){
free(x); free(x);
ASSERT_EQUAL(N, index); ASSERT_EQUAL(N, index);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test isamin by comparing it against pre-calculated values * Test isamin by comparing it against pre-calculated values
@ -787,3 +787,4 @@ CTEST(isamin, c_api_min_idx_in_vec_tail_inc_1){
ASSERT_EQUAL(N - 1, index); ASSERT_EQUAL(N - 1, index);
} }
#endif #endif
#endif

View File

@ -331,6 +331,7 @@ CTEST(izamin, min_idx_in_vec_tail){
ASSERT_EQUAL(N, index); ASSERT_EQUAL(N, index);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test izamin by comparing it against pre-calculated values * Test izamin by comparing it against pre-calculated values
@ -623,3 +624,4 @@ CTEST(izamin, c_api_min_idx_in_vec_tail){
ASSERT_EQUAL(N - 1, index); ASSERT_EQUAL(N - 1, index);
} }
#endif #endif
#endif

View File

@ -96,6 +96,7 @@ static float check_saxpby(blasint n, float alpha, blasint incx, float beta, blas
return BLASFUNC(snrm2)(&n, data_saxpby.y_test, &incy_abs); return BLASFUNC(snrm2)(&n, data_saxpby.y_test, &incy_abs);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Test saxpby by comparing it with sscal and saxpy. * Test saxpby by comparing it with sscal and saxpy.
@ -141,6 +142,7 @@ static float c_api_check_saxpby(blasint n, float alpha, blasint incx, float beta
// Find the norm of differences // Find the norm of differences
return cblas_snrm2(n, data_saxpby.y_test, incy_abs); return cblas_snrm2(n, data_saxpby.y_test, incy_abs);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -467,6 +469,7 @@ CTEST(saxpby, check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test saxpby by comparing it with sscal and saxpy. * Test saxpby by comparing it with sscal and saxpy.
@ -791,4 +794,5 @@ CTEST(saxpby, c_api_check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -221,6 +221,7 @@ CTEST(scsum, step_2_N_50){
ASSERT_DBL_NEAR_TOL(0.0f, sum, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, sum, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test scsum by comparing it against pre-calculated values * Test scsum by comparing it against pre-calculated values
@ -403,3 +404,4 @@ CTEST(scsum, c_api_step_2_N_50){
ASSERT_DBL_NEAR_TOL(0.0f, sum, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, sum, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -63,10 +63,10 @@ static void sgeadd_trusted(blasint m, blasint n, float alpha, float *aptr,
blasint lda, float beta, float *cptr, blasint ldc) blasint lda, float beta, float *cptr, blasint ldc)
{ {
blasint i; blasint i;
blasint one=1;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
cblas_saxpby(m, alpha, aptr, 1, beta, cptr, 1); BLASFUNC(saxpby)(&m, &alpha, aptr, &one, &beta, cptr, &one);
aptr += lda; aptr += lda;
cptr += ldc; cptr += ldc;
} }
@ -115,9 +115,11 @@ static float check_sgeadd(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
BLASFUNC(sgeadd) BLASFUNC(sgeadd)
(&m, &n, &alpha, data_sgeadd.a_test, &lda, (&m, &n, &alpha, data_sgeadd.a_test, &lda,
&beta, data_sgeadd.c_test, &ldc); &beta, data_sgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_sgeadd(order, m, n, alpha, data_sgeadd.a_test, lda, cblas_sgeadd(order, m, n, alpha, data_sgeadd.a_test, lda,
beta, data_sgeadd.c_test, ldc); beta, data_sgeadd.c_test, ldc);
#endif
// Find the differences between output matrix caculated by sgeadd and sgemm // Find the differences between output matrix caculated by sgeadd and sgemm
return smatrix_difference(data_sgeadd.c_test, data_sgeadd.c_verify, cols, rows, ldc); return smatrix_difference(data_sgeadd.c_test, data_sgeadd.c_verify, cols, rows, ldc);
@ -150,9 +152,11 @@ static int check_badargs(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
BLASFUNC(sgeadd) BLASFUNC(sgeadd)
(&m, &n, &alpha, data_sgeadd.a_test, &lda, (&m, &n, &alpha, data_sgeadd.a_test, &lda,
&beta, data_sgeadd.c_test, &ldc); &beta, data_sgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_sgeadd(order, m, n, alpha, data_sgeadd.a_test, lda, cblas_sgeadd(order, m, n, alpha, data_sgeadd.a_test, lda,
beta, data_sgeadd.c_test, ldc); beta, data_sgeadd.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -420,6 +424,7 @@ CTEST(sgeadd, m_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test sgeadd by comparing it against reference * Test sgeadd by comparing it against reference
@ -877,4 +882,5 @@ CTEST(sgeadd, c_api_m_zero)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -73,9 +73,11 @@ static void sgemmt_trusted(char api, enum CBLAS_ORDER order, char uplo, char tra
if(api == 'F') if(api == 'F')
BLASFUNC(sgemm)(&transa, &transb, &m, &m, &k, &alpha, data_sgemmt.a_test, &lda, BLASFUNC(sgemm)(&transa, &transb, &m, &m, &k, &alpha, data_sgemmt.a_test, &lda,
data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_gemm, &ldc); data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_gemm, &ldc);
#ifndef NO_CBLAS
else else
cblas_sgemm(order, transa, transb, m, m, k, alpha, data_sgemmt.a_test, lda, cblas_sgemm(order, transa, transb, m, m, k, alpha, data_sgemmt.a_test, lda,
data_sgemmt.b_test, ldb, beta, data_sgemmt.c_gemm, ldc); data_sgemmt.b_test, ldb, beta, data_sgemmt.c_gemm, ldc);
#endif
if (uplo == 'L' || uplo == CblasLower) if (uplo == 'L' || uplo == CblasLower)
{ {
@ -152,9 +154,11 @@ static float check_sgemmt(char api, enum CBLAS_ORDER order, char uplo, char tran
if (api == 'F') if (api == 'F')
BLASFUNC(sgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_sgemmt.a_test, BLASFUNC(sgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_sgemmt.a_test,
&lda, data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_test, &ldc); &lda, data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_sgemmt(order, uplo, transa, transb, m, k, alpha, data_sgemmt.a_test, lda, cblas_sgemmt(order, uplo, transa, transb, m, k, alpha, data_sgemmt.a_test, lda,
data_sgemmt.b_test, ldb, beta, data_sgemmt.c_test, ldc); data_sgemmt.b_test, ldb, beta, data_sgemmt.c_test, ldc);
#endif
for (i = 0; i < m * ldc; i++) for (i = 0; i < m * ldc; i++)
data_sgemmt.c_verify[i] -= data_sgemmt.c_test[i]; data_sgemmt.c_verify[i] -= data_sgemmt.c_test[i];
@ -189,9 +193,11 @@ static int check_badargs(char api, enum CBLAS_ORDER order, char uplo, char trans
if (api == 'F') if (api == 'F')
BLASFUNC(sgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_sgemmt.a_test, BLASFUNC(sgemmt)(&uplo, &transa, &transb, &m, &k, &alpha, data_sgemmt.a_test,
&lda, data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_test, &ldc); &lda, data_sgemmt.b_test, &ldb, &beta, data_sgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_sgemmt(order, uplo, transa, transb, m, k, alpha, data_sgemmt.a_test, lda, cblas_sgemmt(order, uplo, transa, transb, m, k, alpha, data_sgemmt.a_test, lda,
data_sgemmt.b_test, ldb, beta, data_sgemmt.c_test, ldc); data_sgemmt.b_test, ldb, beta, data_sgemmt.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -480,6 +486,7 @@ CTEST(sgemmt, lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test sgemmt by comparing it against sgemm * Test sgemmt by comparing it against sgemm
@ -1023,6 +1030,7 @@ CTEST(sgemmt, c_api_rowmajor_lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -1168,6 +1176,7 @@ CTEST(sgemmt, xerbla_ldc_invalid)
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test. * C API specific test.
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -1439,4 +1448,5 @@ CTEST(sgemmt, xerbla_c_api_rowmajor_ldc_invalid)
M, K, lda, ldb, ldc, expected_info); M, K, lda, ldb, ldc, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -93,6 +93,7 @@ static float check_simatcopy(char api, char order, char trans, blasint rows, bla
BLASFUNC(simatcopy)(&order, &trans, &rows, &cols, &alpha, data_simatcopy.a_test, BLASFUNC(simatcopy)(&order, &trans, &rows, &cols, &alpha, data_simatcopy.a_test,
&lda_src, &lda_dst); &lda_src, &lda_dst);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -103,6 +104,7 @@ static float check_simatcopy(char api, char order, char trans, blasint rows, bla
cblas_simatcopy(corder, ctrans, rows, cols, alpha, data_simatcopy.a_test, cblas_simatcopy(corder, ctrans, rows, cols, alpha, data_simatcopy.a_test,
lda_src, lda_dst); lda_src, lda_dst);
} }
#endif
// Find the differences between output matrix computed by simatcopy and reference func // Find the differences between output matrix computed by simatcopy and reference func
return smatrix_difference(data_simatcopy.a_test, data_simatcopy.a_verify, cols_out, rows_out, lda_dst); return smatrix_difference(data_simatcopy.a_test, data_simatcopy.a_verify, cols_out, rows_out, lda_dst);
@ -687,6 +689,7 @@ CTEST(simatcopy, rowmajor_notrans_col_100_row_50)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test simatcopy by comparing it against reference * Test simatcopy by comparing it against reference
@ -778,6 +781,7 @@ CTEST(simatcopy, c_api_rowmajor_notrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -912,4 +916,4 @@ CTEST(simatcopy, xerbla_colmajor_trans_invalid_ldb)
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info); int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif

View File

@ -94,6 +94,7 @@ static float check_somatcopy(char api, char order, char trans, blasint rows, bla
BLASFUNC(somatcopy)(&order, &trans, &rows, &cols, &alpha, data_somatcopy.a_test, BLASFUNC(somatcopy)(&order, &trans, &rows, &cols, &alpha, data_somatcopy.a_test,
&lda, data_somatcopy.b_test, &ldb); &lda, data_somatcopy.b_test, &ldb);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -104,7 +105,8 @@ static float check_somatcopy(char api, char order, char trans, blasint rows, bla
cblas_somatcopy(corder, ctrans, rows, cols, alpha, data_somatcopy.a_test, cblas_somatcopy(corder, ctrans, rows, cols, alpha, data_somatcopy.a_test,
lda, data_somatcopy.b_test, ldb); lda, data_somatcopy.b_test, ldb);
} }
#endif
return smatrix_difference(data_somatcopy.b_test, data_somatcopy.b_verify, b_cols, b_rows, ldb); return smatrix_difference(data_somatcopy.b_test, data_somatcopy.b_verify, b_cols, b_rows, ldb);
} }
@ -412,6 +414,7 @@ CTEST(somatcopy, rowmajor_notrans_col_100_row_50)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test somatcopy by comparing it against refernce * Test somatcopy by comparing it against refernce
@ -503,6 +506,7 @@ CTEST(somatcopy, c_api_rowmajor_notrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(0.0f, norm, SINGLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.

View File

@ -224,6 +224,7 @@ CTEST(srotmg, scaled_y_greater_than_scaled_x)
} }
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test srotmg by comparing it against pre-calculated values * Test srotmg by comparing it against pre-calculated values
@ -411,4 +412,5 @@ CTEST(srotmg, c_api_scaled_y_greater_than_scaled_x)
ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], SINGLE_EPS); ASSERT_DBL_NEAR_TOL(tr_param[i], te_param[i], SINGLE_EPS);
} }
} }
#endif #endif
#endif

View File

@ -221,6 +221,7 @@ CTEST(ssum, step_2_N_50){
ASSERT_DBL_NEAR_TOL(50.0f, sum, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(50.0f, sum, SINGLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test ssum by comparing it against pre-calculated values * Test ssum by comparing it against pre-calculated values
@ -403,3 +404,4 @@ CTEST(ssum, c_api_step_2_N_50){
ASSERT_DBL_NEAR_TOL(50.0f, sum, SINGLE_EPS); ASSERT_DBL_NEAR_TOL(50.0f, sum, SINGLE_EPS);
} }
#endif #endif
#endif

View File

@ -96,6 +96,7 @@ static double check_zaxpby(blasint n, double *alpha, blasint incx, double *beta,
return BLASFUNC(dznrm2)(&n, data_zaxpby.y_test, &incy_abs); return BLASFUNC(dznrm2)(&n, data_zaxpby.y_test, &incy_abs);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Test zaxpby by comparing it with zscal and zaxpy. * Test zaxpby by comparing it with zscal and zaxpy.
@ -145,6 +146,7 @@ static double c_api_check_zaxpby(blasint n, double *alpha, blasint incx, double
// Find the norm of differences // Find the norm of differences
return cblas_dznrm2(n, data_zaxpby.y_test, incy_abs); return cblas_dznrm2(n, data_zaxpby.y_test, incy_abs);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -387,6 +389,7 @@ CTEST(zaxpby, check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zaxpby by comparing it with zscal and zaxpy. * Test zaxpby by comparing it with zscal and zaxpy.
@ -628,3 +631,4 @@ CTEST(zaxpby, c_api_check_n_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -62,13 +62,14 @@ static void zgeadd_trusted(blasint m, blasint n, double *alpha, double *aptr,
blasint lda, double *beta, double *cptr, blasint ldc) blasint lda, double *beta, double *cptr, blasint ldc)
{ {
blasint i; blasint i;
blasint one=1;
lda *= 2; lda *= 2;
ldc *= 2; ldc *= 2;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
{ {
cblas_zaxpby(m, alpha, aptr, 1, beta, cptr, 1); BLASFUNC(zaxpby)(&m, alpha, aptr, &one, beta, cptr, &one);
aptr += lda; aptr += lda;
cptr += ldc; cptr += ldc;
} }
@ -116,9 +117,11 @@ static double check_zgeadd(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(zgeadd)(&m, &n, alpha, data_zgeadd.a_test, &lda, BLASFUNC(zgeadd)(&m, &n, alpha, data_zgeadd.a_test, &lda,
beta, data_zgeadd.c_test, &ldc); beta, data_zgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_zgeadd(order, m, n, alpha, data_zgeadd.a_test, lda, cblas_zgeadd(order, m, n, alpha, data_zgeadd.a_test, lda,
beta, data_zgeadd.c_test, ldc); beta, data_zgeadd.c_test, ldc);
#endif
// Find the differences between output matrix caculated by zgeadd and sgemm // Find the differences between output matrix caculated by zgeadd and sgemm
return dmatrix_difference(data_zgeadd.c_test, data_zgeadd.c_verify, cols, rows, ldc * 2); return dmatrix_difference(data_zgeadd.c_test, data_zgeadd.c_verify, cols, rows, ldc * 2);
@ -150,9 +153,11 @@ static int check_badargs(char api, OPENBLAS_CONST enum CBLAS_ORDER order,
if (api == 'F') if (api == 'F')
BLASFUNC(zgeadd)(&m, &n, alpha, data_zgeadd.a_test, &lda, BLASFUNC(zgeadd)(&m, &n, alpha, data_zgeadd.a_test, &lda,
beta, data_zgeadd.c_test, &ldc); beta, data_zgeadd.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_zgeadd(order, m, n, alpha, data_zgeadd.a_test, lda, cblas_zgeadd(order, m, n, alpha, data_zgeadd.a_test, lda,
beta, data_zgeadd.c_test, ldc); beta, data_zgeadd.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -420,6 +425,7 @@ CTEST(zgeadd, m_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zgeadd by comparing it against reference * Test zgeadd by comparing it against reference
@ -877,4 +883,5 @@ CTEST(zgeadd, c_api_m_zero)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -73,6 +73,7 @@ static double check_zgemm(char transa, char transb, blasint m, blasint n, blasin
double alpha_conj[] = {1.0, 0.0}; double alpha_conj[] = {1.0, 0.0};
char transa_verify = transa; char transa_verify = transa;
char transb_verify = transb; char transb_verify = transb;
char cc[2]="C", cr[2]="R";
int arows = k, acols = m; int arows = k, acols = m;
int brows = n, bcols = k; int brows = n, bcols = k;
@ -99,12 +100,12 @@ static double check_zgemm(char transa, char transb, blasint m, blasint n, blasin
data_zgemm.c_verify[i] = data_zgemm.c_test[i]; data_zgemm.c_verify[i] = data_zgemm.c_test[i];
if (transa == 'R'){ if (transa == 'R'){
cblas_zimatcopy(CblasColMajor, CblasConjNoTrans, arows, acols, alpha_conj, data_zgemm.a_verify, lda, lda); BLASFUNC(zimatcopy)(cc, cr, &arows, &acols, alpha_conj, data_zgemm.a_verify, &lda, &lda);
transa_verify = 'N'; transa_verify = 'N';
} }
if (transb == 'R'){ if (transb == 'R'){
cblas_zimatcopy(CblasColMajor, CblasConjNoTrans, brows, bcols, alpha_conj, data_zgemm.b_verify, ldb, ldb); BLASFUNC(zimatcopy)(cc, cr, &brows, &bcols, alpha_conj, data_zgemm.b_verify, &ldb, &ldb);
transb_verify = 'N'; transb_verify = 'N';
} }
@ -270,4 +271,4 @@ CTEST(zgemm, transa_conjnotransb)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif

View File

@ -73,9 +73,11 @@ static void zgemmt_trusted(char api, enum CBLAS_ORDER order, char uplo, char tra
if(api == 'F') if(api == 'F')
BLASFUNC(zgemm)(&transa, &transb, &m, &m, &k, alpha, data_zgemmt.a_test, &lda, BLASFUNC(zgemm)(&transa, &transb, &m, &m, &k, alpha, data_zgemmt.a_test, &lda,
data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_gemm, &ldc); data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_gemm, &ldc);
#ifndef NO_CBLAS
else else
cblas_zgemm(order, transa, transb, m, m, k, alpha, data_zgemmt.a_test, lda, cblas_zgemm(order, transa, transb, m, m, k, alpha, data_zgemmt.a_test, lda,
data_zgemmt.b_test, ldb, beta, data_zgemmt.c_gemm, ldc); data_zgemmt.b_test, ldb, beta, data_zgemmt.c_gemm, ldc);
#endif
ldc *= 2; ldc *= 2;
@ -160,9 +162,11 @@ static double check_zgemmt(char api, enum CBLAS_ORDER order, char uplo, char tra
if (api == 'F') if (api == 'F')
BLASFUNC(zgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_zgemmt.a_test, BLASFUNC(zgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_zgemmt.a_test,
&lda, data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_test, &ldc); &lda, data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_zgemmt(order, uplo, transa, transb, m, k, alpha, data_zgemmt.a_test, lda, cblas_zgemmt(order, uplo, transa, transb, m, k, alpha, data_zgemmt.a_test, lda,
data_zgemmt.b_test, ldb, beta, data_zgemmt.c_test, ldc); data_zgemmt.b_test, ldb, beta, data_zgemmt.c_test, ldc);
#endif
for (i = 0; i < m * ldc * 2; i++) for (i = 0; i < m * ldc * 2; i++)
data_zgemmt.c_verify[i] -= data_zgemmt.c_test[i]; data_zgemmt.c_verify[i] -= data_zgemmt.c_test[i];
@ -197,9 +201,11 @@ static int check_badargs(char api, enum CBLAS_ORDER order, char uplo, char trans
if (api == 'F') if (api == 'F')
BLASFUNC(zgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_zgemmt.a_test, BLASFUNC(zgemmt)(&uplo, &transa, &transb, &m, &k, alpha, data_zgemmt.a_test,
&lda, data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_test, &ldc); &lda, data_zgemmt.b_test, &ldb, beta, data_zgemmt.c_test, &ldc);
#ifndef NO_CBLAS
else else
cblas_zgemmt(order, uplo, transa, transb, m, k, alpha, data_zgemmt.a_test, lda, cblas_zgemmt(order, uplo, transa, transb, m, k, alpha, data_zgemmt.a_test, lda,
data_zgemmt.b_test, ldb, beta, data_zgemmt.c_test, ldc); data_zgemmt.b_test, ldb, beta, data_zgemmt.c_test, ldc);
#endif
return check_error(); return check_error();
} }
@ -680,6 +686,7 @@ CTEST(zgemmt, lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zgemmt by comparing it against sgemm * Test zgemmt by comparing it against sgemm
@ -1591,6 +1598,7 @@ CTEST(zgemmt, c_api_rowmajor_lower_beta_one)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Fortran API specific test * Fortran API specific test
@ -1735,7 +1743,7 @@ CTEST(zgemmt, xerbla_ldc_invalid)
M, K, lda, ldb, ldc, expected_info); M, K, lda, ldb, ldc, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test. * C API specific test.
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -2007,4 +2015,5 @@ CTEST(zgemmt, xerbla_c_api_rowmajor_ldc_invalid)
M, K, lda, ldb, ldc, expected_info); M, K, lda, ldb, ldc, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -65,6 +65,7 @@ static struct DATA_ZGEMV_T data_zgemv_t;
static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc_x) static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc_x)
{ {
blasint i; blasint i;
blasint one=1;
double *a_ptr = data_zgemv_t.a_verify; double *a_ptr = data_zgemv_t.a_verify;
double *x_ptr = data_zgemv_t.x_test; double *x_ptr = data_zgemv_t.x_test;
double *x_res = data_zgemv_t.x_verify; double *x_res = data_zgemv_t.x_verify;
@ -73,7 +74,7 @@ static void matrix_vector_product(blasint n, blasint m, blasint lda, blasint inc
for (i = 0; i < n * inc_x; i += inc_x) for (i = 0; i < n * inc_x; i += inc_x)
{ {
result = cblas_zdotu(lda, a_ptr, 1, x_ptr, inc_x); result = BLASFUNC(zdotu)(&lda, a_ptr, &one, x_ptr, &inc_x);
x_res[0] = CREAL(result); x_res[0] = CREAL(result);
x_res[1] = CIMAG(result); x_res[1] = CIMAG(result);
a_ptr += lda * 2; a_ptr += lda * 2;
@ -157,6 +158,7 @@ static double check_zgemv(char api, char order, char trans, blasint m, blasint n
BLASFUNC(zgemv)(&trans, &m, &n, alpha, data_zgemv_t.a_test, &lda, BLASFUNC(zgemv)(&trans, &m, &n, alpha, data_zgemv_t.a_test, &lda,
data_zgemv_t.x_test, &inc_x, beta, data_zgemv_t.y_test, &inc_y); data_zgemv_t.x_test, &inc_x, beta, data_zgemv_t.y_test, &inc_y);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -177,13 +179,14 @@ static double check_zgemv(char api, char order, char trans, blasint m, blasint n
cblas_zgemv(corder, ctrans, m, n, alpha, data_zgemv_t.a_test, cblas_zgemv(corder, ctrans, m, n, alpha, data_zgemv_t.a_test,
lda, data_zgemv_t.x_test, inc_x, beta, data_zgemv_t.y_test, inc_y); lda, data_zgemv_t.x_test, inc_x, beta, data_zgemv_t.y_test, inc_y);
} }
#endif
// Find the differences between output vector caculated by zgemv and reference funcs // Find the differences between output vector caculated by zgemv and reference funcs
for (i = 0; i < m * inc_y * 2; i++) for (i = 0; i < m * inc_y * 2; i++)
data_zgemv_t.y_test[i] -= data_zgemv_t.y_verify[i]; data_zgemv_t.y_test[i] -= data_zgemv_t.y_verify[i];
// Find the norm of differences // Find the norm of differences
return cblas_dznrm2(m, data_zgemv_t.y_test, inc_y); return BLASFUNC(dznrm2)(&m, data_zgemv_t.y_test, &inc_y);
} }
/** /**
@ -217,7 +220,7 @@ static int check_badargs(char order, char trans, blasint m, blasint n,
return check_error(); return check_error();
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Check if error function was called with expected function name * Check if error function was called with expected function name
@ -1134,3 +1137,4 @@ CTEST(zgemv, c_api_xerbla_invalid_order_col_major)
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif
#endif

View File

@ -98,6 +98,7 @@ static double check_zimatcopy(char api, char order, char trans, blasint rows, bl
BLASFUNC(zimatcopy)(&order, &trans, &rows, &cols, alpha, data_zimatcopy.a_test, BLASFUNC(zimatcopy)(&order, &trans, &rows, &cols, alpha, data_zimatcopy.a_test,
&lda_src, &lda_dst); &lda_src, &lda_dst);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -108,6 +109,7 @@ static double check_zimatcopy(char api, char order, char trans, blasint rows, bl
cblas_zimatcopy(corder, ctrans, rows, cols, alpha, data_zimatcopy.a_test, cblas_zimatcopy(corder, ctrans, rows, cols, alpha, data_zimatcopy.a_test,
lda_src, lda_dst); lda_src, lda_dst);
} }
#endif
// Find the differences between output matrix computed by zimatcopy and reference func // Find the differences between output matrix computed by zimatcopy and reference func
return dmatrix_difference(data_zimatcopy.a_test, data_zimatcopy.a_verify, cols_out, rows_out, lda_dst*2); return dmatrix_difference(data_zimatcopy.a_test, data_zimatcopy.a_verify, cols_out, rows_out, lda_dst*2);
@ -502,6 +504,7 @@ CTEST(zimatcopy, rowmajor_conjtrans_col_50_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zimatcopy by comparing it against reference * Test zimatcopy by comparing it against reference
@ -681,6 +684,7 @@ CTEST(zimatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.
@ -815,4 +819,4 @@ CTEST(zimatcopy, xerbla_colmajor_trans_invalid_ldb)
int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info); int passed = check_badargs(order, trans, m, n, lda_src, lda_dst, expected_info);
ASSERT_EQUAL(TRUE, passed); ASSERT_EQUAL(TRUE, passed);
} }
#endif #endif

View File

@ -99,6 +99,7 @@ static double check_zomatcopy(char api, char order, char trans, blasint rows, bl
BLASFUNC(zomatcopy)(&order, &trans, &rows, &cols, alpha, data_zomatcopy.a_test, BLASFUNC(zomatcopy)(&order, &trans, &rows, &cols, alpha, data_zomatcopy.a_test,
&lda, data_zomatcopy.b_test, &ldb); &lda, data_zomatcopy.b_test, &ldb);
} }
#ifndef NO_CBLAS
else { else {
if (order == 'C') corder = CblasColMajor; if (order == 'C') corder = CblasColMajor;
if (order == 'R') corder = CblasRowMajor; if (order == 'R') corder = CblasRowMajor;
@ -109,7 +110,8 @@ static double check_zomatcopy(char api, char order, char trans, blasint rows, bl
cblas_zomatcopy(corder, ctrans, rows, cols, alpha, data_zomatcopy.a_test, cblas_zomatcopy(corder, ctrans, rows, cols, alpha, data_zomatcopy.a_test,
lda, data_zomatcopy.b_test, ldb); lda, data_zomatcopy.b_test, ldb);
} }
#endif
return dmatrix_difference(data_zomatcopy.b_test, data_zomatcopy.b_verify, b_cols, b_rows, ldb*2); return dmatrix_difference(data_zomatcopy.b_test, data_zomatcopy.b_verify, b_cols, b_rows, ldb*2);
} }
@ -325,6 +327,7 @@ CTEST(zomatcopy, rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zomatcopy by comparing it against refernce * Test zomatcopy by comparing it against refernce
@ -508,6 +511,7 @@ CTEST(zomatcopy, c_api_rowmajor_conjtrans_col_100_row_100)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif
/** /**
* Test error function for an invalid param order. * Test error function for an invalid param order.

View File

@ -105,6 +105,7 @@ static double check_zdrot(blasint n, blasint inc_x, blasint inc_y, double *c, do
return (norm / 2); return (norm / 2);
} }
#ifndef NO_CBLAS
/** /**
* C API specific function * C API specific function
* Comapare results computed by zdrot and zaxpby * Comapare results computed by zdrot and zaxpby
@ -787,4 +788,5 @@ CTEST(zrot, c_api_check_n_zero)
double norm = c_api_check_zdrot(n, inc_x, inc_y, c, s); double norm = c_api_check_zdrot(n, inc_x, inc_y, c, s);
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -162,6 +162,7 @@ CTEST(zrotg, negative_real_negative_img)
ASSERT_DBL_NEAR_TOL(-7.01997150991369, sa[1], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(-7.01997150991369, sa[1], DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zrotg by comparing it against pre-calculated values * Test zrotg by comparing it against pre-calculated values
@ -287,4 +288,5 @@ CTEST(zrotg, c_api_negative_real_negative_img)
ASSERT_DBL_NEAR_TOL(-5.26497863243527, sa[0], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(-5.26497863243527, sa[0], DOUBLE_EPS);
ASSERT_DBL_NEAR_TOL(-7.01997150991369, sa[1], DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(-7.01997150991369, sa[1], DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -92,8 +92,10 @@ static double check_zscal(char api, blasint n, double *alpha, blasint inc)
if(api == 'F') if(api == 'F')
BLASFUNC(zscal)(&n, alpha, data_zscal.x_test, &inc); BLASFUNC(zscal)(&n, alpha, data_zscal.x_test, &inc);
#ifndef NO_CBLAS
else else
cblas_zscal(n, alpha, data_zscal.x_test, inc); cblas_zscal(n, alpha, data_zscal.x_test, inc);
#endif
// Find the differences between output vector computed by zscal and zscal_trusted // Find the differences between output vector computed by zscal and zscal_trusted
for (i = 0; i < n * 2 * inc; i++) for (i = 0; i < n * 2 * inc; i++)
@ -133,6 +135,7 @@ CTEST(zscal, alpha_r_zero_alpha_i_zero_inc_2)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#ifndef NO_CBLAS
/** /**
* C API specific test * C API specific test
* Test zscal by comparing it against reference * Test zscal by comparing it against reference
@ -162,4 +165,5 @@ CTEST(zscal, c_api_alpha_r_zero_alpha_i_zero_inc_2)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif
#endif

View File

@ -65,7 +65,7 @@ static double check_ztrmv(char uplo, char trans, char diag, blasint n, blasint l
blasint i; blasint i;
double alpha_conj[] = {1.0, 0.0}; double alpha_conj[] = {1.0, 0.0};
char trans_verify = trans; char trans_verify = trans;
char cc[2]="C", cr[2]="R";
drand_generate(data_ztrmv.a_test, n * lda * 2); drand_generate(data_ztrmv.a_test, n * lda * 2);
drand_generate(data_ztrmv.x_test, n * incx * 2); drand_generate(data_ztrmv.x_test, n * incx * 2);
@ -76,7 +76,7 @@ static double check_ztrmv(char uplo, char trans, char diag, blasint n, blasint l
data_ztrmv.x_verify[i] = data_ztrmv.x_test[i]; data_ztrmv.x_verify[i] = data_ztrmv.x_test[i];
if (trans == 'R'){ if (trans == 'R'){
cblas_zimatcopy(CblasColMajor, CblasConjNoTrans, n, n, alpha_conj, data_ztrmv.a_verify, lda, lda); BLASFUNC(zimatcopy)(cc, cr, &n, &n, alpha_conj, data_ztrmv.a_verify, &lda, &lda);
trans_verify = 'N'; trans_verify = 'N';
} }
@ -263,4 +263,4 @@ CTEST(ztrmv, conj_notrans_lower_unit_triangular_incx_2)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif

View File

@ -65,6 +65,7 @@ static double check_ztrsv(char uplo, char trans, char diag, blasint n, blasint l
blasint i; blasint i;
double alpha_conj[] = {1.0, 0.0}; double alpha_conj[] = {1.0, 0.0};
char trans_verify = trans; char trans_verify = trans;
char cc[2]="C", cr[2]="R";
drand_generate(data_ztrsv.a_test, n * lda * 2); drand_generate(data_ztrsv.a_test, n * lda * 2);
drand_generate(data_ztrsv.x_test, n * incx * 2); drand_generate(data_ztrsv.x_test, n * incx * 2);
@ -76,8 +77,8 @@ static double check_ztrsv(char uplo, char trans, char diag, blasint n, blasint l
data_ztrsv.x_verify[i] = data_ztrsv.x_test[i]; data_ztrsv.x_verify[i] = data_ztrsv.x_test[i];
if (trans == 'R'){ if (trans == 'R'){
cblas_zimatcopy(CblasColMajor, CblasConjNoTrans, n, n, BLASFUNC(zimatcopy)(cc, cr, &n, &n,
alpha_conj, data_ztrsv.a_verify, lda, lda); alpha_conj, data_ztrsv.a_verify, &lda, &lda);
trans_verify = 'N'; trans_verify = 'N';
} }
@ -264,4 +265,4 @@ CTEST(ztrsv, conj_notrans_lower_unit_triangular_incx_2)
ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS); ASSERT_DBL_NEAR_TOL(0.0, norm, DOUBLE_EPS);
} }
#endif #endif