Skip to content

Commit

Permalink
Remove Kokkos::Impl::throw_runtime_exception from Kokkos Kernels
Browse files Browse the repository at this point in the history
Removing the dependency to avoid reliance on Kokkos::Impl functions
  • Loading branch information
lucbv committed Jan 27, 2022
1 parent 4409775 commit 91d6a60
Show file tree
Hide file tree
Showing 41 changed files with 3,670 additions and 3,465 deletions.
5 changes: 3 additions & 2 deletions example/gmres/gmres.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <KokkosBlas3_trsm.hpp>
#include <KokkosSparse_spmv.hpp>
#include <KokkosSparse_Preconditioner.hpp>
#include "KokkosKernels_Error.hpp"

////////////////////////////////////////////////////////////////////////////////
// libstdc++ half_t overloads
Expand Down Expand Up @@ -141,15 +142,15 @@ GmresStats gmres(
std::ostringstream os;
os << "gmres: A must be a square matrix: "
<< "numRows: " << n << " numCols: " << A.numCols();
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

if (X.extent(0) != B.extent(0) || X.extent(0) != n) {
std::ostringstream os;
os << "gmres: Dimensions of A, X, and B do not match: "
<< "A: " << n << " x " << n << ", X: " << X.extent(0)
<< "x 1, B: " << B.extent(0) << " x 1";
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}
// Check parameter validity:
if (m <= 0) {
Expand Down
7 changes: 4 additions & 3 deletions src/batched/dense/KokkosBatched_Gemm_Decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
// Includes for non-functor-level routines
#include <KokkosBatched_Gemm_Handle.hpp>
#include <KokkosKernels_ExecSpaceUtils.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBatched {
/********************* BEGIN functor-level routines *********************/
Expand Down Expand Up @@ -357,7 +358,7 @@ int BatchedGemm(BatchedGemmHandleType *const handle, const ScalarType alpha,
os << "KokkosBatched::BatchedGemm does not support kernelAlgoType = "
<< std::to_string(handle->get_kernel_algo_type())
<< " with SIMD views." << std::endl;
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
break;
}
} else {
Expand Down Expand Up @@ -436,7 +437,7 @@ int BatchedGemm(BatchedGemmHandleType *const handle, const ScalarType alpha,
<< std::to_string(handle->get_kernel_algo_type()) << " when c_m("
<< std::to_string(c_m) << ") != c_n(" << std::to_string(c_n) << ")"
<< std::endl;
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Select optimal resultsPerThread param for BatchedSerialGemm
Expand Down Expand Up @@ -577,7 +578,7 @@ int BatchedGemm(BatchedGemmHandleType *const handle, const ScalarType alpha,
std::ostringstream os;
os << "KokkosBatched::BatchedGemm does not support kernelAlgoType = "
<< std::to_string(handle->get_kernel_algo_type()) << "." << std::endl;
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
break;
}
return ret;
Expand Down
5 changes: 3 additions & 2 deletions src/batched/dense/impl/KokkosBatched_Gemm_DblBuf_Impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
#define __KOKKOSBATCHED_GEMM_DBLBUF_IMPL_HPP__

#include "KokkosBatched_Util.hpp"
#include "KokkosKernels_Error.hpp"

namespace KokkosBatched {
/********************* BEGIN functor-level routines *********************/
Expand Down Expand Up @@ -160,7 +161,7 @@ class BatchedDblBufGemm {
<< " does not support team_size > " << std::to_string(max_team_size)
<< "." << std::endl
<< " The tile dimensions must be adjusted." << std::endl;
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

const int max_vector_len =
Expand All @@ -172,7 +173,7 @@ class BatchedDblBufGemm {
<< " does not support vector_len > " << std::to_string(max_vector_len)
<< "." << std::endl
<< " The tile dimensions must be adjusted." << std::endl;
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

if (__handle->enableDebug) {
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_abs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_abs_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -85,7 +86,7 @@ void abs(const RMV& R, const XMV& X) {
os << "KokkosBlas::abs (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << " x " << R.extent(1) << ", X: " << X.extent(0)
<< " x " << X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views. RMV and XMV may be
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_axpby.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_axpby_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

// axpby() accepts both scalar coefficients a and b, and vector
// coefficients (apply one for each column of the input multivectors).
Expand Down Expand Up @@ -82,7 +83,7 @@ void axpby(const AV& a, const XMV& X, const BV& b, const YMV& Y) {
os << "KokkosBlas::axpby: Dimensions of X and Y do not match: "
<< "X: " << X.extent(0) << " x " << X.extent(1) << ", Y: " << Y.extent(0)
<< " x " << Y.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
5 changes: 3 additions & 2 deletions src/blas/KokkosBlas1_dot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_dot_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -79,7 +80,7 @@ dot(const XVector& x, const YVector& y) {
os << "KokkosBlas::dot: Dimensions do not match: "
<< ", x: " << x.extent(0) << " x 1"
<< ", y: " << y.extent(0) << " x 1";
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

typedef Kokkos::View<
Expand Down Expand Up @@ -209,7 +210,7 @@ void dot(const RV& R, const XMV& X, const YMV& Y,
}
os << "X: " << X.extent(0) << " x " << X.extent(1) << ", Y: " << Y.extent(0)
<< " x " << Y.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views.
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_iamax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_iamax_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -131,7 +132,7 @@ void iamax(const RV& R, const XMV& X,
os << "KokkosBlas::iamax (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_mult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_mult_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -78,7 +79,7 @@ void mult(typename YMV::const_value_type& gamma, const YMV& Y,
<< "Y: " << Y.extent(0) << " x " << Y.extent(1) << ", A: " << A.extent(0)
<< " x " << A.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using YUnifiedLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrm1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrm1_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -130,7 +131,7 @@ void nrm1(const RV& R, const XMV& X,
os << "KokkosBlas::nrm1 (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrm2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrm2_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -130,7 +131,7 @@ void nrm2(const RV& R, const XMV& X,
os << "KokkosBlas::nrm2 (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrm2_squared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrm2_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -131,7 +132,7 @@ void nrm2_squared(
os << "KokkosBlas::nrm2 (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrm2w.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrm2w_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -130,7 +131,7 @@ void nrm2w(const RV& R, const XMV& X, const XMV& W,
os << "KokkosBlas::nrm2w (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views. RV and XMV may be
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrm2w_squared.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrm2w_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -131,7 +132,7 @@ void nrm2w_squared(
os << "KokkosBlas::nrm2w (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views. RV and XMV may be
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_nrminf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_nrminf_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -131,7 +132,7 @@ void nrminf(
os << "KokkosBlas::nrminf (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_reciprocal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_reciprocal_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -85,7 +86,7 @@ void reciprocal(const RMV& R, const XMV& X) {
os << "KokkosBlas::reciprocal (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << " x " << R.extent(1) << ", X: " << X.extent(0)
<< " x " << X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views. RMV and XMV may be
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_scal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_scal_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -76,7 +77,7 @@ void scal(const RMV& R, const AV& a, const XMV& X) {
os << "KokkosBlas::scal: Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << " x " << R.extent(1) << ", X: " << X.extent(0)
<< " x " << X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedRLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_sum.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_sum_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -120,7 +121,7 @@ void sum(const RV& R, const XMV& X,
os << "KokkosBlas::sum (MV): Dimensions of R and X do not match: "
<< "R: " << R.extent(0) << ", X: " << X.extent(0) << " x "
<< X.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using UnifiedXLayout =
Expand Down
3 changes: 2 additions & 1 deletion src/blas/KokkosBlas1_update.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

#include <KokkosBlas1_update_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>

namespace KokkosBlas {

Expand Down Expand Up @@ -95,7 +96,7 @@ void update(const typename XMV::non_const_value_type& alpha, const XMV& X,
<< "Z: " << Z.extent(0) << " x " << Z.extent(1) << ", X: " << X.extent(0)
<< " x " << X.extent(1) << ", Y: " << Y.extent(0) << " x "
<< Y.extent(1);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

// Create unmanaged versions of the input Views. XMV, YMV, and ZMV
Expand Down
7 changes: 4 additions & 3 deletions src/blas/KokkosBlas2_gemv.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#include <KokkosBlas2_gemv_spec.hpp>
#include <KokkosKernels_helpers.hpp>
#include <KokkosKernels_Error.hpp>
#include <sstream>
#include <type_traits> // requires C++11, but so does Kokkos

Expand Down Expand Up @@ -99,7 +100,7 @@ void gemv(const typename AViewType::execution_space& space, const char trans[],
os << "KokkosBlas::gemv: Dimensions of A, x, and y do not match: "
<< "A: " << A.extent(0) << " x " << A.extent(1)
<< ", x: " << x.extent(0) << ", y: " << y.extent(0);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}
} else if (trans[0] == 'T' || trans[0] == 't' || trans[0] == 'C' ||
trans[0] == 'c' || trans[0] == 'H' || trans[0] == 'h') {
Expand All @@ -108,15 +109,15 @@ void gemv(const typename AViewType::execution_space& space, const char trans[],
os << "KokkosBlas::dot: Dimensions of A, x, and y do not match: "
<< "A: " << A.extent(0) << " x " << A.extent(1)
<< ", x: " << x.extent(0) << ", y: " << y.extent(0);
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}
} else {
std::ostringstream os;
os << "KokkosBlas::gemv: trans[0] = '" << trans[0]
<< "'. Valid values "
"include 'N' (No transpose), 'T' (Transpose), and 'C' (Conjugate "
"transpose).";
Kokkos::Impl::throw_runtime_exception(os.str());
KokkosKernels::Impl::throw_runtime_exception(os.str());
}

using ALayout = typename AViewType::array_layout;
Expand Down
Loading

0 comments on commit 91d6a60

Please sign in to comment.