diff --git a/CHANGELOG.md b/CHANGELOG.md index 3495f2f..52949de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file. ### Changed - Default branch renamed from `master` to `main`. +- Driver now delays allocating large checking vectors until after computation has finished. - Use cl::sycl::id parameters instead of cl::sycl::item. - Update local copy of OpenCL C++ header file. - Ensure correct SYCL queue constructor with explicit async_handler. diff --git a/main.cpp b/main.cpp index d1031cf..6d2f679 100644 --- a/main.cpp +++ b/main.cpp @@ -130,14 +130,6 @@ void run() } - // Create host vectors - std::vector a(ARRAY_SIZE); - std::vector b(ARRAY_SIZE); - std::vector c(ARRAY_SIZE); - - // Result of the Dot kernel - T sum; - Stream *stream; #if defined(CUDA) @@ -184,6 +176,9 @@ void run() stream->init_arrays(startA, startB, startC); + // Result of the Dot kernel + T sum; + // List of times std::vector> timings(5); @@ -226,6 +221,11 @@ void run() } // Check solutions + // Create host vectors + std::vector a(ARRAY_SIZE); + std::vector b(ARRAY_SIZE); + std::vector c(ARRAY_SIZE); + stream->read_arrays(a, b, c); check_solution(num_times, a, b, c, sum); @@ -338,11 +338,6 @@ void run_triad() std::cout.precision(ss); } - // Create host vectors - std::vector a(ARRAY_SIZE); - std::vector b(ARRAY_SIZE); - std::vector c(ARRAY_SIZE); - Stream *stream; #if defined(CUDA) @@ -399,7 +394,13 @@ void run_triad() double runtime = std::chrono::duration_cast >(t2 - t1).count(); // Check solutions + // Create host vectors + std::vector a(ARRAY_SIZE); + std::vector b(ARRAY_SIZE); + std::vector c(ARRAY_SIZE); + T sum = 0.0; + stream->read_arrays(a, b, c); check_solution(num_times, a, b, c, sum);