| 305 | |
| 306 | |
| 307 | qindex gpu_getMaxNumConcurrentThreads() { |
| 308 | #if COMPILE_CUDA |
| 309 | assert_gpuHasBeenBound(hasGpuBeenBound); |
| 310 | |
| 311 | int deviceId = getBoundGpuId(); |
| 312 | |
| 313 | // this may differ between nodes (which have different GPUs), which is fine |
| 314 | int maxThreadsPerBlock; |
| 315 | int maxNumBlocks; |
| 316 | CUDA_CHECK( cudaDeviceGetAttribute(&maxThreadsPerBlock, cudaDevAttrMaxThreadsPerBlock, deviceId) ); |
| 317 | CUDA_CHECK( cudaDeviceGetAttribute(&maxNumBlocks, cudaDevAttrMultiProcessorCount, deviceId) ); |
| 318 | |
| 319 | return maxThreadsPerBlock * static_cast<qindex>(maxNumBlocks); // avoid overflow |
| 320 | |
| 321 | #else |
| 322 | error_gpuQueriedButGpuNotCompiled(); |
| 323 | return -1; |
| 324 | #endif |
| 325 | } |
| 326 | |
| 327 | |
| 328 |
no test coverage detected