MCPcopy Create free account
hub / github.com/ROCm/rocPRIM / example_shared_memory

Function example_shared_memory

example/extra/example_temporary_storage.cpp:33–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31template<const unsigned int BlockSize, class T>
32__global__ __launch_bounds__(BlockSize)
33void example_shared_memory(const T* input, T* output)
34{
35 // Indexing for this block
36 unsigned int index = (blockIdx.x * BlockSize) + threadIdx.x;
37
38 // Allocating storage in shared memory for the block
39 using block_scan_type = rocprim::block_scan<T, BlockSize>;
40 __shared__ typename block_scan_type::storage_type storage;
41
42 // Variables required for performing a scan
43 T input_value, output_value;
44
45 // Execute inclusive plus scan
46 input_value = input[index];
47
48 block_scan_type().inclusive_scan(input_value, output_value, storage, rocprim::plus<T>());
49
50 output[index] = output_value;
51}
52
53// Host function that runs example_shared_memory kernel
54template<class T>

Callers

nothing calls this directly

Calls 1

inclusive_scanMethod · 0.45

Tested by

no test coverage detected