10 #ifndef NEW_REDUCE_CUDA_REDUCE_HPP
11 #define NEW_REDUCE_CUDA_REDUCE_HPP
13 #if defined(RAJA_CUDA_ACTIVE)
30 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
31 camp::concepts::enable_if<RAJA::type_traits::is_cuda_policy<EXEC_POL>>
33 Reducer<OP, T, VOp>& red,
34 RAJA::cuda::detail::cudaInfo& ci)
37 RAJA::cuda::pinned_mempool_type::getInstance().template malloc<T>(1);
38 red.device_mem.allocate(ci.gridDim.x * ci.gridDim.y * ci.gridDim.z);
39 red.device_count = RAJA::cuda::device_zeroed_mempool_type::getInstance()
40 .template malloc<unsigned int>(1);
44 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
49 RAJA::cuda::impl::expt::grid_reduce<typename EXEC_POL::IterationGetter, OP>(
50 red.devicetarget, red.getVal(), red.device_mem, red.device_count);
54 template<
typename EXEC_POL,
typename OP,
typename T,
typename VOp>
55 camp::concepts::enable_if<RAJA::type_traits::is_cuda_policy<EXEC_POL>>
57 Reducer<OP, T, VOp>& red,
58 RAJA::cuda::detail::cudaInfo& ci)
63 red.combineTarget(*red.devicetarget);
66 RAJA::cuda::device_zeroed_mempool_type::getInstance().free(red.device_count);
67 red.device_count =
nullptr;
68 red.device_mem.deallocate();
69 RAJA::cuda::pinned_mempool_type::getInstance().free(red.devicetarget);
70 red.devicetarget =
nullptr;
Header file defining prototypes for routines used to manage memory for CUDA reductions and other oper...
Header file containing RAJA CUDA policy definitions.
#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 CUDA execution.
Definition: PolicyBase.hpp:224