Skip to content

Commit 2099274

Browse files
Addressed PR review feedback
1 parent 5c327b4 commit 2099274

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

examples/axes.cu

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void copy_sweep_grid_shape(nvbench::state &state)
6868
state.add_global_memory_writes<nvbench::int32_t>(num_values);
6969

7070
// Allocate device memory:
71-
thrust::device_vector<nvbench::int32_t> in(num_values, 0);
71+
thrust::device_vector<nvbench::int32_t> in(num_values, 1);
7272
thrust::device_vector<nvbench::int32_t> out(num_values, 0);
7373

7474
state.exec([block_size,
@@ -102,7 +102,7 @@ void copy_type_sweep(nvbench::state &state, nvbench::type_list<ValueType>)
102102
state.add_global_memory_writes<ValueType>(num_values);
103103

104104
// Allocate device memory:
105-
thrust::device_vector<ValueType> in(num_values, 0);
105+
thrust::device_vector<ValueType> in(num_values, ValueType{17});
106106
thrust::device_vector<ValueType> out(num_values, 0);
107107

108108
state.exec([num_values,
@@ -173,18 +173,19 @@ NVBENCH_BENCH_TYPES(copy_type_conversion_sweep, NVBENCH_TYPE_AXES(ctcs_types, ct
173173
.set_type_axes_names({"In", "Out"});
174174

175175
// ==================================================================================
176-
// Passing `type_list` of typenames, and `enum_type_list` to build cartesian product
176+
// Passing list of typenames and `enum_type_list` to build cartesian product
177177
// of typenames and integral constants
178178

179-
template <typename ValueT, uint BLOCK_DIM>
179+
template <typename ValueT, unsigned BLOCK_DIM>
180180
void copy_type_and_block_size_sweep(nvbench::state &state,
181181
nvbench::type_list<ValueT, nvbench::enum_type<BLOCK_DIM>>)
182182
{
183183
const std::size_t nelems = 256 * 1024 * 1024 / sizeof(ValueT);
184-
thrust::device_vector<ValueT> inp(nelems);
185-
thrust::device_vector<ValueT> out(nelems);
184+
ValueT fill_value{42};
185+
thrust::device_vector<ValueT> inp(nelems, fill_value);
186+
thrust::device_vector<ValueT> out(nelems, ValueT{});
186187

187-
const uint gridSize = (nelems + BLOCK_DIM - 1) / BLOCK_DIM;
188+
const uint gridSize = cuda::ceil_div(nelems, BLOCK_DIM);
188189

189190
const ValueT *inp_p = thrust::raw_pointer_cast(inp.data());
190191
ValueT *out_p = thrust::raw_pointer_cast(out.data());
@@ -198,8 +199,6 @@ void copy_type_and_block_size_sweep(nvbench::state &state,
198199
});
199200
}
200201

201-
using types_list =
202-
nvbench::type_list<nvbench::int8_t, nvbench::int16_t, nvbench::int32_t, nvbench::int64_t>;
203202
using block_sizes = nvbench::enum_type_list<64u, 128u, 196u, 256u, 320u, 512u>;
204-
NVBENCH_BENCH_TYPES(copy_type_and_block_size_sweep, NVBENCH_TYPE_AXES(types_list, block_sizes))
203+
NVBENCH_BENCH_TYPES(copy_type_and_block_size_sweep, NVBENCH_TYPE_AXES(ctcs_types, block_sizes))
205204
.set_type_axes_names({"Type", "BlockSize"});

0 commit comments

Comments
 (0)