Skip to content

Commit

Permalink
unit_test/blas: Check cublas gemv for unsupported transpose op
Browse files Browse the repository at this point in the history
  - Related to #974.
  • Loading branch information
e10harvey committed May 13, 2021
1 parent 15018cb commit d419296
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion unit_test/blas/Test_Blas2_gemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ namespace Test {
typedef typename ViewTypeA::value_type ScalarA;
typedef typename ViewTypeX::value_type ScalarX;
typedef typename ViewTypeY::value_type ScalarY;
using LayoutAType = typename ViewTypeA::array_layout;
typedef Kokkos::ArithTraits<ScalarY> KAT_Y;

typedef multivector_layout_adapter<ViewTypeA> vfA_type;
Expand Down Expand Up @@ -78,7 +79,16 @@ namespace Test {
Kokkos::deep_copy(expected, h_org_y);
vanillaGEMV(mode[0], alpha, h_A, h_x, beta, expected);

KokkosBlas::gemv(mode, alpha, A, x, beta, y);
// Cublas does not support row-major (LayoutRight) + conjugate transpose
// We throw a runtime error in the wrapper for cublasGemv if the user attempts
// this, therefore we must test this code path via the try-catch below.
try {
KokkosBlas::gemv(mode, alpha, A, x, beta, y);
} catch (const std::runtime_error &error) {
if ((mode[0] == 'c' || mode[0] == 'C') && std::is_same<LayoutAType, Kokkos::LayoutRight>::value)
return; // Pass since we caught the runtime error
FAIL();
}
Kokkos::deep_copy(h_y, y);
int numErrors = 0;
for (int i = 0; i < ldy; i++) {
Expand Down

0 comments on commit d419296

Please sign in to comment.