| 403 | */ |
| 404 | template<class T> |
| 405 | KernelLaunchConfig createLaunchConfig2D(unsigned int sizex, unsigned int sizey, T func) const |
| 406 | { |
| 407 | CUMAT_ASSERT_ARGUMENT(sizex > 0); |
| 408 | CUMAT_ASSERT_ARGUMENT(sizey > 0); |
| 409 | int minGridSize = 0, bestBlockSize = 0; |
| 410 | CUMAT_SAFE_CALL(cudaOccupancyMaxPotentialBlockSize(&minGridSize, &bestBlockSize, func)); |
| 411 | CUMAT_LOG_DEBUG("Best potential occupancy for " << typeid(T).name() << " found to be: blocksize=" << bestBlockSize << ", gridSize=" << minGridSize); |
| 412 | KernelLaunchConfig cfg = { |
| 413 | dim3(sizex, sizey, 1), |
| 414 | dim3(bestBlockSize, 1, 1), |
| 415 | dim3(minGridSize, 1, 1) |
| 416 | }; |
| 417 | return cfg; |
| 418 | } |
| 419 | |
| 420 | /** |
| 421 | * \brief Returns the kernel launch configurations for a 3D launch. |