Skip to content

Commit bebe103

Browse files
committed
- add optimization vectorization options for SOFIE tests
- set in ONNXRuntime also the interopnumthreads to 1
1 parent 5388577 commit bebe103

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

root/tmva/sofie/CMakeLists.txt

+7-3
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,13 @@ add_dependencies(RDF_SOFIE_Inference SofieCompileModels)
190190
#if (ROOT_PLATFORM MATCHES "linux|macosx" AND CMAKE_SYSTEM_PROCESSOR MATCHES x86_64 AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
191191
## assume we run only on linux/macos with gnu or gcc
192192
set(gnu-flags $<$<CXX_COMPILER_ID:GNU>:-fno-signaling-nans>)
193-
target_compile_options(SOFIEInference PRIVATE ${gnu-flags} -fno-trapping-math -O3)
194-
target_compile_options(RDF_SOFIE_Inference PRIVATE ${gnu-flags} -fno-trapping-math -O3)
195-
#endif()
193+
if ($APPLE)
194+
target_compile_options(SOFIEInference PRIVATE ${gnu-flags} -ffast-math -fno-trapping-math -O3)
195+
target_compile_options(RDF_SOFIE_Inference PRIVATE ${gnu-flags} -ffast-math -fno-trapping-math -O3)
196+
else()
197+
target_compile_options(SOFIEInference PRIVATE ${gnu-flags} -march=native -ffast-math -fno-trapping-math -O3)
198+
target_compile_options(RDF_SOFIE_Inference PRIVATE ${gnu-flags} -march=native -ffast-math -fno-trapping-math -O3)
199+
endif()
196200

197201
endif() # endif blas
198202
endif() # endif TMVA/SOFIE

root/tmva/sofie/ONNXRuntimeInference_Template.cxx.in

+7-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ static void @FUNC_NAME@(benchmark::State& state, string model_path)
1919

2020
Ort::SessionOptions session_options;
2121
session_options.SetIntraOpNumThreads(1);
22+
session_options.SetInterOpNumThreads(1);
2223
session_options.SetGraphOptimizationLevel(GraphOptimizationLevel::ORT_ENABLE_EXTENDED);
2324

2425
//std::cout << "benchmarking model " << model_path << std::endl;
@@ -45,12 +46,12 @@ static void @FUNC_NAME@(benchmark::State& state, string model_path)
4546
for (int i = 0; i < nout; i++)
4647
output_node_dims[i] = session.GetOutputTypeInfo(i).GetTensorTypeAndShapeInfo().GetShape();
4748

48-
for (int i = 0; i < nin; i++) {
49-
std::cout << "input " << input_node_names[i] << " shape : ";
50-
for (int j = 0; j < input_node_dims[i].size(); j++)
51-
std::cout << " " << input_node_dims[i][j];
52-
std::cout << std::endl;
53-
}
49+
// for (int i = 0; i < nin; i++) {
50+
// std::cout << "input " << input_node_names[i] << " shape : ";
51+
// for (int j = 0; j < input_node_dims[i].size(); j++)
52+
// std::cout << " " << input_node_dims[i][j];
53+
// std::cout << std::endl;
54+
// }
5455
// fix negative shapes
5556
for (int i = 0; i < nin; i++) {
5657
for (int j = 0; j < input_node_dims[i].size(); j++) {

0 commit comments

Comments
 (0)