Skip to content

Commit

Permalink
fixup: fixup: threadpool: make user's choice of threads in runtime as…
Browse files Browse the repository at this point in the history
… primary
  • Loading branch information
dzarukin authored and vpirogov committed Dec 7, 2021
1 parent 8b9a89b commit 6aa6f95
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/test_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,16 @@ class threadpool : public dnnl::threadpool_interop::threadpool_iface {
#include "tbb/parallel_for.h"
#include "tbb/task_arena.h"

#include "src/cpu/platform.hpp"
namespace dnnl {
namespace testing {

class threadpool : public dnnl::threadpool_interop::threadpool_iface {
public:
explicit threadpool(int num_threads = 0) { (void)num_threads; }
int get_num_threads() const override {
return tbb::this_task_arena::max_concurrency();
return std::min(tbb::this_task_arena::max_concurrency(),
(int)dnnl::impl::cpu::platform::get_max_threads_to_use());
}
bool get_in_parallel() const override { return 0; }
uint64_t get_flags() const override { return 0; }
Expand Down

0 comments on commit 6aa6f95

Please sign in to comment.