diff --git a/SYCLStream.cpp b/SYCLStream.cpp index e8eee42..4f14590 100644 --- a/SYCLStream.cpp +++ b/SYCLStream.cpp @@ -24,6 +24,14 @@ SYCLStream::SYCLStream(const unsigned int ARRAY_SIZE, const int device_index) if (!cached) getDeviceList(); + // The array size must be divisible by WGSIZE + if (ARRAY_SIZE % WGSIZE != 0) + { + std::stringstream ss; + ss << "Array size must be a multiple of " << WGSIZE; + throw std::runtime_error(ss.str()); + } + array_size = ARRAY_SIZE; if (device_index >= devices.size()) diff --git a/SYCLStream.h b/SYCLStream.h index 4c0c681..8bc515d 100644 --- a/SYCLStream.h +++ b/SYCLStream.h @@ -7,6 +7,8 @@ #pragma once +#include + #include "Stream.h" #include "CL/sycl.hpp"