onnxruntime/docs/tutorials/csharp/csharp-gpu.md
Cassie Breviu 1b9772352d
Add two new blogs that were posted this week to the news section and C# GPU tutorial (#14443)
Co-authored-by: Nat Kershaw <nakersha@microsoft.com>
2023-01-27 15:38:50 -08:00

1.8 KiB

title description parent grand_parent has_children nav_order
Configure CUDA for C# Configure CUDA and cuDNN for ONNX Runtime with C# on Windows 11 Inference with C# Tutorials false 1

Configure CUDA and cuDNN for ONNX Runtime with C# on Windows 11

{: .no_toc }

Prerequisites

  • Windows 11
  • Visual Studio 2019 or 2022

Steps to Configure CUDA and cuDNN for ONNX Runtime with C# on Windows 11

  1. Install CUDA toolkit based on the supported version for the ONNX Runtime Version. See this link for compatible versions: NVIDIA - CUDA - ONNX Runtime

  2. Install Driver from NVIDIA based on your GPU. Find the driver download here: Official Drivers - NVIDIA

  3. Install the cuDNN version based on the supported version for the ONNX Runtime Version. See this link for compatible versions: NVIDIA - CUDA - ONNX Runtime then download the cuDNN version from here: cuDNN Archive - NVIDIA Developer

  4. Follow the steps here from Installation Guide - NVIDIA Deep Learning cuDNN Documentation. NOTE: Skip step 5 in section 2.3 on updating Visual Studio settings, this is only for C++ projects.

  5. Restart your computer.

  6. Now you can enable GPU in the C# ONNX Runtime API with the following code:

var session = new InferenceSession(modelPath, SessionOptions.MakeSessionOptionWithCudaProvider(0));

Checkout more C# ONNX Runtime resources