10 #ifndef NEW_REDUCE_HIP_REDUCE_HPP
11 #define NEW_REDUCE_HIP_REDUCE_HPP
13 #if defined(RAJA_HIP_ACTIVE)
15 #include <hip/hip_runtime.h>
28 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
29 camp::concepts::enable_if<RAJA::type_traits::is_hip_policy<EXEC_POL>>
31 Reducer<OP, T, VOp>& red,
32 RAJA::hip::detail::hipInfo& hi)
35 RAJA::hip::pinned_mempool_type::getInstance().template malloc<T>(1);
36 red.device_mem.allocate(hi.gridDim.x * hi.gridDim.y * hi.gridDim.z);
37 red.device_count = RAJA::hip::device_zeroed_mempool_type::getInstance()
38 .template malloc<unsigned int>(1);
42 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
47 RAJA::hip::impl::expt::grid_reduce<typename EXEC_POL::IterationGetter, OP>(
48 red.devicetarget, red.getVal(), red.device_mem, red.device_count);
52 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
53 camp::concepts::enable_if<RAJA::type_traits::is_hip_policy<EXEC_POL>>
55 Reducer<OP, T, VOp>& red,
56 RAJA::hip::detail::hipInfo& hi)
61 red.combineTarget(*red.devicetarget);
64 RAJA::hip::device_zeroed_mempool_type::getInstance().free(red.device_count);
65 red.device_count =
nullptr;
66 red.device_mem.deallocate();
67 RAJA::hip::pinned_mempool_type::getInstance().free(red.devicetarget);
68 red.devicetarget =
nullptr;
Header file defining prototypes for routines used to manage memory for HIP reductions and other opera...
#define RAJA_HOST_DEVICE
Definition: macros.hpp:65
camp::concepts::enable_if< std::is_same< EXEC_POL, RAJA::seq_exec > > param_init(EXEC_POL const &, RAJA::detail::Name &)
Definition: kernel_name.hpp:24
camp::concepts::enable_if< concepts::negate< is_instance_of_Reducer< camp::decay< T > > >, concepts::negate< std::is_same< T, RAJA::detail::Name > > > param_combine(EXEC_POL const &, T &, const T &)
Definition: forall.hpp:97
camp::concepts::enable_if< std::is_same< EXEC_POL, RAJA::seq_exec > > param_resolve(EXEC_POL const &, RAJA::detail::Name &)
Definition: kernel_name.hpp:40
Definition: AlignedRangeIndexSetBuilders.cpp:35
Header file containing RAJA reduction templates for HIP execution.
Definition: PolicyBase.hpp:228