at_tree_prediction_adder
Overview
at_tree_prediction_adder was developed to apply predictions of of a machine learning model described in the ONNX format to an existing AnalysisTree, using the topological values stored in its branch fields as input for the model.
Pre-requirements
The default C++ standard is 17. Compiles on GCC and is targeted for hpc usage.
ONNX Runtime
ONNX Runtime is needed to compile and run the program. Get the precompiled version for your architecture here:
https://github.com/microsoft/onnxruntime/releases
Works on version (git tag) 1.11.0
. Remember to add the --build-shared-lib
argument to build.sh
.
After download, add the lib directory to your $LD_LIBRARY_PATH
environment variable.
Root
ROOT6 is needed for installation:
https://root.cern/install/build_from_source/
Follow instructions
AnalysisTree
https://github.com/HeavyIonAnalysis/AnalysisTree
Follow instructions. Version since v2.2.0 is recommended.
Boost
Boost 1.78.0 is required.
Installation
Clone at_tree_prediction_adder git clone https://git.cbm.gsi.de/apuntke/at_tree_prediction_adder.git
Source ROOT
source /path-to-root/install/bin/thisroot.sh
Export AnalysisTree libraries
export AnalysisTree_DIR=/path-to-analysistree/install/lib/cmake/AnalysisTree
Export ONNX Runtime libraries
export OnnxRuntime_DIR=/path-to-onnxruntime
Export boost
export BOOST_DIR=/cvmfs/fairsoft.gsi.de/debian10/fairsoft/apr22/lib/cmake/Boost-1.78.0
Install at_tree_prediction_adder
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=../inst ../src
make -j install
If you use c++ 17 standard also add cmake key -DCMAKE_CXX_STANDARD=17
Command-line arguments
--filelist/-f <input-filelist>
Specifies the input filelist.txt which is read into the program. It must contain a list of PFStimple AnalysisTree root files which should be processed.
--config/-c <branch-name>
Specifies the path to the onnx config (output of PID ML training, needs to be edited to update model feature variables)
--output/-o <branch-name>
Specifies the output file path
--treename/-tn <onnx-file>
Specifies the input tree name
--num_threads <number-of-onnx-threads>
Specifies the number of threads ONNX should use. This option may be neccessary when used inside a slurm environment, because the number of cores cannot be determined in the usual way automatically.