Aspose OCR GPU only works with CUDA toolkit 11.8 on Windows server 2019

My setup: Windows server 2019 and Visual Studio 2019
Aspose.OCR-GPU v25.10.0 w/ lowest Dependency behavior
OnnxRuntime.Gpu v 1.16.3
CUDA toolkit v 12.0.0
CuDNN v 8.8.0
Nvidia RTX 2000E driver v 552.74

I can only get CUDA toolkit 11.8 and CuDNN 8.6.0 to work with the latest Aspose OCR-GPU Nuget package.
It’s super slow with this setup, and I’d like to see if it can go faster with CUDA toolkit 12 versions. I’m doing OCR on a Bitmap saved to a memory stream.

The error I always get when trying to use CUDA toolkit 12 is error 126 when trying to load onnxruntime_providers_cuda.dll. That file is in the .bin folder for the Visual Studio project build.

@tfid

Short answer – Aspose.OCR‑GPU v25.10.0 works only with CUDA Toolkit 11.8 and cuDNN 8.6 (together with a driver ≥ 511). CUDA 12.x or cuDNN 8.8 are not supported; the native DLLs will fail to load or run with severe errors. Install the supported versions or fall back to the CPU‑only Aspose.OCR package.


Why the version lock exists

Reason Detail
Pre‑compiled ONNX model Linked against the CUDA 11.8 runtime.
Native DLLs (Aspose.OCR.Gpu.dll, onnxruntime.dll, …) Built for the exact CUDA 11.8 / cuDNN 8.6 ABI.
ABI change Switching to CUDA 12 changes symbol names; the DLLs cannot resolve them.
cuDNN API changes cuDNN 8.8 introduces functions that the current wrapper does not call.

Because of this tight coupling Aspose can only guarantee correct operation with the versions listed in the release notes.


Recommended setup for Windows Server 2019

  1. Remove any CUDA 12.x / cuDNN 8.8 installations.

  2. Install the exact versions:

    • CUDA Toolkit 11.8 – download from NVIDIA’s archive.
    • cuDNN 8.6 for CUDA 11.8 – download from the NVIDIA Developer site.
    • NVIDIA driver ≥ 511 (your driver 552.74 is fine).
  3. Add the CUDA folders to PATH (or set them in the process environment):

    set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8
    set PATH=%CUDA_PATH%\bin;%CUDA_PATH%\libnvvp;%PATH%
    
  4. Verify the installation

    nvcc --version          :: should report 11.8
    nvidia-smi              :: should show driver 552.74 and your RTX 2000E
    
  5. Reference the required NuGet packages

    <PackageReference Include="Aspose.OCR.GPU" Version="25.10.0" />
    <PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.16.3" />
    
  6. Run a quick test (see code below). If everything is set up correctly the OCR engine will detect the GPU and process the image without throwing a “missing CUDA runtime” exception.


Minimal OCR‑GPU code example (C#)

using System;
using System.Drawing;                     // System.Drawing.Common
using System.IO;
using Aspose.OCR;
using Aspose.OCR.Gpu;                     // GPU‑specific assembly

class Program
{
    static void Main()
    {
        // Load an image (replace with your own source)
        using var bitmap = new Bitmap("sample.png");
        using var ms = new MemoryStream();
        bitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        ms.Position = 0;

        // Create the OCR engine with GPU enabled
        var ocr = new OcrEngine(new OcrEngineOptions
        {
            Language = OcrLanguage.English,
            UseGpu   = true                     // forces GPU usage
        });

        // Perform OCR
        var result = ocr.Recognize(ms);
        Console.WriteLine("Recognized text:");
        Console.WriteLine(result.Text);
    }
}

If UseGpu = true cannot locate a compatible CUDA runtime, the constructor throws an exception that mentions the missing or mismatched CUDA/cuDNN version – exactly the symptom you observed with CUDA 12.


What if you really need CUDA 12?

  • No official workaround exists today. The native libraries would have to be rebuilt against the newer CUDA runtime, which only Aspose can provide.
  • Future releases may add CUDA 12 support – keep an eye on the Aspose.OCR‑GPU release notes.
  • In the meantime you can:
    • Use the CPU‑only Aspose.OCR package (still fast for many workloads).
    • Run several OCR tasks in parallel on the same GPU (if memory permits) to increase throughput.
    • Evaluate other OCR engines that already support CUDA 12, if GPU speed is a hard requirement.

TL;DR – supported environment for Aspose.OCR‑GPU v25.10.0

Component Required version
CUDA Toolkit 11.8 (exact)
cuDNN 8.6 (exact)
NVIDIA driver ≥ 511 (your 552.74 is fine)
OS Windows Server 2019 (supported)

Install those exact versions, set CUDA_PATH/PATH, reference the two NuGet packages, and the GPU‑accelerated OCR will work. CUDA 12 or cuDNN 8.8 cannot be used with the current Aspose package; you must either downgrade to the supported stack or switch to the CPU version until a newer Aspose release adds support.

Thank you so much for that detailed response. It would have saved me a lot of time and effort if I had asked this question a long time ago. It also would be nice if the web page for the GPU package mentioned something about not supporting CUDA 12.

I see no advantage to the GPU libraries (at least for my use case) if they are so much slower than the CPU versions. If I’m using the trial license instead of the temp license (it expired after 30 days), will that make it a lot slower?

@tfid

Changing your license will not effect the performance or execution of the API as it only poses restrictions on extracting limited text from the provided images. Nevertheless, we will surely update our documentation for the information related to CUDA toolkit. Please feel free to let us know if you need any kind of information further.