cudaDeviceProp.maxThreadsPerMultiProcessor is 0 Geforce G80 Compute Compatibility 1.1

I wanted to move from Cuda 3.2 to Cuda 4.0 so that I can access the field:

cudaDeviceProp.maxThreadsPerMultiProcessor

but on my G80 this is 0, but it should be 786.

I want to retrieve this programmatically, so that i can create optimal threads per block for different gpu’s.

Is this not retrievable on compute 1.1 cards ?

This is a small bug in the current version of the JCuda Runtime bindings, and will be fixed in the next release.

In the meantime, you may use the following workaround with the driver API:

import jcuda.driver.*;

import static jcuda.driver.JCudaDriver.*;

import static jcuda.driver.CUdevice_attribute.*;

...

private static int getMaxThreadsPerMultiprocessor(int deviceIndex)

{

    cuInit(0);

    CUdevice device = new CUdevice();

    cuDeviceGet(device, deviceIndex);

    int array[] = {0};

    cuDeviceGetAttribute(array, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_MULTIPROCESSOR, device);

    return array[0];

}

Ah thanks, good I asked you too :)