Skip to content

Java library throws error when using CUDA: LoadLibrary failed with error 126 "" when trying to load "C:\Users\xx\AppData\Local\Temp\onnxruntime-java5278075328315693241\onnxruntime_providers_cuda.dll" #23208

@sduqlsc

Description

@sduqlsc

Describe the issue

use Java onnx gpu library and enable gpu, throws error

ai.onnxruntime.OrtException: Error code - ORT_RUNTIME_EXCEPTION - message: D:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\xxx\AppData\Local\Temp\onnxruntime-java5278075328315693241\onnxruntime_providers_cuda.dll"

        <dependency>
            <groupId>com.microsoft.onnxruntime</groupId>
            <artifactId>onnxruntime_gpu</artifactId>
            <version>1.20.0</version>
        </dependency>
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Nov_22_10:30:42_Pacific_Standard_Time_2023
Cuda compilation tools, release 12.3, V12.3.107
Build cuda_12.3.r12.3/compiler.33567101_0
NVIDIA-SMI 546.33                 Driver Version: 546.33       CUDA Version: 12.3 

I did check the tmp folder, the dll was missing.

To reproduce

// JDK 11
env = OrtEnvironment.getEnvironment();
OrtSession.SessionOptions sessionOptions = new OrtSession.SessionOptions();

sessionOptions.addCUDA(0);
session = env.createSession(weight, sessionOptions);

CUDA & CUDNN PATH configuration:

Image
Image

Urgency

No response

Platform

Windows

OS Version

11

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

onnxruntime_gpu 1.20.0

ONNX Runtime API

Java

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

CUDA 12.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    api:Javaissues related to the Java APIep:CUDAissues related to the CUDA execution providerstaleissues that have not been addressed in a while; categorized by a bot

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions