MCPcopy Create free account
hub / github.com/QuEST-Kit/QuEST / gpu_getMaxNumConcurrentThreads

Function gpu_getMaxNumConcurrentThreads

quest/src/gpu/gpu_config.cpp:307–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

305
306
307qindex 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

Calls 3

assert_gpuHasBeenBoundFunction · 0.85
getBoundGpuIdFunction · 0.85

Tested by

no test coverage detected