Skip to content

Commit a3f6fe1

Browse files
authored
Revert "Disable thread pool creation when enabled OpenMP (#2485)"
This reverts commit 7c7d5a1.
1 parent 178d059 commit a3f6fe1

File tree

5 files changed

+2
-15
lines changed

5 files changed

+2
-15
lines changed

onnxruntime/core/framework/session_options.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct SessionOptions {
5555
TransformerLevel graph_optimization_level = TransformerLevel::Level1;
5656

5757
// controls the size of the thread pool used to parallelize the execution of tasks within individual nodes (ops)
58-
// if OpenMP is enabled, this configuration will be ignored
5958
int intra_op_num_threads = 0;
6059

6160
// controls the size of the thread pool used to parallelize the execution of nodes (ops)

onnxruntime/core/session/inference_session.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,8 @@ InferenceSession::InferenceSession(const SessionOptions& session_options,
102102
: session_options_(session_options),
103103
graph_transformation_mgr_(session_options.max_num_graph_transformation_steps),
104104
logging_manager_(logging_manager),
105-
#ifndef USE_OPENMP
106105
thread_pool_(concurrency::CreateThreadPool("intra_op_thread_pool",
107106
session_options.intra_op_num_threads)),
108-
#else
109-
thread_pool_(nullptr),
110-
#endif
111107
inter_op_thread_pool_(session_options.execution_mode == ExecutionMode::ORT_PARALLEL
112108
? concurrency::CreateThreadPool("inter_op_thread_pool",
113109
session_options.inter_op_num_threads)

onnxruntime/test/perftest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Options:
3232
3333
-v: Show verbose information.
3434
35-
-x: [intra_op_num_threads]: Sets the number of threads used to parallelize the execution within nodes. A value of 0 means the test will auto-select a default. Must >=0. If OpenMP is enabled, this configuration will be ignored.
35+
-x: [intra_op_num_threads]: Sets the number of threads used to parallelize the execution within nodes. A value of 0 means the test will auto-select a default. Must >=0.
3636

3737
-y: [inter_op_num_threads]: Sets the number of threads used to parallelize the execution of the graph (across nodes), A value of 0 means the test will auto-select a default. Must >=0.
3838

onnxruntime/test/perftest/command_args_parser.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,10 @@ namespace perftest {
123123
test_config.run_config.f_verbose = true;
124124
break;
125125
case 'x':
126-
#ifdef USE_OPENMP
127-
fprintf(stderr, "cannot use argument '-x' when OpenMP is enabled.\n");
128-
return false;
129-
#else
130126
test_config.run_config.intra_op_num_threads = static_cast<int>(OrtStrtol<PATH_CHAR_TYPE>(optarg, nullptr));
131127
if (test_config.run_config.intra_op_num_threads < 0) {
132128
return false;
133129
}
134-
#endif
135130
break;
136131
case 'y':
137132
test_config.run_config.inter_op_num_threads = static_cast<int>(OrtStrtol<PATH_CHAR_TYPE>(optarg, nullptr));

onnxruntime/test/perftest/ort_test_session.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ OnnxRuntimeTestSession::OnnxRuntimeTestSession(Ort::Env& env, std::random_device
8282
} else if (provider_name == onnxruntime::kAclExecutionProvider) {
8383
#ifdef USE_ACL
8484
Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_ACL(session_options,
85-
performance_test_config.run_config.enable_cpu_mem_arena ? 1 : 0));
85+
performance_test_config.run_config.enable_cpu_mem_arena ? 1 : 0));
8686
#else
8787
ORT_THROW("Acl is not supported in this build\n");
8888
#endif
@@ -100,11 +100,8 @@ OnnxRuntimeTestSession::OnnxRuntimeTestSession(Ort::Env& env, std::random_device
100100
else
101101
session_options.DisableMemPattern();
102102
session_options.SetExecutionMode(performance_test_config.run_config.execution_mode);
103-
104-
#ifndef USE_OPENMP
105103
fprintf(stdout, "Setting intra_op_num_threads to %d\n", performance_test_config.run_config.intra_op_num_threads);
106104
session_options.SetIntraOpNumThreads(performance_test_config.run_config.intra_op_num_threads);
107-
#endif
108105

109106
if (performance_test_config.run_config.execution_mode == ExecutionMode::ORT_PARALLEL) {
110107
fprintf(stdout, "Setting inter_op_num_threads to %d\n", performance_test_config.run_config.inter_op_num_threads);

0 commit comments

Comments
 (0)