Packaging sources for the ONNX Runtime CUDA plugin Execution Provider (EP), distributed as a standalone artifact that
plugs into an existing ONNX Runtime installation rather than being built into the main onnxruntime binary.
For more information about plugin EPs, see the documentation
here.
MIN_ONNXRUNTIME_VERSION - Minimum compatible core onnxruntime version. Single sourcepaths.txt - Specifies directories and paths related to the CUDA EP. These paths are used to filter thepython/ - Sources and build script for the onnxruntime-ep-cuda12/onnxruntime-ep-cuda13 Python wheels.csharp/ - Sources and packaging script for the per-RIDMicrosoft.ML.OnnxRuntime.EP.Cuda{12,13}.<rid> NuGet packages.MIN_ONNXRUNTIME_VERSION defines the minimum supported ONNX Runtime core version, but it does not by itself guarantee
compatibility when contributed operators are involved. ONNX Runtime core and a plugin EP can be built from different
revisions, and a contributed operator such as GroupQueryAttention may gain an input, output, attribute, or supported
type without a change to its historical schema version. In that case, core may fuse or validate a node using one
operator contract and dispatch it to a plugin kernel compiled against another, potentially causing incorrect execution
or a crash.
When a plugin EP implements contributed operators, it must be built against the same contributed-operator schemas used
by ONNX Runtime core. Building core and the plugin EP from the same ONNX Runtime revision is the recommended way to
ensure that alignment.
Install the CUDA-family-specific Python distribution, then register the plugin EP at runtime. The package names areonnxruntime-ep-cuda12 for CUDA 12.x builds and onnxruntime-ep-cuda13 for CUDA 13.x builds. Both distributions expose
the same Python import module, onnxruntime_ep_cuda.
import onnxruntime as ort
import onnxruntime_ep_cuda as cuda_ep
ort.register_execution_provider_library(cuda_ep.get_ep_name(), cuda_ep.get_library_path())
devices = [d for d in ort.get_ep_devices() if d.ep_name == cuda_ep.get_ep_name()]
sess_options = ort.SessionOptions()
sess_options.add_provider_for_devices(devices, {})
session = ort.InferenceSession("model.onnx", sess_options=sess_options)