matt-pielat
matt-pielat

Reputation: 1799

Maximum x dimension of the grid is too low

deviceQuery tool gives me this information among other things:

CUDA Driver Version / Runtime Version          9.1 / 8.0
CUDA Capability Major/Minor version number:    5.0
Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)

When I create the default CUDA 8.0 project in Visual Studio 2015 and change kernel call from:

addKernel<<<1, size>>>(dev_c, dev_a, dev_b);

to

addKernel<<<dim3(65535, 1, 1), size>>>(dev_c, dev_a, dev_b);

it still works. But when change the x-dimension of the grid to 65536 like this:

addKernel<<<dim3(65536, 1, 1), size>>>(dev_c, dev_a, dev_b);

I get cudaErrorInvalidValue (11) which means "invalid argument". Why?

(I have only one CUDA-capable device on the machine, so I'm not confusing it with some other one)

Upvotes: 0

Views: 35

Answers (1)

matt-pielat
matt-pielat

Reputation: 1799

It seems that by default Visual Studio sets the build flags to compute capability 2.0.

To change them:

  1. Open the project's Properties page
  2. Under CUDA C/C++ select Device tab
  3. Change Code Generation value from compute_20,sm_20 to whatever your graphic card supports. In my case it's compute_50,sm_50.

Upvotes: 1

Related Questions