ATLAS Offline Software
Private Attributes | List of all members
AthOnnx::OnnxRuntimeSvc Class Reference

Service implementing AthOnnx::IOnnxRuntimeSvc. More...

#include <OnnxRuntimeSvc.h>

Inheritance diagram for AthOnnx::OnnxRuntimeSvc:
Collaboration diagram for AthOnnx::OnnxRuntimeSvc:

Public Member Functions

Function(s) inherited from @c Service
 OnnxRuntimeSvc (const std::string &name, ISvcLocator *svc)
 
virtual StatusCode initialize () override
 Function initialising the service. More...
 
virtual StatusCode finalize () override
 Function finalising the service. More...
 
Function(s) inherited from @c AthOnnx::IOnnxRuntimeSvc
virtual Ort::Env & env () const override
 Return the Onnx Runtime environment object. More...
 

Private Attributes

std::unique_ptr< Ort::Env > m_env
 Global runtime environment for Onnx Runtime. More...
 

Detailed Description

Service implementing AthOnnx::IOnnxRuntimeSvc.

This is a very simple implementation, just managing the lifetime of some Onnx Runtime C++ objects.

Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h

Definition at line 27 of file OnnxRuntimeSvc.h.

Constructor & Destructor Documentation

◆ OnnxRuntimeSvc()

AthOnnx::OnnxRuntimeSvc::OnnxRuntimeSvc ( const std::string &  name,
ISvcLocator *  svc 
)

Definition at line 8 of file OnnxRuntimeSvc.cxx.

8  :
9  base_class(name, svc)
10  {
11  }

Member Function Documentation

◆ env()

Ort::Env & AthOnnx::OnnxRuntimeSvc::env ( ) const
overridevirtual

Return the Onnx Runtime environment object.

Definition at line 38 of file OnnxRuntimeSvc.cxx.

38  {
39 
40  return *m_env;
41  }

◆ finalize()

StatusCode AthOnnx::OnnxRuntimeSvc::finalize ( )
overridevirtual

Function finalising the service.

Definition at line 28 of file OnnxRuntimeSvc.cxx.

28  {
29 
30  // Dekete the environment object.
31  m_env.reset();
32  ATH_MSG_DEBUG( "Ort::Env object deleted" );
33 
34  // Return gracefully.
35  return StatusCode::SUCCESS;
36  }

◆ initialize()

StatusCode AthOnnx::OnnxRuntimeSvc::initialize ( )
overridevirtual

Function initialising the service.

Definition at line 13 of file OnnxRuntimeSvc.cxx.

13  {
14 
15  // Create the environment object.
16  Ort::ThreadingOptions tp_options;
17  tp_options.SetGlobalIntraOpNumThreads(1);
18  tp_options.SetGlobalInterOpNumThreads(1);
19 
20  m_env = std::make_unique< Ort::Env >(
21  tp_options, ORT_LOGGING_LEVEL_WARNING, name().c_str());
22  ATH_MSG_DEBUG( "Ort::Env object created" );
23 
24  // Return gracefully.
25  return StatusCode::SUCCESS;
26  }

Member Data Documentation

◆ m_env

std::unique_ptr< Ort::Env > AthOnnx::OnnxRuntimeSvc::m_env
private

Global runtime environment for Onnx Runtime.

Definition at line 52 of file OnnxRuntimeSvc.h.


The documentation for this class was generated from the following files:
AthOnnx::OnnxRuntimeSvc::m_env
std::unique_ptr< Ort::Env > m_env
Global runtime environment for Onnx Runtime.
Definition: OnnxRuntimeSvc.h:52
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221