diff --git a/cuda-stream.cu b/cuda-stream.cu index 684e0ed..c51340a 100644 --- a/cuda-stream.cu +++ b/cuda-stream.cu @@ -150,22 +150,22 @@ 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); if (NTIMES < 2) throw badntimes(); + 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; + } + // Check device index is in range int count; cudaGetDeviceCount(&count);