Implement fill and fill_n
MODIFY
testing/CMakeLists.txt
testing/CMakeLists.txt
@@ -79,7 +79,7 @@ add_thrust_test("device_ptr")
add_thrust_test("discard_iterator")
add_thrust_test("distance")
# add_thrust_test("equal")
-# add_thrust_test("fill")
+add_thrust_test("fill")
# add_thrust_test("find")
add_thrust_test("for_each")
add_thrust_test("functional_arithmetic")

MODIFY
thrust/system/detail/adl/fill.h
thrust/system/detail/adl/fill.h
#if 0
#include <thrust/system/cpp/detail/fill.h>
#include <thrust/system/cuda/detail/fill.h>
+#include <thrust/system/hip/detail/fill.h>
#include <thrust/system/omp/detail/fill.h>
#include <thrust/system/tbb/detail/fill.h>
#endif
#define __THRUST_DEVICE_SYSTEM_FILL_HEADER <__THRUST_DEVICE_SYSTEM_ROOT/detail/fill.h>
#include __THRUST_DEVICE_SYSTEM_FILL_HEADER
#undef __THRUST_DEVICE_SYSTEM_FILL_HEADER
-

MODIFY
thrust/system/hip/detail/fill.h
thrust/system/hip/detail/fill.h
*
******************************************************************************/
#pragma once
+
+#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
+#include <thrust/distance.h>
+#include <thrust/iterator/counting_iterator.h>
+#include <thrust/system/hip/config.h>
+#include <thrust/system/hip/detail/execution_policy.h>
+#include <thrust/system/hip/detail/transform.h>
+
+BEGIN_NS_THRUST
+namespace hip_rocprim {
+
+template <class Derived, class OutputIterator, class Size, class T>
+OutputIterator __host__ __device__
+fill_n(execution_policy<Derived>& policy,
+ OutputIterator first,
+ Size count,
+ const T& value)
+{
+ return hip_rocprim::transform(policy,
+ thrust::make_counting_iterator<Size>(0),
+ thrust::make_counting_iterator<Size>(count),
+ first,
+ [value](Size) { return value; });
+} // func fill_n
+
+template <class Derived, class ForwardIterator, class T>
+void __host__ __device__
+fill(execution_policy<Derived>& policy,
+ ForwardIterator first,
+ ForwardIterator last,
+ const T& value)
+{
+ hip_rocprim::fill_n(policy, first, thrust::distance(first, last), value);
+} // func filll
+
+} // namespace hip_rocprim
+END_NS_THRUST
+#endif

MODIFY
thrust/system/hip/detail/tabulate.h
thrust/system/hip/detail/tabulate.h
******************************************************************************/
#pragma once
-
#if THRUST_DEVICE_COMPILER == THRUST_DEVICE_COMPILER_HCC
#include <thrust/distance.h>
+#include <thrust/iterator/counting_iterator.h>
#include <thrust/system/hip/config.h>
-#include <thrust/system/hip/execution_policy.h>
+#include <thrust/system/hip/detail/execution_policy.h>
#include <thrust/system/hip/detail/transform.h>
BEGIN_NS_THRUST

Implement fill and fill_n