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

Function get_expected_output

example/example_utils.hpp:100–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98// Generating expected output for block scan when using rocprim::plus as function
99template<class T>
100std::vector<T> get_expected_output(
101 const std::vector<T> &host_input,
102 const unsigned int block_size,
103 const unsigned int items_per_thread = 1)
104{
105 unsigned int grid_size = host_input.size() / block_size;
106 std::vector<T> host_expected_output(host_input.size());
107 for(unsigned int block_index = 0; block_index < (grid_size / items_per_thread); block_index++)
108 {
109 host_expected_output[block_index * block_size] = host_input[block_index * block_size];
110 for(unsigned int thread_index = 1; thread_index < (block_size * items_per_thread); thread_index++)
111 {
112 int index = block_index * block_size + thread_index;
113 host_expected_output[index] = host_expected_output[index - 1] + host_input[index];
114 }
115 }
116 return host_expected_output;
117}
118
119#endif // ROCPRIM_EXAMPLE_UTILS_HPP_

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected