Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BLAS and cuBLAS TPL interface for TRSM #532

Merged
merged 13 commits into from
Dec 20, 2019
21 changes: 6 additions & 15 deletions src/blas/KokkosBlas3_trsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@

/// \file KokkosBlas3_trsm.hpp

#include <KokkosKernels_Macros.hpp>
#include <KokkosBlas3_trsm_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include "KokkosKernels_Macros.hpp"
#include "KokkosBlas3_trsm_spec.hpp"
#include "KokkosKernels_helpers.hpp"
#include <sstream>
#include <type_traits>

Expand Down Expand Up @@ -92,8 +92,8 @@ trsm (const char side[],
"BViewType must be a Kokkos::View.");
static_assert (static_cast<int> (AViewType::rank) == 2,
"AViewType must have rank 2.");
static_assert (static_cast<int> (BViewType::rank) == 1 || static_cast<int> (BViewType::rank) == 2,
"BViewType must have either rank 1 or rank 2.");
static_assert (static_cast<int> (BViewType::rank) == 2,
"BViewType must have rank 2.");

// Check validity of indicator argument
bool valid_side = (side[0] == 'L' ) || (side[0] == 'l' )||
Expand Down Expand Up @@ -167,16 +167,7 @@ trsm (const char side[],
typename BViewType::device_type,
Kokkos::MemoryTraits<Kokkos::Unmanaged> >;

AVT A_i = A;

if (BViewType::rank == 1) {
auto B_i = BVT(B.data(), B.extent(0), 1);
KokkosBlas::Impl::TRSM<AVT, BVT>::trsm (side, uplo, trans, diag, alpha, A_i, B_i);
}
else { //BViewType::rank == 2
auto B_i = BVT(B.data(), B.extent(0), B.extent(1));
KokkosBlas::Impl::TRSM<AVT, BVT>::trsm (side, uplo, trans, diag, alpha, A_i, B_i);
}
KokkosBlas::Impl::TRSM<AVT, BVT>::trsm (side, uplo, trans, diag, alpha, A, B);
}

} // namespace KokkosBlas
Expand Down
2 changes: 1 addition & 1 deletion src/blas/impl/KokkosBlas3_trsm_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

namespace KokkosBlas {
namespace Impl {
//TODO: Add the implementation of KokkosBlas::trsm later
//Note: Add an implementation of KokkosBlas::trsm in a next PR.
}
}
#endif // KOKKOSBLAS3_TRSM_IMPL_HPP_
2 changes: 1 addition & 1 deletion src/blas/impl/KokkosBlas3_trsm_spec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ struct TRSM {
std::ostringstream os;
os << "KokkosBlas::trsm currently supports only TPL interface."
<< "Please enable Host BLAS or cuBLAS."
<< "KokkosKernels implmentation will be added in future release.";
<< "KokkosKernels implementation will be added in future release.";
mhoemmen marked this conversation as resolved.
Show resolved Hide resolved
Kokkos::Impl::throw_runtime_exception (os.str ());
}
};
Expand Down