Fix build break for microbench. (#4960)

This commit is contained in:
Zhang Lei 2020-08-31 23:29:07 -07:00 committed by GitHub
parent 14b51d6502
commit cf1b74396a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,11 +110,11 @@ static void BM_SimpleScheduleWait(benchmark::State& state) {
tpo.auto_set_affinity = true;
tpo.thread_pool_size = 0;
std::unique_ptr<concurrency::ThreadPool> tp(concurrency::CreateThreadPool(&onnxruntime::Env::Default(), tpo, ThreadPoolType::INTRA_OP));
size_t threads = tp->NumThreads();
std::ptrdiff_t threads = concurrency::ThreadPool::DegreeOfParallelism(tp.get());
for (auto _ : state) {
onnxruntime::Barrier barrier(static_cast<unsigned int>(threads));
for (std::ptrdiff_t id = 0; id < static_cast<std::ptrdiff_t>(threads); ++id) {
for (std::ptrdiff_t id = 0; id < threads; ++id) {
tp->Schedule([id, threads, len, &barrier]() {
std::ptrdiff_t start, work_remaining;
TestPartitionWork(id, threads, len, &start, &work_remaining);
@ -182,4 +182,4 @@ BENCHMARK(BM_SimpleScheduleWaitWindowsTP)
->Arg(160000)
->Arg(320000)
->Arg(640000);
#endif
#endif