Skip to content

Commit

Permalink
avoid thrust copy
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 committed Jul 7, 2024
1 parent 7db0715 commit 680f233
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions src/utilities/include/par.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,30 @@ STL_DYNAMIC_BACKEND_VOID(uninitialized_fill)
STL_DYNAMIC_BACKEND_VOID(uninitialized_copy)
STL_DYNAMIC_BACKEND_VOID(stable_sort)
STL_DYNAMIC_BACKEND_VOID(fill)
STL_DYNAMIC_BACKEND_VOID(copy)
STL_DYNAMIC_BACKEND_VOID(inclusive_scan)
STL_DYNAMIC_BACKEND_VOID(copy_n)

// there are some issues with thrust copy
template <typename InputIterator, typename OutputIterator>
OutputIterator copy(ExecutionPolicy policy, InputIterator first,
InputIterator last, OutputIterator result) {
#if MANIFOLD_PAR == 'T' && \
(TBB_INTERFACE_VERSION >= 10000 && __has_include(<pstl/glue_execution_defs.h>))
if (policy == ExecutionPolicy::Par)
return std::copy(std::execution::par_unseq, first, last, result);
#endif
return std::copy(first, last, result);
}

template <typename InputIterator, typename OutputIterator>
OutputIterator copy_n(ExecutionPolicy policy, InputIterator first, size_t n,
OutputIterator result) {
#if MANIFOLD_PAR == 'T' && \
(TBB_INTERFACE_VERSION >= 10000 && __has_include(<pstl/glue_execution_defs.h>))
if (policy == ExecutionPolicy::Par)
return std::copy_n(std::execution::par_unseq, first, n, result);
#endif
return std::copy_n(first, n, result);
}

// void implies that the user have to specify the return type in the template
// argument, as we are unable to deduce it
Expand Down

0 comments on commit 680f233

Please sign in to comment.