From d9392e6454586d46397cc609674d8d5d732483a5 Mon Sep 17 00:00:00 2001 From: gonidelis Date: Mon, 15 Jul 2024 15:01:22 -0700 Subject: [PATCH] Fix BWUtil report on early exit --- thrust/benchmarks/bench/equal/basic.cu | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thrust/benchmarks/bench/equal/basic.cu b/thrust/benchmarks/bench/equal/basic.cu index 25ec83634b..a88890e13f 100644 --- a/thrust/benchmarks/bench/equal/basic.cu +++ b/thrust/benchmarks/bench/equal/basic.cu @@ -21,7 +21,10 @@ static void benchmark(nvbench::state& state, nvbench::type_list) thrust::fill(policy(alloc), b.begin() + different_elems, b.end(), T{2}); state.add_element_count(elements); - state.add_global_memory_reads(2 * elements); + state.add_global_memory_reads(std::max(2 * different_elems, std::size_t(1))); // using `different_elements` instead + // of `elements` corresponds to the + // actual elements read in an early + // exit state.exec(nvbench::exec_tag::no_batch | nvbench::exec_tag::sync, [&](nvbench::launch&) { do_not_optimize(thrust::equal(policy(alloc), a.begin(), a.end(), b.begin())); });