You have to specify block size in CUDA, so make sure ARRAY_SIZE divides 1024

This commit is contained in:
Tom Deakin 2015-07-16 18:06:07 +01:00
parent 9da2cd6d09
commit 2c2dbf2c3f

View File

@ -131,6 +131,16 @@ int main(int argc, char *argv[])
<< "Version: " << VERSION_STRING << std::endl << "Version: " << VERSION_STRING << std::endl
<< "Implementation: CUDA" << std::endl << 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 try
{ {
parseArguments(argc, argv); parseArguments(argc, argv);