WIP: This merge request is an ongoing work to include onnxRuntime in athena as a platform to run machine learning algorithms
OnnxRuntime has been proven to be extremely successful as a machine learning platform. It can run models generated by any framework (e.g. PyTorch, tensorFlow, Keras, etc.) converted to .onnx format. Above all it promises to provide thread safety while running inferences where tensorFlow, Keras fail. This merge is a 1st attempt integrade a commercial machine learning framework in athena. It has a cmake build that compiles in an environment like athena (tested and confirmed). We need some understanding of how to inform athena about the include (.h) and the shared library file (.so) which are required by a code using onnxruntime to get compiled. adding @afarbin , @tsulaia , @akraszna
Detailed Description:
- I have created a package named AthExHelloOnnxRuntime (https://gitlab.cern.ch/dbakshig/athena/tree/tryingOnnxRuntime/Control/AthenaExamples/AthExHelloOnnxRuntime)
- The inspiration is taken from https://gitlab.cern.ch/dbakshig/athena/tree/tryingOnnxRuntime/Control/AthenaExamples/AthExHelloWorld
- This current package has a
HelloAlg.cxx
file which reads a .onnx model using onnxRuntime's c++ API - There is a joboption file
HelloOnnxRuntimeOptions.py
which will thisHelloAlg.cxx
to AlgSequence so that HelloAlg.cxx can run as an Athena job. - HelloAlg.cxx needs a header file
onnxruntime_c_api.h
to use onnxRuntime and a shared library file libonnxruntime.so.1.0.0. This library file can be generated on lxplus by building onnxRuntime from source. A successful method for building onnxruntime from source on lxplus is
setupATLAS lsetup "cmake 3.14.3" lsetup "lcgenv -p LCG_96 x86_64-centos7-gcc8-opt gcc" git clone --recursive https://github.com/Microsoft/onnxruntime cd onnxruntime ./build.sh --config RelWithDebInfo --build_shared_lib --parallel
You can play with its c++ api by just reading a .onnx model you can find a c++ code and .onnx model in my lxplus public space /afs/cern.ch/work/d/dbakshig/public/Onnx/C_Api_Sample.cpp /afs/cern.ch/work/d/dbakshig/public/Onnx/saved_mnist/saved_model.onnx
and a CMakeLists.txt to compile the C_Api_Sample.cpp /afs/cern.ch/work/d/dbakshig/public/Onnx/CMakeLists.txt
Issues related to integrating onnxruntime to athena will be discussed in this jira exclusively opened to address this https://its.cern.ch/jira/browse/AML-3 . It would be great if the developpers/experts can respond there
Thanks in advance