mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-29 23:06:41 +00:00
Revert ""Sticky" allocation of worker threads (#7372)"
This reverts commit 3d92723d1c.
This commit is contained in:
parent
9ba9da0c95
commit
9c1900866a
2 changed files with 362 additions and 533 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -168,7 +168,6 @@ void TestPoolCreation(const std::string&, int iter) {
|
|||
ASSERT_EQ(ctr, iter * per_iter);
|
||||
}
|
||||
|
||||
// Test multi-loop parallel sections, with a series of fixed-size loops
|
||||
void TestMultiLoopSections(const std::string& name, int num_threads, int num_loops) {
|
||||
for (int rep = 0; rep < 5; rep++) {
|
||||
const int num_tasks = 1024;
|
||||
|
|
@ -187,35 +186,6 @@ void TestMultiLoopSections(const std::string& name, int num_threads, int num_loo
|
|||
}
|
||||
}
|
||||
|
||||
// Test multi-loop parallel sections, with alternating larger and
|
||||
// smaller loops. This helps test that we can dispatch work to
|
||||
// differing numbers of threads over time.
|
||||
void TestStagedMultiLoopSections(const std::string& name, int num_threads, int num_loops) {
|
||||
for (int rep = 0; rep < 5; rep++) {
|
||||
auto test_data1 = CreateTestData(num_threads/2);
|
||||
auto test_data2 = CreateTestData(num_threads);
|
||||
CreateThreadPoolAndTest(name, num_threads, [&](ThreadPool* tp) {
|
||||
ThreadPool::ParallelSection ps(tp);
|
||||
for (int l = 0; l < num_loops; l++) {
|
||||
// Loop needing few threads
|
||||
ThreadPool::TrySimpleParallelFor(tp,
|
||||
num_threads / 2,
|
||||
[&](std::ptrdiff_t i) {
|
||||
IncrementElement(*test_data1, i);
|
||||
});
|
||||
// Loop needing more threads, forcing growth of set of threads in use
|
||||
ThreadPool::TrySimpleParallelFor(tp,
|
||||
num_threads,
|
||||
[&](std::ptrdiff_t i) {
|
||||
IncrementElement(*test_data2, i);
|
||||
});
|
||||
}
|
||||
});
|
||||
ValidateTestData(*test_data1, num_loops);
|
||||
ValidateTestData(*test_data2, num_loops);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace onnxruntime {
|
||||
|
|
@ -381,10 +351,6 @@ TEST(ThreadPoolTest, TestMultiLoopSections_1Thread_1Loop) {
|
|||
TestMultiLoopSections("TestMultiLoopSections_1Thread_1Loop", 1, 1);
|
||||
}
|
||||
|
||||
TEST(ThreadPoolTest, TestMultiLoopSections_1Thread_2Loop) {
|
||||
TestMultiLoopSections("TestMultiLoopSections_1Thread_2Loop", 1, 2);
|
||||
}
|
||||
|
||||
TEST(ThreadPoolTest, TestMultiLoopSections_2Thread_0Loop) {
|
||||
TestMultiLoopSections("TestMultiLoopSections_2Thread_0Loop", 2, 0);
|
||||
}
|
||||
|
|
@ -413,17 +379,6 @@ TEST(ThreadPoolTest, TestMultiLoopSections_4Thread_100Loop) {
|
|||
TestMultiLoopSections("TestMultiLoopSections_4Thread_100Loop", 4, 100);
|
||||
}
|
||||
|
||||
TEST(ThreadPoolTest, TestStagedMultiLoopSections_4Thread_1Loop) {
|
||||
TestStagedMultiLoopSections("TestStagedMultiLoopSections_4Thread_1Loop", 4, 1);
|
||||
}
|
||||
|
||||
TEST(ThreadPoolTest, TestStagedMultiLoopSections_4Thread_10Loop) {
|
||||
TestStagedMultiLoopSections("TestStagedMultiLoopSections_4Thread_10Loop", 4, 10);
|
||||
}
|
||||
|
||||
TEST(ThreadPoolTest, TestStagedMultiLoopSections_4Thread_100Loop) {
|
||||
TestStagedMultiLoopSections("TestStagedMultiLoopSections_4Thread_100Loop", 4, 100);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 6387)
|
||||
|
|
|
|||
Loading…
Reference in a new issue