Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Build] [Linux] [.NET] Microsoft.ML.OnnxRuntime.Gpu keep publishing unnecessary DLL large files for linux-x64 #23077

Open
jiaxuwu2021 opened this issue Dec 11, 2024 · 2 comments
Labels
api:CSharp issues related to the C# API build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider .NET Pull requests that update .net code stale issues that have not been addressed in a while; categorized by a bot

Comments

@jiaxuwu2021
Copy link

Describe the issue

Nuget package Microsoft.ML.OnnxRuntime.Gpu 1.20.1 keep publishing DLL files for linux-x64, especially onnxruntime_providers_cuda.dll which is very large (>600MB), these DLL files are unnecessary to linux
Image
Please fix to stop publishing these onnxruntime*.dll files for linux-x64 when dotnet build/dotnet publish, otherwise the final binaries size will be double (both cuda.so and cuda.dll >600MB)


One possible clue: it seems that this file Microsoft.ML.OnnxRuntime.Gpu.Windows.props is trying to copy DLL files for all x64 platforms including linux-x64.
Image

Related issue: microsoft/onnxruntime-genai#1135

Urgency

No response

Target platform

linux-x64

Build script

build linux-x64 under linux command line:
dotnet publish test.csproj --runtime linux-x64

  • test.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
    <PublishAot>true</PublishAot>
    <IsPackable>false</IsPackable>
    <SelfContained>true</SelfContained>
  </PropertyGroup>

  <!-- OnnxRuntime CUDA https://onnxruntime.ai/docs/get-started/with-csharp.html#builds -->
  <ItemGroup>
    <PackageReference Include="Microsoft.ML.OnnxRuntime.Gpu" Version="1.20.1" />
  </ItemGroup>
</Project>
  • Program.cs
namespace MyTest;

using Microsoft.ML.OnnxRuntime;

public class Program
{
    public static async Task Main(string[] args)
    {
        const string modelPath = "/home/jiaxuwu/.aitk/models/onnx/cuda/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32/mistral-7b-instruct-v0.2-cuda-int4-rtn-block-32.onnx";
        using var session = new InferenceSession(modelPath);
    }
}

Error / output

There are many DLL files in the final binaries

$ ll -h bin/Release/net8/linux-x64/publish/onnxruntime*.dll
...  12M Nov 19 23:09 bin/Release/net8/linux-x64/publish/onnxruntime.dll*
... 643M Nov 19 23:10 bin/Release/net8/linux-x64/publish/onnxruntime_providers_cuda.dll*
...  22K Nov 19 23:10 bin/Release/net8/linux-x64/publish/onnxruntime_providers_shared.dll*
... 744K Nov 19 23:09 bin/Release/net8/linux-x64/publish/onnxruntime_providers_tensorrt.dll*
$ ll -h bin/Release/net8/linux-x64/onnxruntime*.dll
...  12M Nov 19 23:09 bin/Release/net8/linux-x64/onnxruntime.dll*
... 643M Nov 19 23:10 bin/Release/net8/linux-x64/onnxruntime_providers_cuda.dll*
...  22K Nov 19 23:10 bin/Release/net8/linux-x64/onnxruntime_providers_shared.dll*
... 744K Nov 19 23:09 bin/Release/net8/linux-x64/onnxruntime_providers_tensorrt.dll*

Visual Studio Version

No response

GCC / Compiler Version

No response

@jiaxuwu2021
Copy link
Author

ep:CUDA

Copy link
Contributor

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api:CSharp issues related to the C# API build build issues; typically submitted using template ep:CUDA issues related to the CUDA execution provider .NET Pull requests that update .net code stale issues that have not been addressed in a while; categorized by a bot
Projects
None yet
Development

No branches or pull requests

2 participants