dotnet / machinelearning

ML.NET is an open source and cross-platform machine learning framework for .NET.
https://dot.net/ml
MIT License
9.02k stars 1.88k forks source link

GPU cann't be used after deploy with Microsoft.ML.OnnxRuntime.Gpu #6933

Closed evolcano closed 8 months ago

evolcano commented 9 months ago

System Information (please complete the following information):

Describe the bug I download a demo for object detection. My laptop has two GPU: 0 intel & 1 Nvidia, so I have set ""Environment.SetEnvironmentVariable("CUDA_VISIBLE_DEVICES", "1"); (Source code: yolov5-net-master.zip ) When in debug mode, GPU is used, it's seems good. But after deploy without any change just change to release model, GPU is not used.

To Reproduce Steps to reproduce the behavior:

  1. Open sloution;
  2. Debug, Gpu is used
  3. Delopy to local file system in release win-x64, net8.0-windows
  4. Click exe to execute, GPU cann't be used

Expected behavior GPU should be used after deploy and consist with debug.

Screenshots, Code, Sample Projects 1、When debug, GPU is used image

2、Deploy setting image

3、When deployed, GPU cann't use image

Additional context NVIDIA-SMI 546.33 Driver Version: 546.33 cuda_11.6.2_511.65_windows cudnn-windows-x86_64-8.9.6.50_cuda11

evolcano commented 8 months ago

Maybe the GPU is actually used because the temperature is increasing...

I can see the usage of GPU now after reinstall.