Skip to content

Commit

Permalink
Add thread count to CPU blocks accelerators (#2338)
Browse files Browse the repository at this point in the history
Add thread count of a CPU as m_multiProcessorCount for CPU blocks accelerators.
  • Loading branch information
MichaelVarvarin authored Aug 4, 2024
1 parent dbc5ebe commit 2d652dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion include/alpaka/acc/AccCpuOmp2Blocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Implementation details.
#include "alpaka/acc/Tag.hpp"
#include "alpaka/core/ClipCast.hpp"
#include "alpaka/core/Concepts.hpp"
#include "alpaka/dev/DevCpu.hpp"

Expand Down Expand Up @@ -135,7 +136,7 @@ namespace alpaka
ALPAKA_FN_HOST static auto getAccDevProps(DevCpu const& dev) -> alpaka::AccDevProps<TDim, TIdx>
{
return {// m_multiProcessorCount
static_cast<TIdx>(1),
alpaka::core::clipCast<TIdx>(omp_get_max_threads()),
// m_gridBlockExtentMax
Vec<TDim, TIdx>::all(std::numeric_limits<TIdx>::max()),
// m_gridBlockCountMax
Expand Down
5 changes: 4 additions & 1 deletion include/alpaka/acc/AccCpuTbbBlocks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

// Implementation details.
#include "alpaka/acc/Tag.hpp"
#include "alpaka/core/ClipCast.hpp"
#include "alpaka/core/Concepts.hpp"
#include "alpaka/dev/DevCpu.hpp"

Expand All @@ -40,6 +41,8 @@

#ifdef ALPAKA_ACC_CPU_B_TBB_T_SEQ_ENABLED

# include <tbb/tbb.h>

namespace alpaka
{
template<typename TDim, typename TIdx, typename TKernelFnObj, typename... TArgs>
Expand Down Expand Up @@ -127,7 +130,7 @@ namespace alpaka
ALPAKA_FN_HOST static auto getAccDevProps(DevCpu const& dev) -> AccDevProps<TDim, TIdx>
{
return {// m_multiProcessorCount
static_cast<TIdx>(1),
alpaka::core::clipCast<TIdx>(tbb::this_task_arena::max_concurrency()),
// m_gridBlockExtentMax
Vec<TDim, TIdx>::all(std::numeric_limits<TIdx>::max()),
// m_gridBlockCountMax
Expand Down

0 comments on commit 2d652dd

Please sign in to comment.