CUDA bug: ARRAY_SIZE on CLI not being resized

The ARRAY_SIZE was being resized before the CLI args were read
This commit is contained in:
Tom Deakin 2015-07-27 16:49:36 +01:00
parent a74e7cee4c
commit ec9d73b8d5

View File

@ -150,6 +150,12 @@ 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;
try
{
parseArguments(argc, argv);
if (NTIMES < 2) throw badntimes();
if (ARRAY_SIZE % 1024 != 0) if (ARRAY_SIZE % 1024 != 0)
{ {
unsigned int OLD_ARRAY_SIZE = ARRAY_SIZE; unsigned int OLD_ARRAY_SIZE = ARRAY_SIZE;
@ -160,12 +166,6 @@ int main(int argc, char *argv[])
<< " to " << ARRAY_SIZE << std::endl; << " to " << ARRAY_SIZE << std::endl;
} }
try
{
parseArguments(argc, argv);
if (NTIMES < 2) throw badntimes();
// Check device index is in range // Check device index is in range
int count; int count;
cudaGetDeviceCount(&count); cudaGetDeviceCount(&count);