MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / createLaunchConfig1D

Method createLaunchConfig1D

extensions/include/cuMat/src/Context.h:366–393  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364 */
365 template<class T>
366 KernelLaunchConfig createLaunchConfig1D(Index size, T func) const
367 {
368 const unsigned int size_ = static_cast<unsigned int>(size);
369 CUMAT_ASSERT_ARGUMENT(size > 0);
370 CUMAT_ASSERT(Index(size_) == size && "size exceeds the range of unsigned int!");
371#if 0
372 //Very simplistic first version
373 unsigned int blockSize = 256u;
374 KernelLaunchConfig cfg = {
375 dim3(size, 1, 1),
376 dim3(blockSize, 1, 1),
377 dim3(CUMAT_DIV_UP(size, blockSize), 1, 1)
378 };
379 return cfg;
380#else
381 //Improved version using cudaOccupancyMaxPotentialBlockSize
382 int minGridSize = 0, bestBlockSize = 0;
383 CUMAT_SAFE_CALL(cudaOccupancyMaxPotentialBlockSize(&minGridSize, &bestBlockSize, func));
384 minGridSize = std::min(int(CUMAT_DIV_UP(size_, bestBlockSize)), minGridSize);
385 CUMAT_LOG_DEBUG("Best potential occupancy for " << typeid(T).name() << " found to be: blocksize=" << bestBlockSize << ", gridSize=" << minGridSize);
386 KernelLaunchConfig cfg = {
387 dim3(size_, 1, 1),
388 dim3(bestBlockSize, 1, 1),
389 dim3(minGridSize, 1, 1)
390 };
391 return cfg;
392#endif
393 }
394
395 /**
396 * \brief Returns the kernel launch configurations for a 2D launch.

Callers 8

CwiseOp.hFile · 0.80
evalMethod · 0.80
evalMethod · 0.80
assignFunction · 0.80
evalImplMethod · 0.80
evalImplMethod · 0.80
runMethod · 0.80
fillUniformMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected