Skip to content

Commit

Permalink
Improve "no copy mechanism" exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-kelley committed Dec 15, 2023
1 parent 18d7d78 commit 316ceac
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions core/src/Kokkos_CopyViews.hpp
Expand Up @@ -612,12 +612,17 @@ void view_copy(const DstType& dst, const SrcType& src) {
};

if (!DstExecCanAccessSrc && !SrcExecCanAccessDst) {
std::string message(
"Error: Kokkos::deep_copy with no available copy mechanism: ");
message += src.label();
message += " to ";
message += dst.label();
Kokkos::Impl::throw_runtime_exception(message);
std::ostringstream ss;
ss << "Error: Kokkos::deep_copy with no available copy mechanism: ";
ss << "from src (\"" << src.label() << "\") to dst (\"" << dst.label()
<< "\").\n";
ss << "There is no common execution space that can access both src's "
"space\n";
ss << "(" << src_memory_space().name() << ") and dst's space ("
<< dst_memory_space().name() << "), ";
ss << "so src and dst\n";
ss << "must be contiguous and have the same layout.\n";
Kokkos::Impl::throw_runtime_exception(ss.str());
}

// Figure out iteration order in case we need it
Expand Down

0 comments on commit 316ceac

Please sign in to comment.