From b78fd8bc699dc67c220c1fe12979a8088cdc96c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Mon, 2 Dec 2024 09:39:21 +0100 Subject: [PATCH] add missing wait to get correct timer information (#2432) The wait was missing which results into wrong timings in cases where the example was changed to use a asynchron queue. The time for the memcopies before the operations was part of the kernel execution time. --- example/vectorAdd/src/vectorAdd.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/example/vectorAdd/src/vectorAdd.cpp b/example/vectorAdd/src/vectorAdd.cpp index 1d50ea32c55..53d4f0bddea 100644 --- a/example/vectorAdd/src/vectorAdd.cpp +++ b/example/vectorAdd/src/vectorAdd.cpp @@ -142,9 +142,12 @@ auto example(TAccTag const&) -> int // Enqueue the kernel execution task { + // wait in case we are using an asynchronous queue to time actual kernel runtime + alpaka::wait(queue); auto const beginT = std::chrono::high_resolution_clock::now(); alpaka::enqueue(queue, taskKernel); - alpaka::wait(queue); // wait in case we are using an asynchronous queue to time actual kernel runtime + // wait in case we are using an asynchronous queue to time actual kernel runtime + alpaka::wait(queue); auto const endT = std::chrono::high_resolution_clock::now(); std::cout << "Time for kernel execution: " << std::chrono::duration(endT - beginT).count() << 's' << std::endl;