From 9a1dc7c9f21781352624c017487904adb60c0214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Widera?= Date: Thu, 28 Nov 2024 10:08:51 +0100 Subject: [PATCH] add missing wait to get correct timer information 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;