Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Microsoft Onnxruntime OrtEpDevice

From Leeroopedia
Revision as of 15:47, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Microsoft_Onnxruntime_OrtEpDevice.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Knowledge Sources Description
Source File java/src/main/java/ai/onnxruntime/OrtEpDevice.java
Repository Microsoft/onnxruntime

Domains

  • Machine Learning Runtime
  • Execution Provider Device Enumeration

Overview

OrtEpDevice is a final class representing a tuple of execution provider (EP) information and its associated hardware device. It provides the EP name, vendor, metadata, configuration options, and a reference to the underlying OrtHardwareDevice. Instances are returned by OrtEnvironment.getEpDevices() for device enumeration and model compatibility checks.

Description

The class wraps a native handle and eagerly extracts all fields on construction:

  • epName: The execution provider name (e.g., "CUDAExecutionProvider").
  • epVendor: The EP vendor name.
  • epMetadata: An unmodifiable Map<String, String> of EP metadata.
  • epOptions: An unmodifiable Map<String, String> of EP configuration options.
  • device: An OrtHardwareDevice describing the hardware (type, vendor, ID, memory).

All data is extracted via native JNI methods and converted to Java maps using OrtUtil.convertToMap.

Code Reference

Source Location

// File: java/src/main/java/ai/onnxruntime/OrtEpDevice.java
// Package: ai.onnxruntime

Signature

public final class OrtEpDevice {
    public String getEpName();
    public String getEpVendor();
    public Map<String, String> getEpMetadata();
    public Map<String, String> getEpOptions();
    public OrtHardwareDevice getDevice();
}

Import

import ai.onnxruntime.OrtEpDevice;

I/O Contract

Inputs

Name Type Description
nativeHandle long Pointer to the native EP device struct (internal)

Outputs

Name Type Description
getEpName() String Execution provider name
getEpVendor() String EP vendor name
getEpMetadata() Map<String, String> EP metadata key-value pairs
getEpOptions() Map<String, String> EP configuration options
getDevice() OrtHardwareDevice The associated hardware device information

Usage Examples

import ai.onnxruntime.*;
import java.util.*;

OrtEnvironment env = OrtEnvironment.getEnvironment();

List<OrtEpDevice> epDevices = env.getEpDevices();
for (OrtEpDevice epDevice : epDevices) {
    System.out.println("EP: " + epDevice.getEpName());
    System.out.println("  Vendor: " + epDevice.getEpVendor());
    System.out.println("  Metadata: " + epDevice.getEpMetadata());
    System.out.println("  Options: " + epDevice.getEpOptions());
    System.out.println("  Device: " + epDevice.getDevice());
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment