Skip to content

Commit

Permalink
Remove benchmarking code (#6076)
Browse files Browse the repository at this point in the history
We the benchmarks are not testing much and thus are not very useful.
Removing them to keep code lean and reduce dependencies.

Signed-off-by: Justin Chu <justinchu@microsoft.com>
  • Loading branch information
justinchuby committed Apr 12, 2024
1 parent 30896d8 commit 959744d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 170 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Expand Up @@ -2,6 +2,3 @@
path = third_party/pybind11
url = https://github.com/pybind/pybind11.git
branch = master
[submodule "third_party/benchmark"]
path = third_party/benchmark
url = https://github.com/google/benchmark.git
27 changes: 1 addition & 26 deletions CMakeLists.txt
Expand Up @@ -16,7 +16,6 @@ cmake_policy(SET CMP0074 NEW)

# Project
project(onnx C CXX)
option(ONNX_BUILD_BENCHMARKS "Build ONNX micro-benchmarks" OFF)
option(ONNX_USE_PROTOBUF_SHARED_LIBS "Build ONNX using protobuf shared library. Sets PROTOBUF_USE_DLLS CMAKE Flag and Protobuf_USE_STATIC_LIBS. " OFF)

option(BUILD_ONNX_PYTHON "Build Python binaries" OFF)
Expand Down Expand Up @@ -619,30 +618,6 @@ if(BUILD_ONNX_PYTHON)
endif()
endif()

if(ONNX_BUILD_BENCHMARKS)
if(NOT TARGET benchmark)
# We will not need to test benchmark lib itself.
set(BENCHMARK_ENABLE_TESTING OFF
CACHE BOOL "Disable benchmark testing as we don't need it.")
# We will not need to install benchmark since we link it statically.
set(BENCHMARK_ENABLE_INSTALL OFF
CACHE BOOL
"Disable benchmark install to avoid overwriting vendor install.")
find_package(benchmark)
if(NOT benchmark_FOUND)
add_subdirectory(${PROJECT_SOURCE_DIR}/third_party/benchmark)
endif()
endif()

add_executable(protobuf-bench tools/protobuf-bench.cc)
target_include_directories(protobuf-bench PUBLIC
$<BUILD_INTERFACE:${ONNX_ROOT}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${PROTOBUF_INCLUDE_DIRS}>)
target_link_libraries(protobuf-bench onnx_proto benchmark::benchmark)
endif()

# Export include directories
set(ONNX_INCLUDE_DIRS "${ONNX_ROOT}" "${CMAKE_CURRENT_BINARY_DIR}")
get_directory_property(hasParent PARENT_DIRECTORY)
Expand Down Expand Up @@ -742,7 +717,7 @@ if(ONNX_USE_UNITY_BUILD)
# If ONNX_USE_UNITY_BUILD is set to ON, set onnx target to use Unity builds.
# We set Unity build to use groups, it allows us to set some specific files to be compiled individually
set_target_properties(onnx
PROPERTIES
PROPERTIES
UNITY_BUILD ON
UNITY_BUILD_MODE GROUP
)
Expand Down
1 change: 0 additions & 1 deletion cmake/summary.cmake
Expand Up @@ -26,7 +26,6 @@ function (onnx_print_configuration_summary)
message(STATUS " ONNX_DISABLE_STATIC_REGISTRATION : ${ONNX_DISABLE_STATIC_REGISTRATION}")
message(STATUS " ONNX_WERROR : ${ONNX_WERROR}")
message(STATUS " ONNX_BUILD_TESTS : ${ONNX_BUILD_TESTS}")
message(STATUS " ONNX_BUILD_BENCHMARKS : ${ONNX_BUILD_BENCHMARKS}")
message(STATUS " ONNX_BUILD_SHARED_LIBS : ${ONNX_BUILD_SHARED_LIBS}")
message(STATUS " BUILD_SHARED_LIBS : ${BUILD_SHARED_LIBS}")
message(STATUS "")
Expand Down
1 change: 0 additions & 1 deletion third_party/benchmark
Submodule benchmark deleted from 2dd015
139 changes: 0 additions & 139 deletions tools/protobuf-bench.cc

This file was deleted.

0 comments on commit 959744d

Please sign in to comment.