alpaka icon indicating copy to clipboard operation
alpaka copied to clipboard

Factory method for simplification of workdiv creation

Open mehmetyusufoglu opened this issue 1 year ago • 1 comments

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);

mehmetyusufoglu avatar Feb 19 '24 12:02 mehmetyusufoglu

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.

bernhardmgruber avatar Feb 20 '24 09:02 bernhardmgruber

we need to fix the OSX CI before we can merge this.

psychocoderHPC avatar Feb 26 '24 10:02 psychocoderHPC

@mehmetyusufoglu could you please rebase this against the develop branch? I merged the OSX CI fix

psychocoderHPC avatar Feb 27 '24 08:02 psychocoderHPC