Skip to content

Commit

Permalink
Merge pull request #5870 from dalg24/view_rank_member_function
Browse files Browse the repository at this point in the history
Add support for `View::rank[_dynamic]()`
  • Loading branch information
dalg24 authored Feb 22, 2023
2 parents c256a98 + 03aae9a commit e146fc9
Show file tree
Hide file tree
Showing 10 changed files with 227 additions and 152 deletions.
2 changes: 1 addition & 1 deletion algorithms/src/std_algorithms/impl/Kokkos_Constraints.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct is_admissible_to_kokkos_std_algorithms : std::false_type {};

template <typename T>
struct is_admissible_to_kokkos_std_algorithms<
T, std::enable_if_t< ::Kokkos::is_view<T>::value && T::rank == 1 &&
T, std::enable_if_t< ::Kokkos::is_view<T>::value && T::rank() == 1 &&
(std::is_same<typename T::traits::array_layout,
Kokkos::LayoutLeft>::value ||
std::is_same<typename T::traits::array_layout,
Expand Down
2 changes: 1 addition & 1 deletion containers/src/Kokkos_OffsetView.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ class OffsetView : public ViewTraits<DataType, Properties...> {
"Incompatible OffsetView copy construction");
Mapping::assign(m_map, aview.impl_map(), m_track);

for (int i = 0; i < aview.rank; ++i) {
for (size_t i = 0; i < aview.rank; ++i) {
m_begins[i] = 0;
}
}
Expand Down
48 changes: 24 additions & 24 deletions core/src/Kokkos_CopyViews.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1636,19 +1636,19 @@ inline void deep_copy(
"match: ");
message += dst.label();
message += "(";
for (int r = 0; r < dst_type::rank - 1; r++) {
message += std::to_string(dst.extent(r));
message += std::to_string(dst.extent(0));
for (size_t r = 1; r < dst_type::rank; r++) {
message += ",";
message += std::to_string(dst.extent(r));
}
message += std::to_string(dst.extent(dst_type::rank - 1));
message += ") ";
message += src.label();
message += "(";
for (int r = 0; r < src_type::rank - 1; r++) {
message += std::to_string(src.extent(r));
message += std::to_string(src.extent(0));
for (size_t r = 1; r < src_type::rank; r++) {
message += ",";
message += std::to_string(src.extent(r));
}
message += std::to_string(src.extent(src_type::rank - 1));
message += ") ";

Kokkos::Impl::throw_runtime_exception(message);
Expand Down Expand Up @@ -1719,19 +1719,19 @@ inline void deep_copy(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
message += dst.label();
message += "(";
for (int r = 0; r < dst_type::rank - 1; r++) {
message += std::to_string(dst.extent(r));
message += std::to_string(dst.extent(0));
for (size_t r = 1; r < dst_type::rank; r++) {
message += ",";
message += std::to_string(dst.extent(r));
}
message += std::to_string(dst.extent(dst_type::rank - 1));
message += ") ";
message += src.label();
message += "(";
for (int r = 0; r < src_type::rank - 1; r++) {
message += std::to_string(src.extent(r));
message += std::to_string(src.extent(0));
for (size_t r = 1; r < src_type::rank; r++) {
message += ",";
message += std::to_string(src.extent(r));
}
message += std::to_string(src.extent(src_type::rank - 1));
message += ") ";

Kokkos::Impl::throw_runtime_exception(message);
Expand Down Expand Up @@ -2800,19 +2800,19 @@ inline void deep_copy(
"match: ");
message += dst.label();
message += "(";
for (int r = 0; r < dst_type::rank - 1; r++) {
message += std::to_string(dst.extent(r));
message += std::to_string(dst.extent(0));
for (size_t r = 1; r < dst_type::rank; r++) {
message += ",";
message += std::to_string(dst.extent(r));
}
message += std::to_string(dst.extent(dst_type::rank - 1));
message += ") ";
message += src.label();
message += "(";
for (int r = 0; r < src_type::rank - 1; r++) {
message += std::to_string(src.extent(r));
message += std::to_string(src.extent(0));
for (size_t r = 1; r < src_type::rank; r++) {
message += ",";
message += std::to_string(src.extent(r));
}
message += std::to_string(src.extent(src_type::rank - 1));
message += ") ";

Kokkos::Impl::throw_runtime_exception(message);
Expand Down Expand Up @@ -2869,19 +2869,19 @@ inline void deep_copy(
"Deprecation Error: Kokkos::deep_copy extents of views don't match: ");
message += dst.label();
message += "(";
for (int r = 0; r < dst_type::rank - 1; r++) {
message += std::to_string(dst.extent(r));
message += std::to_string(dst.extent(0));
for (size_t r = 1; r < dst_type::rank; r++) {
message += ",";
message += std::to_string(dst.extent(r));
}
message += std::to_string(dst.extent(dst_type::rank - 1));
message += ") ";
message += src.label();
message += "(";
for (int r = 0; r < src_type::rank - 1; r++) {
message += std::to_string(src.extent(r));
message += std::to_string(src.extent(0));
for (size_t r = 1; r < src_type::rank; r++) {
message += ",";
message += std::to_string(src.extent(r));
}
message += std::to_string(src.extent(src_type::rank - 1));
message += ") ";

Kokkos::Impl::throw_runtime_exception(message);
Expand Down
Loading

0 comments on commit e146fc9

Please sign in to comment.