Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/root-ci-config/buildconfig/global.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ roofit_multiprocess=OFF
root7=ON
rootbench=OFF
roottest=ON
test_roofit_hs3testsuite=ON
runtime_cxxmodules=ON
shadowpw=OFF
shared=ON
Expand All @@ -78,12 +77,13 @@ sqlite=ON
ssl=ON
test_distrdf_dask=ON
test_distrdf_pyspark=ON
test_roofit_hs3testsuite=ON
test_tmva_sofie=ON
testing=ON
tmva-cpu=ON
tmva-gpu=OFF
tmva-cudnn=OFF
tmva-pymva=OFF
tmva-sofie=ON
tmva=ON
unfold=ON
unuran=ON
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ check_connection=ON
cocoa=ON
davix=OFF
minuit2_omp=OFF
tmva-sofie=OFF
x11=OFF
1 change: 0 additions & 1 deletion .github/workflows/root-ci-config/buildconfig/mac26.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ check_connection=ON
cocoa=ON
davix=OFF
minuit2_omp=OFF
tmva-sofie=OFF
x11=OFF
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ builtin_unuran=ON
test_distrdf_dask=OFF
test_distrdf_pyspark=OFF
tmva-pymva=ON
tmva-sofie=ON
pythia8=OFF
cefweb=ON
1 change: 0 additions & 1 deletion .github/workflows/root-ci-config/buildconfig/rawhide.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
pythia8=ON
test_distrdf_dask=OFF
test_distrdf_pyspark=OFF
tmva-sofie=OFF
vdt=OFF
roofit_multiprocess=ON
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ tmva-cpu=ON
tmva-cudnn=ON
tmva-gpu=ON
tmva-pymva=OFF
tmva-sofie=OFF
tmva=ON
unfold=OFF
webgui=ON
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ runtime_cxxmodules=OFF
ssl=OFF
test_distrdf_dask=OFF
test_distrdf_pyspark=OFF
tmva-sofie=OFF
test_tmva_sofie=OFF
use_gsl_cblas=ON
vdt=OFF
x11=OFF
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ ROOT_BUILD_OPTION(tmva-cpu ON "Build TMVA with CPU support for deep learning (re
ROOT_BUILD_OPTION(tmva-cudnn ON "Enable support for cuDNN (default when CUDA is enabled)")
ROOT_BUILD_OPTION(tmva-gpu OFF "Build TMVA with GPU support for deep learning (requires CUDA)")
ROOT_BUILD_OPTION(tmva-pymva OFF "Enable usage of Python ML libraries in TMVA (requires NumPy, works only with TensorFlow<=2.15)")
ROOT_BUILD_OPTION(tmva-sofie OFF "Build TMVA with support for sofie - fast inference code generation (requires protobuf 3)")
ROOT_BUILD_OPTION(tpython ON "Build the TPython class that allows you to run Python code from C++")
ROOT_BUILD_OPTION(unfold OFF "Enable the unfold package [GPL]")
ROOT_BUILD_OPTION(unuran OFF "Enable support for UNURAN (package for generating non-uniform random numbers) [GPL]")
Expand All @@ -192,6 +191,7 @@ option(minimal "Enable only required options by default" OFF)
option(rootbench "Build rootbench if rootbench exists in root or if it is a sibling directory (implies testing=ON)" OFF)
option(roottest "Build roottest (implies testing=ON)" OFF)
option(test_roofit_hs3testsuite "Setup and use the HS3 conformance test suite (requires network)" OFF)
option(test_tmva_sofie "Enable SOFIE tests (requires BLAS library that can be found with CMake's FindBLAS)" ON)
option(testing "Enable testing with CTest" OFF)
option(asan "Build ROOT with address sanitizer instrumentation (see core/sanitizer for details)" OFF)
option(_wheel_build "ROOT is being packaged as a wheel, do not install .dist-info metadata" OFF)
Expand Down
5 changes: 0 additions & 5 deletions cmake/modules/RootConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,6 @@ if (tmva-pymva)
else()
set(haspymva undef)
endif()
if (tmva-sofie)
set(hastmvasofie define)
else()
set(hastmvasofie undef)
endif()
if (uring)
set(hasuring define)
else()
Expand Down
52 changes: 10 additions & 42 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1009,50 +1009,18 @@ if(experimental_adaptivecpp)
endif()
endif()

#---Check for protobuf-------------------------------------------------------------------

if(tmva-sofie)
if(testing)
message(STATUS "Looking for BLAS as an optional testing dependency of TMVA-SOFIE")
find_package(BLAS)
if(NOT BLAS_FOUND)
if(fail-on-missing)
message(FATAL_ERROR "BLAS not found, but it's required for TMVA-SOFIE testing")
else()
message(WARNING "BLAS not found: TMVA-SOFIE will not be fully tested")
endif()
endif()
endif()
message(STATUS "Looking for Protobuf")
set(protobuf_MODULE_COMPATIBLE TRUE)
find_package(Protobuf CONFIG)
if(NOT Protobuf_FOUND)
find_package(Protobuf MODULE)
endif()
if(NOT Protobuf_FOUND)
#---Check for optional TMVA-SOFIE testing dependency (BLAS)-------------------------------
# SOFIE itself has no external dependencies: ONNX models are read with a small
# self-contained protobuf wire-format decoder (tmva/sofie_parsers/src/onnx.hxx).

if(tmva AND testing AND test_tmva_sofie)
message(STATUS "Looking for BLAS as an optional testing dependency of TMVA-SOFIE")
find_package(BLAS)
if(NOT BLAS_FOUND)
if(fail-on-missing)
message(SEND_ERROR "Protobuf libraries not found and they are required (tmva-sofie option enabled)")
message(FATAL_ERROR "BLAS not found, but it's required for TMVA-SOFIE testing")
else()
message(STATUS "Protobuf not found. Switching off tmva-sofie option")
set(tmva-sofie OFF CACHE BOOL "Disabled because Protobuf not found" FORCE)
endif()
else()
if(Protobuf_VERSION LESS 3.0)
if(fail-on-missing)
message(SEND_ERROR "Protobuf libraries found but is less than the version required (3.0) (tmva-sofie option enabled)")
else()
message(STATUS "Protobuf found but its version is not high enough (>3.0). Switching off tmva-sofie option")
set(tmva-sofie OFF CACHE BOOL "Disabled because found Protobuf version is not enough" FORCE)
endif()
else()
if(NOT TARGET protobuf::protoc)
if(fail-on-missing)
message(SEND_ERROR "Protobuf compiler not found (tmva-sofie option enabled)")
else()
message(STATUS "Protobuf compiler not found. Switching off tmva-sofie option")
set(tmva-sofie OFF CACHE BOOL "Disabled because Protobuf compiler not found" FORCE)
endif()
endif()
message(WARNING "BLAS not found: TMVA-SOFIE will not be fully tested")
endif()
endif()
endif()
Expand Down
1 change: 0 additions & 1 deletion config/RConfigure.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
#@hastmvagpu@ R__HAS_TMVAGPU /**/
#@hastmvacudnn@ R__HAS_CUDNN /**/
#@haspymva@ R__HAS_PYMVA /**/
#@hastmvasofie@ R__HAS_TMVASOFIE /*SOFIE is enabled*/

#@hasuring@ R__HAS_URING /**/

Expand Down
2 changes: 1 addition & 1 deletion roofit/roofit/src/RooONNXFunc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void RooONNXFunc::initialize()
// link-time dependency to the SOFIE parser library.
if (gSystem->Load("libROOTTMVASofieParser") < 0) {
throw std::runtime_error("RooONNXFunc: cannot load ONNX file since SOFIE ONNX parser is missing."
" Please build ROOT with tmva-sofie=ON.");
" Please build ROOT with tmva=ON.");
}
using OnnxToCpp = std::string (*)(std::uint8_t const *, std::size_t, const char *);
auto onnxToCppWithSofie = resolveLazy<OnnxToCpp>("_RooONNXFunc_onnxToCppWithSofie",
Expand Down
2 changes: 1 addition & 1 deletion roofit/roofit/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ endif()

add_subdirectory(vectorisedPDFs)

if(tmva-sofie)
if(tmva)
ROOT_FIND_PYTHON_MODULE(torch)
ROOT_FIND_PYTHON_MODULE(onnx)

Expand Down
6 changes: 1 addition & 5 deletions tmva/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,4 @@ if(tmva-pymva)
endif()

add_subdirectory(sofie)
#parser depends on protobuf
#found if flag tmva-sofie is on
if (tmva-sofie)
add_subdirectory(sofie_parsers)
endif()
add_subdirectory(sofie_parsers)
7 changes: 3 additions & 4 deletions tmva/sofie/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
############################################################################
#Author: Sitong An, Lorenzo Moneta 10/03/2021

#sofie is built only if protobuf is found

set(sofie_root_support ON CACHE BOOL "" FORCE)

Expand Down Expand Up @@ -110,7 +109,7 @@ if(sofie_root_support)
target_compile_definitions(ROOTTMVASofie PRIVATE SOFIE_SUPPORT_ROOT_BINARY)
endif()

# The building of the tests requires protobuf (available only when tmva-sofie is ON)
if (tmva-sofie)
ROOT_ADD_TEST_SUBDIRECTORY(test)
# Tests are not enabled unconditionally because they require BLAS
if(test_tmva_sofie)
ROOT_ADD_TEST_SUBDIRECTORY(test)
endif()
6 changes: 3 additions & 3 deletions tmva/sofie/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ This is a new development in TMVA and is currently in early experimental stage.


## Prerequisite
- Protobuf 3.0 or higher (for input of ONNX model files)
- BLAS or Eigen (for execution of the generated code for inference)

## Installation

Build ROOT with the cmake option tmva-sofie enabled.
SOFIE is built as part of TMVA, so it is enabled whenever ROOT is built with
the `tmva` cmake option (which is ON by default).

```bash
cmake ../root -Dtmva-sofie=ON
cmake ../root -Dtmva=ON
make -j8
```

Expand Down
5 changes: 1 addition & 4 deletions tmva/sofie/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,9 @@ if (ONNX_MODELS_DIR)
configure_file(EmitFromONNX.cxx.in EmitFromONNX_all.cxx @ONLY)

ROOTTEST_GENERATE_EXECUTABLE(emitFromONNX EmitFromONNX_all.cxx
LIBRARIES protobuf::libprotobuf ROOTTMVASofie ROOTTMVASofieParser
LIBRARIES ROOTTMVASofie ROOTTMVASofieParser
FIXTURES_SETUP sofie-compile-models-onnx-build)

# silence protobuf warnings seen in version 3.0 and 3.6. Not needed from protobuf version 3.17
target_compile_options(emitFromONNX PRIVATE -Wno-unused-parameter -Wno-array-bounds)

set(compile_models_fixtures sofie-compile-models-onnx-build)
if (generate_onnx_models)
ROOTTEST_ADD_TEST(SofieGenerateModels_ONNX
Expand Down
2 changes: 1 addition & 1 deletion tmva/sofie/test/EmitFromONNX.cxx.in
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ int EmitModel(std::string filename, std::string outname)
return 0;
}

int main(int argc, char *argv[])
int main(int /*argc*/, char * /*argv*/[])
{
// clang-format off
@EMIT_CAPTURES@;
Expand Down
18 changes: 3 additions & 15 deletions tmva/sofie_parsers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,9 @@
############################################################################
#Author: Sitong An, Lorenzo Moneta 10/03/2021

#sofie is built only if protobuf is found

protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS "onnx_proto3")
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
## silence protobuf warnings for version 3.6. Not needed from protobuf version 3.17
set_source_files_properties(${PROTO_SRCS} PROPERTIES COMPILE_FLAGS -Wno-array-bounds)
## silence protobuf warnings for version 3.0. Not needed from protobuf version 3.6
set_source_files_properties(${PROTO_SRCS} PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
# The ONNX model files are read with a small self-contained protobuf
# wire-format decoder (src/onnx.hxx), so this package has no external
# dependency on protobuf / libprotobuf / protoc.

ROOT_STANDARD_LIBRARY_PACKAGE(ROOTTMVASofieParser
HEADERS
Expand Down Expand Up @@ -83,17 +78,10 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ROOTTMVASofieParser
src/ParseGelu.cxx
src/ParseHardSigmoid.cxx
src/ParseHardSwish.cxx
${PROTO_SRCS}
LIBRARIES PUBLIC
protobuf::libprotobuf
DEPENDENCIES
TMVA
ROOTTMVASofie
)

target_include_directories(ROOTTMVASofieParser PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
target_include_directories(ROOTTMVASofieParser BEFORE PUBLIC
${Protobuf_INCLUDE_DIRS})
set_target_properties(ROOTTMVASofieParser PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
Loading
Loading