Skip to content

Commit

Permalink
For a single thread acc if the WorkDiv number of threads per block is…
Browse files Browse the repository at this point in the history
… more than one, throw a runtime error
  • Loading branch information
ikbuibui authored and psychocoderHPC committed Sep 24, 2024
1 parent 4301981 commit 1bff084
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/alpaka/acc/AccCpuOmp2Blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,13 @@ namespace alpaka
TKernelFnObj const& kernelFnObj,
TArgs&&... args)
{
if(workDiv.m_blockThreadExtent.prod() != static_cast<TIdx>(1u))
{
throw std::runtime_error(
"The given work division is not valid for a single thread Acc: "
+ getAccName<AccCpuOmp2Blocks<TDim, TIdx>>() + ". Threads per block should be 1!");
}

return TaskKernelCpuOmp2Blocks<TDim, TIdx, TKernelFnObj, TArgs...>(
workDiv,
kernelFnObj,
Expand Down
7 changes: 7 additions & 0 deletions include/alpaka/acc/AccCpuSerial.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,13 @@ namespace alpaka
TKernelFnObj const& kernelFnObj,
TArgs&&... args)
{
if(workDiv.m_blockThreadExtent.prod() != static_cast<TIdx>(1u))
{
throw std::runtime_error(
"The given work division is not valid for a single thread Acc: "
+ getAccName<AccCpuSerial<TDim, TIdx>>() + ". Threads per block should be 1!");
}

return TaskKernelCpuSerial<TDim, TIdx, TKernelFnObj, TArgs...>(
workDiv,
kernelFnObj,
Expand Down
7 changes: 7 additions & 0 deletions include/alpaka/acc/AccCpuTbbBlocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,13 @@ namespace alpaka
TKernelFnObj const& kernelFnObj,
TArgs&&... args)
{
if(workDiv.m_blockThreadExtent.prod() != static_cast<TIdx>(1u))
{
throw std::runtime_error(
"The given work division is not valid for a single thread Acc: "
+ getAccName<AccCpuTbbBlocks<TDim, TIdx>>() + ". Threads per block should be 1!");
}

return TaskKernelCpuTbbBlocks<TDim, TIdx, TKernelFnObj, TArgs...>(
workDiv,
kernelFnObj,
Expand Down

0 comments on commit 1bff084

Please sign in to comment.