mirror of
https://github.com/amd/blis.git
synced 2026-05-25 02:44:31 +00:00
Gtestsuite: Memory and Extreme Value Tests for GEMV
- Added Memory Access Test support for GEMV. - Added Extreme Value Tests for various combinations of NaN, Inf and -Inf for ?GEMV. - Also fixed some invalid IIT_ERS tests. AMD-Internal: [CPUPL-4825] Change-Id: Iee77b305f6c6b9427153fbbc5191176dae9fbfea
This commit is contained in:
committed by
Arnav Sharma
parent
14bab0eb17
commit
b293a29fb4
371
gtestsuite/testsuite/level2/gemv/cgemv_evt_testing.cpp
Normal file
371
gtestsuite/testsuite/level2/gemv/cgemv_evt_testing.cpp
Normal file
@@ -0,0 +1,371 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
using T = scomplex;
|
||||
using RT = testinghelpers::type_info<T>::real_type;
|
||||
static RT AOCL_NaN = std::numeric_limits<RT>::quiet_NaN();
|
||||
static RT AOCL_Inf = std::numeric_limits<RT>::infinity();
|
||||
|
||||
class cgemvEVT :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
T, // a_exval
|
||||
T, // x_exval
|
||||
T, // y_exval
|
||||
gtint_t>> {}; // lda_inc
|
||||
|
||||
TEST_P(cgemvEVT, NaNInfCheck)
|
||||
{
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
//----------------------------------------------------------
|
||||
// matrix storage format(row major, column major)
|
||||
char storage = std::get<0>(GetParam());
|
||||
// denotes whether matrix a is n,c,t,h
|
||||
char transa = std::get<1>(GetParam());
|
||||
// denotes whether vector x is n,c
|
||||
char conjx = std::get<2>(GetParam());
|
||||
// matrix size m
|
||||
gtint_t m = std::get<3>(GetParam());
|
||||
// matrix size n
|
||||
gtint_t n = std::get<4>(GetParam());
|
||||
// specifies alpha value
|
||||
T alpha = std::get<5>(GetParam());
|
||||
// specifies beta value
|
||||
T beta = std::get<6>(GetParam());
|
||||
// stride size for x:
|
||||
gtint_t incx = std::get<7>(GetParam());
|
||||
// stride size for y:
|
||||
gtint_t incy = std::get<8>(GetParam());
|
||||
// exception value for a:
|
||||
T a_exval = std::get<9>(GetParam());
|
||||
// exception value for x:
|
||||
T x_exval = std::get<10>(GetParam());
|
||||
// exception value for y:
|
||||
T y_exval = std::get<11>(GetParam());
|
||||
// lda increment.
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<12>(GetParam());
|
||||
|
||||
bool is_memory_test = false;
|
||||
bool is_evt_test = true;
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
// functionality from which we estimate operation count per element
|
||||
// of output, and hence the multipler for epsilon.
|
||||
double thresh;
|
||||
if (m == 0 || n == 0)
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>() && (beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>())
|
||||
thresh = testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
if(( transa == 'n' ) || ( transa == 'N' ))
|
||||
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test, is_evt_test, a_exval, x_exval, y_exval );
|
||||
}
|
||||
|
||||
class cgemvEVTPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,T,T,T,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
T a_exval = std::get<9>(str.param);
|
||||
T x_exval = std::get<10>(str.param);
|
||||
T y_exval = std::get<11>(str.param);
|
||||
gtint_t ld_inc = std::get<12>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + "_a_exval_" + testinghelpers::get_value_string(a_exval);
|
||||
str_name = str_name + "_x_exval_" + testinghelpers::get_value_string(x_exval);
|
||||
str_name = str_name + "_y_exval_" + testinghelpers::get_value_string(y_exval);
|
||||
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_unitStride,
|
||||
cgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // alpha
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_nonUnitStride,
|
||||
cgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // alpha
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvEVTPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_unitStride,
|
||||
cgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // alpha
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_nonUnitStride,
|
||||
cgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // alpha
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvEVTPrint()
|
||||
);
|
||||
@@ -35,21 +35,23 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
class cgemvTest :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
scomplex, // alpha
|
||||
scomplex, // beta
|
||||
gtint_t, // stride size for x
|
||||
gtint_t, // stride size for y
|
||||
gtint_t>> {}; // increment to the leading dim of a
|
||||
using T = scomplex;
|
||||
|
||||
TEST_P(cgemvTest, RandomData)
|
||||
class cgemvGeneric :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
gtint_t, // lda_inc
|
||||
bool>> {}; // is_memory_test
|
||||
|
||||
TEST_P(cgemvGeneric, FunctionalTest)
|
||||
{
|
||||
using T = scomplex;
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
@@ -76,6 +78,8 @@ TEST_P(cgemvTest, RandomData)
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<9>(GetParam());
|
||||
// is_memory_test:
|
||||
bool is_memory_test = std::get<10>(GetParam());
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
@@ -98,75 +102,73 @@ TEST_P(cgemvTest, RandomData)
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh );
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test );
|
||||
}
|
||||
|
||||
class cgemvTestPrint {
|
||||
class cgemvGenericPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,scomplex,scomplex,gtint_t,gtint_t,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
scomplex alpha = std::get<5>(str.param);
|
||||
scomplex beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,gtint_t,bool>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
bool is_memory_test = std::get<10>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "cgemv_";
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_cgemv";
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_cgemv";
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "_" + sfm;
|
||||
str_name = str_name + "_" + transa+conjx;
|
||||
str_name = str_name + "_" + std::to_string(m);
|
||||
str_name = str_name + "_" + std::to_string(n);
|
||||
std::string incx_str = ( incx > 0) ? std::to_string(incx) : "m" + std::to_string(std::abs(incx));
|
||||
std::string incy_str = ( incy > 0) ? std::to_string(incy) : "m" + std::to_string(std::abs(incy));
|
||||
str_name = str_name + "_" + incx_str;
|
||||
str_name = str_name + "_" + incy_str;
|
||||
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
|
||||
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
|
||||
std::string beta_str = ( beta.real > 0) ? std::to_string(int(beta.real)) : ("m" + std::to_string(int(std::abs(beta.real))));
|
||||
beta_str = beta_str + "pi" + (( beta.imag > 0) ? std::to_string(int(beta.imag)) : ("m" + std::to_string(int(std::abs(beta.imag)))));
|
||||
str_name = str_name + "_a" + alpha_str;
|
||||
str_name = str_name + "_b" + beta_str;
|
||||
str_name = str_name + "_" + std::to_string(ld_inc);
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + (( is_memory_test ) ? "_mem_test_enabled" : "_mem_test_disabled");
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
|
||||
// Black box testing.
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','c','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values(scomplex{1.0, -2.0}), // alpha
|
||||
::testing::Values(scomplex{-1.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
), // storage format
|
||||
::testing::Values('n','c','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values(T{1.0, -2.0}), // alpha
|
||||
::testing::Values(T{-1.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Tiny_Matixsizes,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -177,18 +179,19 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(1), gtint_t(9), 1), // m
|
||||
::testing::Range(gtint_t(1), gtint_t(9), 1), // n
|
||||
::testing::Values(scomplex{1.0 , 2.0}), // alpha
|
||||
::testing::Values(scomplex{-1.0, -1.0}), // beta
|
||||
::testing::Values(T{1.0 , 2.0}), // alpha
|
||||
::testing::Values(T{-1.0, -1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Average_Matrixsizes,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -199,19 +202,20 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(128), gtint_t(512), 7), // m
|
||||
::testing::Range(gtint_t(512), gtint_t(128), -7), // n
|
||||
::testing::Values(scomplex{-1.0, -2.0}), // alpha
|
||||
::testing::Values(scomplex{-2.0, 1.0}), // beta
|
||||
::testing::Values(T{-1.0, -2.0}), // alpha
|
||||
::testing::Values(T{-2.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(1)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Large_Matrixsizes,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -222,19 +226,20 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(1024), gtint_t(32767), 1023), // m
|
||||
::testing::Range(gtint_t(1024), gtint_t(32767), 1023), // n
|
||||
::testing::Values(scomplex{1.0, 1.0}), // alpha
|
||||
::testing::Values(scomplex{1.0, 1.0}), // beta
|
||||
::testing::Values(T{1.0, 1.0}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(2)), // stride size for x
|
||||
::testing::Values(gtint_t(2)), // stride size for y
|
||||
::testing::Values(gtint_t(4)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(4)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
|
||||
::cgemvTestPrint()
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Large_Scalar_Stride,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -245,19 +250,20 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(50), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(50), 10), // n
|
||||
::testing::Values(scomplex{3.0, -3.0}), // alpha
|
||||
::testing::Values(scomplex{-3.0, 4.0}), // beta
|
||||
::testing::Values(T{3.0, -3.0}), // alpha
|
||||
::testing::Values(T{-3.0, 4.0}), // beta
|
||||
::testing::Values(gtint_t(10)), // stride size for x
|
||||
::testing::Values(gtint_t(10)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::testing::Values(gtint_t(1)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Nonunit_Incx,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -268,18 +274,19 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(50), 10), // m
|
||||
::testing::Range(gtint_t(0), gtint_t(0), 0), // n
|
||||
::testing::Values(scomplex{-1.0, -2.0}), // alpha
|
||||
::testing::Values(scomplex{1.0, 2.0}), // beta
|
||||
::testing::Values(T{-1.0, -2.0}), // alpha
|
||||
::testing::Values(T{1.0, 2.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(5)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::testing::Values(gtint_t(5)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Unit_MN,
|
||||
cgemvTest,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -290,18 +297,19 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(1)), // m
|
||||
::testing::Values(gtint_t(1)), // n
|
||||
::testing::Values(scomplex{-1.0, -2.0}, scomplex{2.0, -1.0}), // alpha
|
||||
::testing::Values(scomplex{1.0, 2.0}), // beta
|
||||
::testing::Values(T{-1.0, -2.0}, T{2.0, -1.0}), // alpha
|
||||
::testing::Values(T{1.0, 2.0}), // beta
|
||||
::testing::Values(gtint_t(7)), // stride size for x
|
||||
::testing::Values(gtint_t(13)), // stride size for y
|
||||
::testing::Values(gtint_t(57), gtint_t(119)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::testing::Values(gtint_t(57), gtint_t(119)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_More_Scalar,
|
||||
cgemvTest,
|
||||
More_Scalar,
|
||||
cgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -312,12 +320,13 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(1)), // m
|
||||
::testing::Values(gtint_t(1)), // n
|
||||
::testing::Values(scomplex{-1.0, -2.0}), // alpha
|
||||
::testing::Values(scomplex{1.0, 2.0}, scomplex{-2.0, 1.0},
|
||||
scomplex{-3.0, 2.0}, scomplex{-1.0, -2.0}), // beta
|
||||
::testing::Values(T{-1.0, -2.0}), // alpha
|
||||
::testing::Values(T{1.0, 2.0}, T{-2.0, 1.0},
|
||||
T{-3.0, 2.0}, T{-1.0, -2.0}), // beta
|
||||
::testing::Values(gtint_t(7)), // stride size for x
|
||||
::testing::Values(gtint_t(13)), // stride size for y
|
||||
::testing::Values(gtint_t(0), gtint_t(190)) // increment to the leading dim of a
|
||||
),
|
||||
::cgemvTestPrint()
|
||||
::testing::Values(gtint_t(0), gtint_t(190)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::cgemvGenericPrint()
|
||||
);
|
||||
|
||||
283
gtestsuite/testsuite/level2/gemv/dgemv_evt_testing.cpp
Normal file
283
gtestsuite/testsuite/level2/gemv/dgemv_evt_testing.cpp
Normal file
@@ -0,0 +1,283 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
using T = double;
|
||||
static T AOCL_NaN = std::numeric_limits<T>::quiet_NaN();
|
||||
static T AOCL_Inf = std::numeric_limits<T>::infinity();
|
||||
|
||||
class dgemvEVT :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
T, // a_exval
|
||||
T, // x_exval
|
||||
T, // y_exval
|
||||
gtint_t>> {}; // lda_inc
|
||||
|
||||
TEST_P(dgemvEVT, NaNInfCheck)
|
||||
{
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
//----------------------------------------------------------
|
||||
// matrix storage format(row major, column major)
|
||||
char storage = std::get<0>(GetParam());
|
||||
// denotes whether matrix a is n,c,t,h
|
||||
char transa = std::get<1>(GetParam());
|
||||
// denotes whether vector x is n,c
|
||||
char conjx = std::get<2>(GetParam());
|
||||
// matrix size m
|
||||
gtint_t m = std::get<3>(GetParam());
|
||||
// matrix size n
|
||||
gtint_t n = std::get<4>(GetParam());
|
||||
// specifies alpha value
|
||||
T alpha = std::get<5>(GetParam());
|
||||
// specifies beta value
|
||||
T beta = std::get<6>(GetParam());
|
||||
// stride size for x:
|
||||
gtint_t incx = std::get<7>(GetParam());
|
||||
// stride size for y:
|
||||
gtint_t incy = std::get<8>(GetParam());
|
||||
// exception value for a:
|
||||
T a_exval = std::get<9>(GetParam());
|
||||
// exception value for x:
|
||||
T x_exval = std::get<10>(GetParam());
|
||||
// exception value for y:
|
||||
T y_exval = std::get<11>(GetParam());
|
||||
// lda increment.
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<12>(GetParam());
|
||||
|
||||
bool is_memory_test = false;
|
||||
bool is_evt_test = true;
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
// functionality from which we estimate operation count per element
|
||||
// of output, and hence the multipler for epsilon.
|
||||
double thresh;
|
||||
if (m == 0 || n == 0)
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>() && (beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>())
|
||||
thresh = testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
if(( transa == 'n' ) || ( transa == 'N' ))
|
||||
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test, is_evt_test, a_exval, x_exval, y_exval );
|
||||
}
|
||||
|
||||
class dgemvEVTPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,T,T,T,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
T a_exval = std::get<9>(str.param);
|
||||
T x_exval = std::get<10>(str.param);
|
||||
T y_exval = std::get<11>(str.param);
|
||||
gtint_t ld_inc = std::get<12>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + "_a_exval_" + testinghelpers::get_value_string(a_exval);
|
||||
str_name = str_name + "_x_exval_" + testinghelpers::get_value_string(x_exval);
|
||||
str_name = str_name + "_y_exval_" + testinghelpers::get_value_string(y_exval);
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_unitStride,
|
||||
dgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // alpha
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // a_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // x_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::dgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_nonUnitStride,
|
||||
dgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // alpha
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // a_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // x_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::dgemvEVTPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_unitStride,
|
||||
dgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // alpha
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(0), // a_exval
|
||||
::testing::Values(0), // x_exval
|
||||
::testing::Values(0), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::dgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_nonUnitStride,
|
||||
dgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // alpha
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(0), // a_exval
|
||||
::testing::Values(0), // x_exval
|
||||
::testing::Values(0), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::dgemvEVTPrint()
|
||||
);
|
||||
@@ -35,21 +35,23 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
class dgemvTest :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
double, // alpha
|
||||
double, // beta
|
||||
gtint_t, // stride size for x
|
||||
gtint_t, // stride size for y
|
||||
gtint_t>> {}; // increment to the leading dim of a
|
||||
using T = double;
|
||||
|
||||
TEST_P(dgemvTest, RandomData)
|
||||
class dgemvGeneric :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
gtint_t, // lda_inc
|
||||
bool>> {}; // is_memory_test
|
||||
|
||||
TEST_P(dgemvGeneric, FunctionalTest)
|
||||
{
|
||||
using T = double;
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
@@ -76,6 +78,8 @@ TEST_P(dgemvTest, RandomData)
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<9>(GetParam());
|
||||
// is_memory_test:
|
||||
bool is_memory_test = std::get<10>(GetParam());
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
@@ -97,43 +101,43 @@ TEST_P(dgemvTest, RandomData)
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh );
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test );
|
||||
}
|
||||
|
||||
class dgemvTestPrint {
|
||||
class dgemvGenericPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,double,double,gtint_t,gtint_t,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
double alpha = std::get<5>(str.param);
|
||||
double beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,gtint_t, bool>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
bool is_memory_test = std::get<10>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "dgemv_";
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_dgemv";
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_dgemv";
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "_" + sfm;
|
||||
str_name = str_name + "_" + transa+conjx;
|
||||
str_name = str_name + "_" + std::to_string(m);
|
||||
str_name = str_name + "_" + std::to_string(n);
|
||||
std::string incx_str = ( incx > 0) ? std::to_string(incx) : "m" + std::to_string(std::abs(incx));
|
||||
std::string incy_str = ( incy > 0) ? std::to_string(incy) : "m" + std::to_string(std::abs(incy));
|
||||
str_name = str_name + "_" + incx_str;
|
||||
str_name = str_name + "_" + incy_str;
|
||||
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
|
||||
std::string beta_str = ( beta > 0) ? std::to_string(int(beta)) : "m" + std::to_string(int(std::abs(beta)));
|
||||
str_name = str_name + "_a" + alpha_str;
|
||||
str_name = str_name + "_b" + beta_str;
|
||||
str_name = str_name + "_" + std::to_string(ld_inc);
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + (( is_memory_test ) ? "_mem_test_enabled" : "_mem_test_disabled");
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
@@ -141,29 +145,30 @@ public:
|
||||
// Black box testing.
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox,
|
||||
dgemvTest,
|
||||
dgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values( 1.0 ), // alpha
|
||||
::testing::Values(-1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values( 1.0 ), // alpha
|
||||
::testing::Values(-1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::dgemvTestPrint()
|
||||
::dgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Tiny_Matrixsizes,
|
||||
dgemvTest,
|
||||
dgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -178,14 +183,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values( -1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(7), gtint_t(3)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(7), gtint_t(3)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::dgemvTestPrint()
|
||||
::dgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Average_Matrixsizes,
|
||||
dgemvTest,
|
||||
dgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -200,14 +206,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(-1.0, -3.1 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(2)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(2)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::dgemvTestPrint()
|
||||
::dgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Large_Matrixsizes,
|
||||
dgemvTest,
|
||||
dgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -222,15 +229,16 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(1.0), // beta
|
||||
::testing::Values(gtint_t(11), gtint_t(119), gtint_t(211)), // stride size for x
|
||||
::testing::Values(gtint_t(211), gtint_t(119), gtint_t(11)), // stride size for y
|
||||
::testing::Values(gtint_t(1), gtint_t(252)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(1), gtint_t(252)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
|
||||
::dgemvTestPrint()
|
||||
::dgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Unit_MN,
|
||||
dgemvTest,
|
||||
dgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -245,7 +253,8 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(1.0, -1.2), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
),
|
||||
::dgemvTestPrint()
|
||||
::testing::Values(gtint_t(1)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::dgemvGenericPrint()
|
||||
);
|
||||
|
||||
@@ -59,280 +59,213 @@ TYPED_TEST(gemv_IIT_ERS_Test, n_eq_zero_Unitalphabeta)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t invalid_n = 0;
|
||||
gtint_t m = 3;
|
||||
gtint_t incx = 1;
|
||||
gtint_t incy = 1;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, m, invalid_n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, M, invalid_n, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, ZeroBeta_Unitalpha)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t n = 4;
|
||||
gtint_t m = 3;
|
||||
gtint_t incx = 1;
|
||||
gtint_t incy = 1;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initzero<T>( beta );
|
||||
testinghelpers::initzero<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, m, n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, M, N, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, m_eq_zero_Unitbeta)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t invalid_m = 0;
|
||||
gtint_t n = 1;
|
||||
gtint_t incx = 2;
|
||||
gtint_t incy = 3;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initzero<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
testinghelpers::initzero<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, invalid_m, n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, invalid_m, N, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, m_lt_zero_Unitscalar)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t invalid_m = -1;
|
||||
gtint_t n = 5;
|
||||
gtint_t incx = 3;
|
||||
gtint_t incy = 3;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, invalid_m, n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, invalid_m, N, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, n_lt_zero_Unitscalar)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t invalid_n = -1;
|
||||
gtint_t m = 1;
|
||||
gtint_t incx = 3;
|
||||
gtint_t incy = 3;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
// Create a copy of y so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, m, invalid_n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, M, invalid_n, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, Zero_scalar)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t n = 2;
|
||||
gtint_t m = 2;
|
||||
gtint_t incx = 3;
|
||||
gtint_t incy = 3;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initzero<T>( alpha );
|
||||
testinghelpers::initzero<T>( beta );
|
||||
testinghelpers::initzero<T>( alpha );
|
||||
testinghelpers::initzero<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 0, 1, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 0, 1, N, incy );
|
||||
|
||||
// Create a zero vector, since the output for alpha = beta = 0 should be a
|
||||
// zero vector.
|
||||
std::vector<T> zero_vec = testinghelpers::get_random_vector<T>( 0, 0, N, incy );;
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, m, n, &alpha, nullptr, LDA,
|
||||
gemv<T>( STORAGE, TRANS, CONJ, M, N, &alpha, nullptr, LDA,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
computediff<T>( N, y.data(), zero_vec.data(), incy);
|
||||
}
|
||||
|
||||
TYPED_TEST(gemv_IIT_ERS_Test, invalid_inc)
|
||||
{
|
||||
using T = TypeParam;
|
||||
gtint_t n = 2;
|
||||
gtint_t m = 2;
|
||||
gtint_t incx = -1;
|
||||
gtint_t incy = -1;
|
||||
|
||||
|
||||
// Get correct vector lengths.
|
||||
// gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
// gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
|
||||
T alpha, beta;
|
||||
testinghelpers::initone<T>( alpha );
|
||||
testinghelpers::initone<T>( beta );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
// std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, LDA );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 5, M, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 5, N, incy );
|
||||
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( STORAGE, TRANS, CONJ, m, n, &alpha, nullptr, LDA ,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( N, y.data(), y_ref.data(), incy);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
284
gtestsuite/testsuite/level2/gemv/sgemv_evt_testing.cpp
Normal file
284
gtestsuite/testsuite/level2/gemv/sgemv_evt_testing.cpp
Normal file
@@ -0,0 +1,284 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
using T = float;
|
||||
static T AOCL_NaN = std::numeric_limits<T>::quiet_NaN();
|
||||
static T AOCL_Inf = std::numeric_limits<T>::infinity();
|
||||
|
||||
class sgemvEVT :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
T, // a_exval
|
||||
T, // x_exval
|
||||
T, // y_exval
|
||||
gtint_t>> {}; // lda_inc
|
||||
|
||||
TEST_P(sgemvEVT, NaNInfCheck)
|
||||
{
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
//----------------------------------------------------------
|
||||
// matrix storage format(row major, column major)
|
||||
char storage = std::get<0>(GetParam());
|
||||
// denotes whether matrix a is n,c,t,h
|
||||
char transa = std::get<1>(GetParam());
|
||||
// denotes whether vector x is n,c
|
||||
char conjx = std::get<2>(GetParam());
|
||||
// matrix size m
|
||||
gtint_t m = std::get<3>(GetParam());
|
||||
// matrix size n
|
||||
gtint_t n = std::get<4>(GetParam());
|
||||
// specifies alpha value
|
||||
T alpha = std::get<5>(GetParam());
|
||||
// specifies beta value
|
||||
T beta = std::get<6>(GetParam());
|
||||
// stride size for x:
|
||||
gtint_t incx = std::get<7>(GetParam());
|
||||
// stride size for y:
|
||||
gtint_t incy = std::get<8>(GetParam());
|
||||
// exception value for a:
|
||||
T a_exval = std::get<9>(GetParam());
|
||||
// exception value for x:
|
||||
T x_exval = std::get<10>(GetParam());
|
||||
// exception value for y:
|
||||
T y_exval = std::get<11>(GetParam());
|
||||
// lda increment.
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<12>(GetParam());
|
||||
|
||||
bool is_memory_test = false;
|
||||
bool is_evt_test = true;
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
// functionality from which we estimate operation count per element
|
||||
// of output, and hence the multipler for epsilon.
|
||||
double thresh;
|
||||
if (m == 0 || n == 0)
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>() && (beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>())
|
||||
thresh = testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
if(( transa == 'n' ) || ( transa == 'N' ))
|
||||
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test, is_evt_test, a_exval, x_exval, y_exval );
|
||||
}
|
||||
|
||||
class sgemvEVTPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,T,T,T,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
T a_exval = std::get<9>(str.param);
|
||||
T x_exval = std::get<10>(str.param);
|
||||
T y_exval = std::get<11>(str.param);
|
||||
gtint_t ld_inc = std::get<12>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + "_a_exval_" + testinghelpers::get_value_string(a_exval);
|
||||
str_name = str_name + "_x_exval_" + testinghelpers::get_value_string(x_exval);
|
||||
str_name = str_name + "_y_exval_" + testinghelpers::get_value_string(y_exval);
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_unitStride,
|
||||
sgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // alpha
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // a_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // x_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::sgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_nonUnitStride,
|
||||
sgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // alpha
|
||||
::testing::Values(-1.0, 0.0, 1.0, 2.3), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // a_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // x_exval
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf, 0), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::sgemvEVTPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_unitStride,
|
||||
sgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // alpha
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(0), // a_exval
|
||||
::testing::Values(0), // x_exval
|
||||
::testing::Values(0), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::sgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_nonUnitStride,
|
||||
sgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // alpha
|
||||
::testing::Values(AOCL_NaN, AOCL_Inf, -AOCL_Inf), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(0), // a_exval
|
||||
::testing::Values(0), // x_exval
|
||||
::testing::Values(0), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::sgemvEVTPrint()
|
||||
);
|
||||
@@ -35,21 +35,22 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
class sgemvTest :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
float, // alpha
|
||||
float, // beta
|
||||
gtint_t, // stride size for x
|
||||
gtint_t, // stride size for y
|
||||
gtint_t>> {}; // increment to the leading dim of a
|
||||
using T = float;
|
||||
class sgemvGeneric :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
gtint_t, // lda_inc
|
||||
bool>> {}; // is_memory_test
|
||||
|
||||
TEST_P(sgemvTest, RandomData)
|
||||
TEST_P(sgemvGeneric, FunctionalTest)
|
||||
{
|
||||
using T = float;
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
@@ -76,6 +77,8 @@ TEST_P(sgemvTest, RandomData)
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<9>(GetParam());
|
||||
// is_memory_test:
|
||||
bool is_memory_test = std::get<10>(GetParam());
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
@@ -97,23 +100,24 @@ TEST_P(sgemvTest, RandomData)
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh );
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test );
|
||||
}
|
||||
|
||||
class sgemvTestPrint {
|
||||
class sgemvGenericPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,float,float,gtint_t,gtint_t,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
float alpha = std::get<5>(str.param);
|
||||
float beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,gtint_t,bool>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
bool is_memory_test = std::get<10>(str.param);
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "sgemv_";
|
||||
#elif TEST_CBLAS
|
||||
@@ -121,19 +125,17 @@ public:
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_sgemv";
|
||||
#endif
|
||||
str_name = str_name + "_" + sfm;
|
||||
str_name = str_name + "_" + transa+conjx;
|
||||
str_name = str_name + "_" + std::to_string(m);
|
||||
str_name = str_name + "_" + std::to_string(n);
|
||||
std::string incx_str = ( incx > 0) ? std::to_string(incx) : "m" + std::to_string(std::abs(incx));
|
||||
std::string incy_str = ( incy > 0) ? std::to_string(incy) : "m" + std::to_string(std::abs(incy));
|
||||
str_name = str_name + "_" + incx_str;
|
||||
str_name = str_name + "_" + incy_str;
|
||||
std::string alpha_str = ( alpha > 0) ? std::to_string(int(alpha)) : "m" + std::to_string(int(std::abs(alpha)));
|
||||
std::string beta_str = ( beta > 0) ? std::to_string(int(beta)) : "m" + std::to_string(int(std::abs(beta)));
|
||||
str_name = str_name + "_a" + alpha_str;
|
||||
str_name = str_name + "_b" + beta_str;
|
||||
str_name = str_name + "_" + std::to_string(ld_inc);
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + (( is_memory_test ) ? "_mem_test_enabled" : "_mem_test_disabled");
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
@@ -141,29 +143,30 @@ public:
|
||||
// Black box testing.
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox,
|
||||
sgemvTest,
|
||||
sgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values( 1.0 ), // alpha
|
||||
::testing::Values(-1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values( 1.0 ), // alpha
|
||||
::testing::Values(-1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::sgemvTestPrint()
|
||||
::sgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Tiny_Matrixsizes,
|
||||
sgemvTest,
|
||||
sgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -178,14 +181,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(-1.0 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(7), gtint_t(3)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(7), gtint_t(3)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::sgemvTestPrint()
|
||||
::sgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Average_Matrixsizes,
|
||||
sgemvTest,
|
||||
sgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -200,14 +204,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(-1.0, -3.1 ), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(1)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::sgemvTestPrint()
|
||||
::sgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Large_Matrixsizes,
|
||||
sgemvTest,
|
||||
sgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -222,14 +227,15 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values(1.0), // beta
|
||||
::testing::Values(gtint_t(11), gtint_t(119), gtint_t(211)), // stride size for x
|
||||
::testing::Values(gtint_t(211), gtint_t(119), gtint_t(11)), // stride size for y
|
||||
::testing::Values(gtint_t(1), gtint_t(252)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(1), gtint_t(252)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::sgemvTestPrint()
|
||||
::sgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Unit_MN,
|
||||
sgemvTest,
|
||||
sgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -238,13 +244,14 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
), // storage format
|
||||
::testing::Values('n','c','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(1)), // m
|
||||
::testing::Values(gtint_t(1)), // n
|
||||
::testing::Values(gtint_t(1)), // m
|
||||
::testing::Values(gtint_t(1)), // n
|
||||
::testing::Values(1.0, 2.0), // alpha
|
||||
::testing::Values(1.0, -1.1), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)) // zero increment to the leading dim of a
|
||||
),
|
||||
::sgemvTestPrint()
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::sgemvGenericPrint()
|
||||
);
|
||||
|
||||
@@ -37,44 +37,103 @@
|
||||
#include "gemv.h"
|
||||
#include "level2/ref_gemv.h"
|
||||
#include "inc/check_error.h"
|
||||
#include "common/testing_helpers.h"
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
template<typename T>
|
||||
|
||||
void test_gemv( char storage, char trnsa, char conjx, gtint_t m, gtint_t n,
|
||||
T alpha, gtint_t lda_inc, gtint_t incx, T beta, gtint_t incy, double thresh )
|
||||
void test_gemv( char storage, char transa, char conjx, gtint_t m, gtint_t n,
|
||||
T alpha, gtint_t lda_inc, gtint_t incx, T beta, gtint_t incy,
|
||||
double thresh, bool is_memory_test = false,
|
||||
bool is_evt_test = false, T a_exval = T{0}, T x_exval = T{0},
|
||||
T y_exval = T{0} )
|
||||
{
|
||||
// Compute the leading dimensions for matrix size calculation.
|
||||
gtint_t lda = testinghelpers::get_leading_dimension( storage, 'n', m, n, lda_inc );
|
||||
|
||||
dim_t size_a = testinghelpers::matsize( storage, 'n', m, n, lda ) * sizeof(T);
|
||||
testinghelpers::ProtectedBuffer a_buf(size_a, false, is_memory_test);
|
||||
testinghelpers::datagenerators::randomgenerators<T>( 1, 5, storage, m, n, (T*)(a_buf.greenzone_1), 'n', lda );
|
||||
|
||||
// Get correct vector lengths.
|
||||
gtint_t lenx = ( testinghelpers::chknotrans( trnsa ) ) ? n : m ;
|
||||
gtint_t leny = ( testinghelpers::chknotrans( trnsa ) ) ? m : n ;
|
||||
gtint_t lenx = ( testinghelpers::chknotrans( transa ) ) ? n : m ;
|
||||
gtint_t leny = ( testinghelpers::chknotrans( transa ) ) ? m : n ;
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Initialize matrics with random integer numbers.
|
||||
//----------------------------------------------------------
|
||||
std::vector<T> a = testinghelpers::get_random_matrix<T>( 1, 5, storage, 'n', m, n, lda );
|
||||
std::vector<T> x = testinghelpers::get_random_vector<T>( 1, 3, lenx, incx );
|
||||
std::vector<T> y = testinghelpers::get_random_vector<T>( 1, 3, leny, incy );
|
||||
dim_t size_x = testinghelpers::buff_dim(lenx, incx) * sizeof(T);
|
||||
dim_t size_y = testinghelpers::buff_dim(leny, incy) * sizeof(T);
|
||||
testinghelpers::ProtectedBuffer x_buf(size_x, false, is_memory_test);
|
||||
testinghelpers::ProtectedBuffer y_buf(size_y, false, is_memory_test);
|
||||
|
||||
// For y_ref, we don't need different greenzones and any redzone.
|
||||
// Thus, we pass is_memory_test as false
|
||||
testinghelpers::ProtectedBuffer y_ref_buffer( size_y, false, false );
|
||||
|
||||
testinghelpers::datagenerators::randomgenerators<T>( 1, 3, lenx, incx, (T*)(x_buf.greenzone_1) );
|
||||
testinghelpers::datagenerators::randomgenerators<T>( 1, 3, leny, incy, (T*)(y_buf.greenzone_1) );
|
||||
|
||||
T* a = (T*)(a_buf.greenzone_1);
|
||||
T* x = (T*)(x_buf.greenzone_1);
|
||||
T* y = (T*)(y_buf.greenzone_1);
|
||||
T* y_ref = ( T* )y_ref_buffer.greenzone_1; // For y_ref, there is no greenzone_2
|
||||
|
||||
// Copying the contents of y to y_ref
|
||||
memcpy( y_ref, y, size_y );
|
||||
|
||||
if ( is_evt_test )
|
||||
{
|
||||
// Add extreme value to A matrix
|
||||
dim_t ai = rand() % m;
|
||||
dim_t aj = rand() % n;
|
||||
testinghelpers::set_ev_mat( storage, 'n', lda, ai, aj, a_exval, a );
|
||||
|
||||
// Add extreme value to x vector
|
||||
x[ (rand() % lenx) * std::abs(incx) ] = x_exval;
|
||||
|
||||
// Add extreme value to y vector
|
||||
y[ (rand() % leny) * std::abs(incy) ] = y_exval;
|
||||
}
|
||||
|
||||
// Create a copy of c so that we can check reference results.
|
||||
std::vector<T> y_ref(y);
|
||||
//----------------------------------------------------------
|
||||
// Call BLIS function
|
||||
//----------------------------------------------------------
|
||||
gemv<T>( storage, trnsa, conjx, m, n, &alpha, a.data(), lda,
|
||||
x.data(), incx, &beta, y.data(), incy );
|
||||
testinghelpers::ProtectedBuffer::start_signal_handler();
|
||||
try
|
||||
{
|
||||
gemv<T>( storage, transa, conjx, m, n, &alpha, a, lda, x, incx, &beta,
|
||||
y, incy );
|
||||
|
||||
if ( is_memory_test )
|
||||
{
|
||||
memcpy((a_buf.greenzone_2), (a_buf.greenzone_1), size_a);
|
||||
memcpy((x_buf.greenzone_2), (x_buf.greenzone_1), size_x);
|
||||
memcpy((y_buf.greenzone_2), y_ref, size_y);
|
||||
|
||||
gemv<T>( storage, transa, conjx, m, n, &alpha,
|
||||
(T*)(a_buf.greenzone_2), lda,
|
||||
(T*)(x_buf.greenzone_2), incx,
|
||||
&beta,
|
||||
(T*)(y_buf.greenzone_2), incy );
|
||||
}
|
||||
}
|
||||
catch(const std::exception& e)
|
||||
{
|
||||
// reset to default signal handler
|
||||
testinghelpers::ProtectedBuffer::stop_signal_handler();
|
||||
|
||||
// show failure in case seg fault was detected
|
||||
FAIL() << "Memory Test Failed";
|
||||
}
|
||||
// reset to default signal handler
|
||||
testinghelpers::ProtectedBuffer::stop_signal_handler();
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call reference implementation.
|
||||
//----------------------------------------------------------
|
||||
testinghelpers::ref_gemv<T>( storage, trnsa, conjx, m, n, alpha, a.data(),
|
||||
lda, x.data(), incx, beta, y_ref.data(), incy );
|
||||
|
||||
testinghelpers::ref_gemv<T>( storage, transa, conjx, m, n, alpha, a,
|
||||
lda, x, incx, beta, y_ref, incy );
|
||||
|
||||
//----------------------------------------------------------
|
||||
// check component-wise error.
|
||||
//----------------------------------------------------------
|
||||
computediff<T>( leny, y.data(), y_ref.data(), incy, thresh );
|
||||
computediff<T>( leny, y, y_ref, incy, thresh, is_evt_test );
|
||||
}
|
||||
|
||||
371
gtestsuite/testsuite/level2/gemv/zgemv_evt_testing.cpp
Normal file
371
gtestsuite/testsuite/level2/gemv/zgemv_evt_testing.cpp
Normal file
@@ -0,0 +1,371 @@
|
||||
/*
|
||||
|
||||
BLIS
|
||||
An object-based framework for developing high-performance BLAS-like
|
||||
libraries.
|
||||
|
||||
Copyright (C) 2024, Advanced Micro Devices, Inc. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
- Neither the name(s) of the copyright holder(s) nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
using T = dcomplex;
|
||||
using RT = testinghelpers::type_info<T>::real_type;
|
||||
static RT AOCL_NaN = std::numeric_limits<RT>::quiet_NaN();
|
||||
static RT AOCL_Inf = std::numeric_limits<RT>::infinity();
|
||||
|
||||
class zgemvEVT :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
T, // a_exval
|
||||
T, // x_exval
|
||||
T, // y_exval
|
||||
gtint_t>> {}; // lda_inc
|
||||
|
||||
TEST_P(zgemvEVT, NaNInfCheck)
|
||||
{
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
//----------------------------------------------------------
|
||||
// matrix storage format(row major, column major)
|
||||
char storage = std::get<0>(GetParam());
|
||||
// denotes whether matrix a is n,c,t,h
|
||||
char transa = std::get<1>(GetParam());
|
||||
// denotes whether vector x is n,c
|
||||
char conjx = std::get<2>(GetParam());
|
||||
// matrix size m
|
||||
gtint_t m = std::get<3>(GetParam());
|
||||
// matrix size n
|
||||
gtint_t n = std::get<4>(GetParam());
|
||||
// specifies alpha value
|
||||
T alpha = std::get<5>(GetParam());
|
||||
// specifies beta value
|
||||
T beta = std::get<6>(GetParam());
|
||||
// stride size for x:
|
||||
gtint_t incx = std::get<7>(GetParam());
|
||||
// stride size for y:
|
||||
gtint_t incy = std::get<8>(GetParam());
|
||||
// exception value for a:
|
||||
T a_exval = std::get<9>(GetParam());
|
||||
// exception value for x:
|
||||
T x_exval = std::get<10>(GetParam());
|
||||
// exception value for y:
|
||||
T y_exval = std::get<11>(GetParam());
|
||||
// lda increment.
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<12>(GetParam());
|
||||
|
||||
bool is_memory_test = false;
|
||||
bool is_evt_test = true;
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
// functionality from which we estimate operation count per element
|
||||
// of output, and hence the multipler for epsilon.
|
||||
double thresh;
|
||||
if (m == 0 || n == 0)
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>() && (beta == testinghelpers::ZERO<T>() || beta == testinghelpers::ONE<T>()))
|
||||
thresh = 0.0;
|
||||
else if (alpha == testinghelpers::ZERO<T>())
|
||||
thresh = testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
if(( transa == 'n' ) || ( transa == 'N' ))
|
||||
thresh = (3*n+1)*testinghelpers::getEpsilon<T>();
|
||||
else
|
||||
thresh = (3*m+1)*testinghelpers::getEpsilon<T>();
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test, is_evt_test, a_exval, x_exval, y_exval );
|
||||
}
|
||||
|
||||
class zgemvEVTPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,T,T,T,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
T a_exval = std::get<9>(str.param);
|
||||
T x_exval = std::get<10>(str.param);
|
||||
T y_exval = std::get<11>(str.param);
|
||||
gtint_t ld_inc = std::get<12>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + "_a_exval_" + testinghelpers::get_value_string(a_exval);
|
||||
str_name = str_name + "_x_exval_" + testinghelpers::get_value_string(x_exval);
|
||||
str_name = str_name + "_y_exval_" + testinghelpers::get_value_string(y_exval);
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_unitStride,
|
||||
zgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // alpha
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::zgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
matrix_vector_nonUnitStride,
|
||||
zgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // alpha
|
||||
::testing::Values(T{ 0.0, 0.0},
|
||||
T{ 1.0, 1.0},
|
||||
T{ 2.1, -1.2},
|
||||
T{-1.0, 0.0},
|
||||
T{ 1.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::zgemvEVTPrint()
|
||||
);
|
||||
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_unitStride,
|
||||
zgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // m
|
||||
::testing::Values(gtint_t(32),
|
||||
gtint_t(24),
|
||||
gtint_t(8),
|
||||
gtint_t(4),
|
||||
gtint_t(2),
|
||||
gtint_t(1),
|
||||
gtint_t(15)), // n
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // alpha
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::zgemvEVTPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
alpha_beta_nonUnitStride,
|
||||
zgemvEVT,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(55)), // m
|
||||
::testing::Values(gtint_t(55)), // n
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // alpha
|
||||
::testing::Values(T{AOCL_NaN, AOCL_NaN},
|
||||
T{AOCL_Inf, -AOCL_Inf},
|
||||
T{AOCL_NaN, AOCL_Inf},
|
||||
T{2.1, AOCL_Inf},
|
||||
T{AOCL_Inf, -1.2},
|
||||
T{AOCL_Inf, 0.0},
|
||||
T{0.0, AOCL_Inf},
|
||||
T{0.0, 0.0}), // beta
|
||||
::testing::Values(gtint_t(3)), // stride size for x
|
||||
::testing::Values(gtint_t(5)), // stride size for y
|
||||
::testing::Values(T{0.0, 0.0}), // a_exval
|
||||
::testing::Values(T{0.0, 0.0}), // x_exval
|
||||
::testing::Values(T{0.0, 0.0}), // y_exval
|
||||
::testing::Values(gtint_t(7)) // increment to the leading dim of a
|
||||
),
|
||||
::zgemvEVTPrint()
|
||||
);
|
||||
@@ -35,21 +35,23 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "test_gemv.h"
|
||||
|
||||
class zgemvTest :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
dcomplex, // alpha
|
||||
dcomplex, // beta
|
||||
gtint_t, // stride size for x
|
||||
gtint_t, // stride size for y
|
||||
gtint_t>> {}; // increment to the leading dim of a
|
||||
using T = dcomplex;
|
||||
|
||||
TEST_P(zgemvTest, RandomData)
|
||||
class zgemvGeneric :
|
||||
public ::testing::TestWithParam<std::tuple<char, // storage format
|
||||
char, // transa
|
||||
char, // conjx
|
||||
gtint_t, // m
|
||||
gtint_t, // n
|
||||
T, // alpha
|
||||
T, // beta
|
||||
gtint_t, // incx
|
||||
gtint_t, // incy
|
||||
gtint_t, // lda_inc
|
||||
bool>> {}; // is_memory_test
|
||||
|
||||
TEST_P(zgemvGeneric, FunctionalTest)
|
||||
{
|
||||
using T = dcomplex;
|
||||
//----------------------------------------------------------
|
||||
// Initialize values from the parameters passed through
|
||||
// test suite instantiation (INSTANTIATE_TEST_SUITE_P).
|
||||
@@ -76,6 +78,8 @@ TEST_P(zgemvTest, RandomData)
|
||||
// If increment is zero, then the array size matches the matrix size.
|
||||
// If increment are nonnegative, the array size is bigger than the matrix size.
|
||||
gtint_t lda_inc = std::get<9>(GetParam());
|
||||
// is_memory_test:
|
||||
bool is_memory_test = std::get<10>(GetParam());
|
||||
|
||||
// Set the threshold for the errors:
|
||||
// Check gtestsuite gemv.h or netlib source code for reminder of the
|
||||
@@ -97,45 +101,43 @@ TEST_P(zgemvTest, RandomData)
|
||||
//----------------------------------------------------------
|
||||
// Call test body using these parameters
|
||||
//----------------------------------------------------------
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh );
|
||||
test_gemv<T>( storage, transa, conjx, m, n, alpha, lda_inc, incx, beta, incy, thresh, is_memory_test );
|
||||
}
|
||||
|
||||
class zgemvTestPrint {
|
||||
class zgemvGenericPrint {
|
||||
public:
|
||||
std::string operator()(
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,dcomplex,dcomplex,gtint_t,gtint_t,gtint_t>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
dcomplex alpha = std::get<5>(str.param);
|
||||
dcomplex beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
testing::TestParamInfo<std::tuple<char,char,char,gtint_t,gtint_t,T,T,gtint_t,gtint_t,gtint_t,bool>> str) const {
|
||||
char sfm = std::get<0>(str.param);
|
||||
char transa = std::get<1>(str.param);
|
||||
char conjx = std::get<2>(str.param);
|
||||
gtint_t m = std::get<3>(str.param);
|
||||
gtint_t n = std::get<4>(str.param);
|
||||
T alpha = std::get<5>(str.param);
|
||||
T beta = std::get<6>(str.param);
|
||||
gtint_t incx = std::get<7>(str.param);
|
||||
gtint_t incy = std::get<8>(str.param);
|
||||
gtint_t ld_inc = std::get<9>(str.param);
|
||||
bool is_memory_test = std::get<10>(str.param);
|
||||
|
||||
#ifdef TEST_BLAS
|
||||
std::string str_name = "zgemv_";
|
||||
std::string str_name = "blas_";
|
||||
#elif TEST_CBLAS
|
||||
std::string str_name = "cblas_zgemv";
|
||||
std::string str_name = "cblas_";
|
||||
#else //#elif TEST_BLIS_TYPED
|
||||
std::string str_name = "bli_zgemv";
|
||||
std::string str_name = "bli_";
|
||||
#endif
|
||||
str_name = str_name + "_" + sfm;
|
||||
str_name = str_name + "_" + transa+conjx;
|
||||
str_name = str_name + "_" + std::to_string(m);
|
||||
str_name = str_name + "_" + std::to_string(n);
|
||||
std::string incx_str = ( incx > 0) ? std::to_string(incx) : "m" + std::to_string(std::abs(incx));
|
||||
std::string incy_str = ( incy > 0) ? std::to_string(incy) : "m" + std::to_string(std::abs(incy));
|
||||
str_name = str_name + "_" + incx_str;
|
||||
str_name = str_name + "_" + incy_str;
|
||||
std::string alpha_str = ( alpha.real > 0) ? std::to_string(int(alpha.real)) : ("m" + std::to_string(int(std::abs(alpha.real))));
|
||||
alpha_str = alpha_str + "pi" + (( alpha.imag > 0) ? std::to_string(int(alpha.imag)) : ("m" + std::to_string(int(std::abs(alpha.imag)))));
|
||||
std::string beta_str = ( beta.real > 0) ? std::to_string(int(beta.real)) : ("m" + std::to_string(int(std::abs(beta.real))));
|
||||
beta_str = beta_str + "pi" + (( beta.imag > 0) ? std::to_string(int(beta.imag)) : ("m" + std::to_string(int(std::abs(beta.imag)))));
|
||||
str_name = str_name + "_a" + alpha_str;
|
||||
str_name = str_name + "_b" + beta_str;
|
||||
str_name = str_name + "_" + std::to_string(ld_inc);
|
||||
str_name = str_name + "stor_" + sfm;
|
||||
str_name = str_name + "_transa_" + transa;
|
||||
str_name = str_name + "_conjx_" + conjx;
|
||||
str_name = str_name + "_m_" + std::to_string(m);
|
||||
str_name = str_name + "_n_" + std::to_string(n);
|
||||
str_name = str_name + "_incx_" + testinghelpers::get_value_string(incx);;
|
||||
str_name = str_name + "_incy_" + testinghelpers::get_value_string(incy);;
|
||||
str_name = str_name + "_alpha_" + testinghelpers::get_value_string(alpha);
|
||||
str_name = str_name + "_beta_" + testinghelpers::get_value_string(beta);
|
||||
str_name = str_name + "_lda_" + std::to_string(testinghelpers::get_leading_dimension( sfm, 'n', m, n, ld_inc ));
|
||||
str_name = str_name + (( is_memory_test ) ? "_mem_test_enabled" : "_mem_test_disabled");
|
||||
return str_name;
|
||||
}
|
||||
};
|
||||
@@ -143,29 +145,30 @@ public:
|
||||
// Black box testing.
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox,
|
||||
zgemvTest,
|
||||
zgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('n','c','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values(dcomplex{1.0, -2.0}), // alpha
|
||||
::testing::Values(dcomplex{-1.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
), // storage format
|
||||
::testing::Values('n','c','t'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // m
|
||||
::testing::Range(gtint_t(10), gtint_t(31), 10), // n
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.0, -2.0}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{-1.0, 1.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::zgemvTestPrint()
|
||||
::zgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Tiny_Matrixsizes,
|
||||
zgemvTest,
|
||||
zgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -176,40 +179,42 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(1), gtint_t(9), 1), // m
|
||||
::testing::Range(gtint_t(1), gtint_t(9), 1), // n
|
||||
::testing::Values(dcomplex{1.0, -2.0}), // alpha
|
||||
::testing::Values(dcomplex{1.0, -2.0}), // beta
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.0, -2.0}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.0, -2.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(7), gtint_t(3)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(7), gtint_t(3)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::zgemvTestPrint()
|
||||
::zgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Average_Matrixsizes,
|
||||
zgemvTest,
|
||||
zgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
,'r'
|
||||
#endif
|
||||
), // storage format
|
||||
::testing::Values('t','c'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(128), gtint_t(512), 31), // m
|
||||
::testing::Range(gtint_t(512), gtint_t(128), -31), // n
|
||||
::testing::Values(dcomplex{-1.0, 2.0}, dcomplex{-2.0, 1.0}), // alpha
|
||||
::testing::Values(dcomplex{-1.0, -3.1}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)) // increment to the leading dim of a
|
||||
), // storage format
|
||||
::testing::Values('t','c'), // transa
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(128), gtint_t(512), 31), // m
|
||||
::testing::Range(gtint_t(512), gtint_t(128), -31), // n
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{-1.0, 2.0}, T{-2.0, 1.0}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{-1.0, -3.1}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(1)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::zgemvTestPrint()
|
||||
::zgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Large_Matrixsizes,
|
||||
zgemvTest,
|
||||
zgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -220,19 +225,20 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Range(gtint_t(1024), gtint_t(32767), 1023), // m
|
||||
::testing::Range(gtint_t(1024), gtint_t(32767), 1023), // n
|
||||
::testing::Values(dcomplex{1.1, 2.1}), // alpha
|
||||
::testing::Values(dcomplex{1.1, 2.1}), // beta
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.1, 2.1}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.1, 2.1}), // beta
|
||||
::testing::Values(gtint_t(11), gtint_t(119), gtint_t(211)), // stride size for x
|
||||
::testing::Values(gtint_t(211), gtint_t(119), gtint_t(11)), // stride size for y
|
||||
::testing::Values(gtint_t(1), gtint_t(252)) // increment to the leading dim of a
|
||||
::testing::Values(gtint_t(1), gtint_t(252)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
|
||||
::zgemvTestPrint()
|
||||
::zgemvGenericPrint()
|
||||
);
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
Blackbox_Unit_MN,
|
||||
zgemvTest,
|
||||
zgemvGeneric,
|
||||
::testing::Combine(
|
||||
::testing::Values('c'
|
||||
#ifndef TEST_BLAS
|
||||
@@ -243,12 +249,13 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
::testing::Values('n'), // conjx
|
||||
::testing::Values(gtint_t(1)), // m
|
||||
::testing::Values(gtint_t(1)), // n
|
||||
::testing::Values(dcomplex{1.0, -0.1}), // alpha
|
||||
::testing::Values(dcomplex{0.1, 1.0}, dcomplex{-2.0, 1.0},
|
||||
dcomplex{-3.0, 2.0}, dcomplex{-1.0, -2.0}), // beta
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{1.0, -0.1}), // alpha
|
||||
::testing::Values(T{1.0, 1.0}, T{0.0, 0.0}, T{0.1, 1.0},
|
||||
T{-2.0, 1.0}, T{-3.0, 2.0}, T{-1.0, -2.0}), // beta
|
||||
::testing::Values(gtint_t(1)), // stride size for x
|
||||
::testing::Values(gtint_t(1)), // stride size for y
|
||||
::testing::Values(gtint_t(0)) // increment to the leading dim of a
|
||||
),
|
||||
::zgemvTestPrint()
|
||||
::testing::Values(gtint_t(0)), // increment to the leading dim of a
|
||||
::testing::Values(false, true) // is_memory_test
|
||||
),
|
||||
::zgemvGenericPrint()
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user