Skip to content

Commit

Permalink
address reviews [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinemeyer5 committed Aug 3, 2023
1 parent 6837868 commit c6d98a6
Show file tree
Hide file tree
Showing 11 changed files with 218 additions and 259 deletions.
41 changes: 19 additions & 22 deletions algorithms/src/std_algorithms/Kokkos_Copy.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,24 @@ namespace Experimental {
//
// overload set accepting execution space
//
template <class ExecutionSpace, class InputIterator, class OutputIterator>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy(const ExecutionSpace& ex, InputIterator first, InputIterator last,
template <typename ExecutionSpace, typename InputIterator, typename OutputIterator,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
OutputIterator copy(const ExecutionSpace& ex, InputIterator first, InputIterator last,
OutputIterator d_first) {
return Impl::copy_exespace_impl("Kokkos::copy_iterator_api_default", ex,
first, last, d_first);
}

template <class ExecutionSpace, class InputIterator, class OutputIterator>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy(const std::string& label, const ExecutionSpace& ex, InputIterator first,
template <typename ExecutionSpace, typename InputIterator, typename OutputIterator,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
OutputIterator copy(const std::string& label, const ExecutionSpace& ex, InputIterator first,
InputIterator last, OutputIterator d_first) {
return Impl::copy_exespace_impl(label, ex, first, last, d_first);
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
int> = 0>
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
auto copy(const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
::Kokkos::View<DataType2, Properties2...>& dest) {
Expand All @@ -59,9 +56,9 @@ auto copy(const ExecutionSpace& ex,
KE::begin(dest));
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand All @@ -77,18 +74,18 @@ auto copy(const std::string& label, const ExecutionSpace& ex,
//
// overload set accepting team handle
//
template <class TeamHandleType, class InputIterator, class OutputIterator>
KOKKOS_FUNCTION std::enable_if_t<
::Kokkos::is_team_handle<TeamHandleType>::value, OutputIterator>
copy(const TeamHandleType& teamHandle, InputIterator first, InputIterator last,
template <typename TeamHandleType, typename InputIterator, typename OutputIterator,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION
OutputIterator copy(const TeamHandleType& teamHandle, InputIterator first, InputIterator last,
OutputIterator d_first) {
return Impl::copy_team_impl(teamHandle, first, last, d_first);
}

template <
class TeamHandleType, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_team_handle<TeamHandleType>::value, int> = 0>
typename TeamHandleType, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION auto copy(
const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand Down
41 changes: 19 additions & 22 deletions algorithms/src/std_algorithms/Kokkos_CopyBackward.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,24 @@ namespace Experimental {
//
// overload set accepting execution space
//
template <class ExecutionSpace, class IteratorType1, class IteratorType2>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
IteratorType2>
copy_backward(const ExecutionSpace& ex, IteratorType1 first, IteratorType1 last,
template <typename ExecutionSpace, typename IteratorType1, typename IteratorType2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
IteratorType2 copy_backward(const ExecutionSpace& ex, IteratorType1 first, IteratorType1 last,
IteratorType2 d_last) {
return Impl::copy_backward_exespace_impl(
"Kokkos::copy_backward_iterator_api_default", ex, first, last, d_last);
}

template <class ExecutionSpace, class IteratorType1, class IteratorType2>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
IteratorType2>
copy_backward(const std::string& label, const ExecutionSpace& ex,
template <typename ExecutionSpace, typename IteratorType1, typename IteratorType2
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
IteratorType2 copy_backward(const std::string& label, const ExecutionSpace& ex,
IteratorType1 first, IteratorType1 last, IteratorType2 d_last) {
return Impl::copy_backward_exespace_impl(label, ex, first, last, d_last);
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
int> = 0>
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
auto copy_backward(const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
::Kokkos::View<DataType2, Properties2...>& dest) {
Expand All @@ -58,9 +55,9 @@ auto copy_backward(const ExecutionSpace& ex,
cend(source), end(dest));
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy_backward(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand All @@ -75,18 +72,18 @@ auto copy_backward(const std::string& label, const ExecutionSpace& ex,
//
// overload set accepting team handle
//
template <class TeamHandleType, class IteratorType1, class IteratorType2>
KOKKOS_FUNCTION std::enable_if_t<
::Kokkos::is_team_handle<TeamHandleType>::value, IteratorType2>
copy_backward(const TeamHandleType& teamHandle, IteratorType1 first,
template <typename TeamHandleType, typename IteratorType1, typename IteratorType2,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION
IteratorType2 copy_backward(const TeamHandleType& teamHandle, IteratorType1 first,
IteratorType1 last, IteratorType2 d_last) {
return Impl::copy_backward_team_impl(teamHandle, first, last, d_last);
}

template <
class TeamHandleType, class DataType1, class... Properties1,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_team_handle<TeamHandleType>::value, int> = 0>
typename TeamHandleType, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION auto copy_backward(
const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand Down
45 changes: 21 additions & 24 deletions algorithms/src/std_algorithms/Kokkos_CopyIf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,26 @@ namespace Experimental {
//
// overload set accepting execution space
//
template <class ExecutionSpace, class InputIterator, class OutputIterator,
class Predicate>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy_if(const ExecutionSpace& ex, InputIterator first, InputIterator last,
template <typename ExecutionSpace, typename InputIterator, typename OutputIterator,
typename Predicate,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> =0>
OutputIterator copy_if(const ExecutionSpace& ex, InputIterator first, InputIterator last,
OutputIterator d_first, Predicate pred) {
return Impl::copy_if_exespace_impl("Kokkos::copy_if_iterator_api_default", ex,
first, last, d_first, std::move(pred));
}

template <class ExecutionSpace, class InputIterator, class OutputIterator,
class Predicate>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy_if(const std::string& label, const ExecutionSpace& ex, InputIterator first,
template <typename ExecutionSpace, typename InputIterator, typename OutputIterator,
typename Predicate, std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int> = 0>
OutputIterator copy_if(const std::string& label, const ExecutionSpace& ex, InputIterator first,
InputIterator last, OutputIterator d_first, Predicate pred) {
return Impl::copy_if_exespace_impl(label, ex, first, last, d_first,
std::move(pred));
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2, class Predicate,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2, typename Predicate,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy_if(const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand All @@ -61,9 +58,9 @@ auto copy_if(const ExecutionSpace& ex,
std::move(pred));
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class DataType2, class... Properties2, class Predicate,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2, typename Predicate,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy_if(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand All @@ -78,20 +75,20 @@ auto copy_if(const std::string& label, const ExecutionSpace& ex,
//
// overload set accepting team handle
//
template <class TeamHandleType, class InputIterator, class OutputIterator,
class Predicate>
KOKKOS_FUNCTION std::enable_if_t<
::Kokkos::is_team_handle<TeamHandleType>::value, OutputIterator>
copy_if(const TeamHandleType& teamHandle, InputIterator first,
template <typename TeamHandleType, typename InputIterator, typename OutputIterator,
typename Predicate,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION
OutputIterator copy_if(const TeamHandleType& teamHandle, InputIterator first,
InputIterator last, OutputIterator d_first, Predicate pred) {
return Impl::copy_if_team_impl(teamHandle, first, last, d_first,
std::move(pred));
}

template <
class TeamHandleType, class DataType1, class... Properties1,
class DataType2, class... Properties2, class Predicate,
std::enable_if_t<::Kokkos::is_team_handle<TeamHandleType>::value, int> = 0>
typename TeamHandleType, typename DataType1, typename... Properties1,
typename DataType2, typename... Properties2, typename Predicate,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION auto copy_if(
const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType1, Properties1...>& source,
Expand Down
43 changes: 19 additions & 24 deletions algorithms/src/std_algorithms/Kokkos_CopyN.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,24 @@ namespace Experimental {
//
// overload set accepting execution space
//
template <class ExecutionSpace, class InputIterator, class Size,
class OutputIterator>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy_n(const ExecutionSpace& ex, InputIterator first, Size count,
template <typename ExecutionSpace, typename InputIterator, typename Size,
typename OutputIterator, std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,int>=0>
OutputIterator copy_n(const ExecutionSpace& ex, InputIterator first, Size count,
OutputIterator result) {
return Impl::copy_n_exespace_impl("Kokkos::copy_n_iterator_api_default", ex,
first, count, result);
}

template <class ExecutionSpace, class InputIterator, class Size,
class OutputIterator>
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
OutputIterator>
copy_n(const std::string& label, const ExecutionSpace& ex, InputIterator first,
template <typename ExecutionSpace, typename InputIterator, typename Size,
typename OutputIterator, std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>, int>=0>
OutputIterator copy_n(const std::string& label, const ExecutionSpace& ex, InputIterator first,
Size count, OutputIterator result) {
return Impl::copy_n_exespace_impl(label, ex, first, count, result);
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class Size, class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename Size, typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy_n(const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source, Size count,
Expand All @@ -60,9 +56,9 @@ auto copy_n(const ExecutionSpace& ex,
KE::cbegin(source), count, KE::begin(dest));
}

template <class ExecutionSpace, class DataType1, class... Properties1,
class Size, class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_execution_space<ExecutionSpace>::value,
template <typename ExecutionSpace, typename DataType1, typename... Properties1,
typename Size, typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_execution_space_v<ExecutionSpace>,
int> = 0>
auto copy_n(const std::string& label, const ExecutionSpace& ex,
const ::Kokkos::View<DataType1, Properties1...>& source, Size count,
Expand All @@ -78,19 +74,18 @@ auto copy_n(const std::string& label, const ExecutionSpace& ex,
//
// overload set accepting team handle
//
template <class TeamHandleType, class InputIterator, class Size,
class OutputIterator>
KOKKOS_FUNCTION std::enable_if_t<
::Kokkos::is_team_handle<TeamHandleType>::value, OutputIterator>
copy_n(const TeamHandleType& teamHandle, InputIterator first, Size count,
template <typename TeamHandleType, typename InputIterator, typename Size,
typename OutputIterator, std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>,int>=0>
KOKKOS_FUNCTION
OutputIterator copy_n(const TeamHandleType& teamHandle, InputIterator first, Size count,
OutputIterator result) {
return Impl::copy_n_team_impl(teamHandle, first, count, result);
}

template <
class TeamHandleType, class DataType1, class... Properties1, class Size,
class DataType2, class... Properties2,
std::enable_if_t<::Kokkos::is_team_handle<TeamHandleType>::value, int> = 0>
typename TeamHandleType, typename DataType1, typename... Properties1, typename Size,
typename DataType2, typename... Properties2,
std::enable_if_t<::Kokkos::is_team_handle_v<TeamHandleType>, int> = 0>
KOKKOS_FUNCTION auto copy_n(
const TeamHandleType& teamHandle,
const ::Kokkos::View<DataType1, Properties1...>& source, Size count,
Expand Down

0 comments on commit c6d98a6

Please sign in to comment.