alpaka
alpaka copied to clipboard
Factory method for simplification of workdiv creation
Workdiv creation has 2 template parameters.
auto const workdiv = alpaka::WorkDivMembers<Dim, Idx>{arraySize / blockSize, (int)blockSize, 1u};
The aim is being able to call it without template parameters, for example
auto const workdiv = alpaka::createWorkDiv(arraySize / blockSize, blockSize, 1);
Just tried it, if you add the constructor:
ALPAKA_FN_HOST_ACC WorkDivMembers(
alpaka::Vec<TDim, TIdx> const& gridBlockExtent,
alpaka::Vec<TDim, TIdx> const& blockThreadExtent,
alpaka::Vec<TDim, TIdx> const& elemExtent)
: m_gridBlockExtent(gridBlockExtent)
, m_blockThreadExtent(blockThreadExtent)
, m_threadElemExtent(elemExtent)
{
}
your unit test can be written using:
auto ref = alpaka::WorkDivMembers(blocksPerGrid3D, threadsPerBlock3D, elementsPerThread3D);
and compiles and passes the tests.
we need to fix the OSX CI before we can merge this.
@mehmetyusufoglu could you please rebase this against the develop branch? I merged the OSX CI fix