From 2c2dbf2c3f7c69d059435dd638f90d3220748cc2 Mon Sep 17 00:00:00 2001 From: Tom Deakin Date: Thu, 16 Jul 2015 18:06:07 +0100 Subject: [PATCH] You have to specify block size in CUDA, so make sure ARRAY_SIZE divides 1024 --- cuda-stream.cu | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cuda-stream.cu b/cuda-stream.cu index cb2edfb..bf3d5af 100644 --- a/cuda-stream.cu +++ b/cuda-stream.cu @@ -131,6 +131,16 @@ int main(int argc, char *argv[]) << "Version: " << VERSION_STRING << std::endl << "Implementation: CUDA" << std::endl << std::endl; + if (ARRAY_SIZE % 1024 != 0) + { + unsigned int OLD_ARRAY_SIZE = ARRAY_SIZE; + ARRAY_SIZE -= ARRAY_SIZE % 1024; + std::cout + << "Warning: array size must divide 1024" << std::endl + << "Resizing array from " << OLD_ARRAY_SIZE + << " to " << ARRAY_SIZE << std::endl; + } + try { parseArguments(argc, argv);