Skip to content

LibTorch 2.7.1 and cuda 12.8 upgrade #1486

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

Merged
merged 44 commits into from
Jul 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
a2bdfdb
test initial attempt libtorch upgrade
alinpahontu2912 Jul 7, 2025
2b27ed2
enable testing
alinpahontu2912 Jul 7, 2025
abc1ec6
retrigger
alinpahontu2912 Jul 7, 2025
bef4ed8
run build cuda packages
alinpahontu2912 Jul 8, 2025
38036ff
Merge branch 'main' of https://github.com/alinpahontu2912/TorchSharp
alinpahontu2912 Jul 8, 2025
03705b8
enable all workflows
alinpahontu2912 Jul 8, 2025
27e2da7
retrigger
alinpahontu2912 Jul 8, 2025
c0e8863
retrigger
alinpahontu2912 Jul 8, 2025
2f49628
revert to original azure pipelines
alinpahontu2912 Jul 8, 2025
af70eec
build libtorch cuda workflow test
alinpahontu2912 Jul 8, 2025
d351d20
undo pipelines changes
alinpahontu2912 Jul 8, 2025
dda1f74
disable fork pull request check
alinpahontu2912 Jul 8, 2025
61e98a1
use correct cuda version in azure pipelines
alinpahontu2912 Jul 8, 2025
8c5526c
test conditions
alinpahontu2912 Jul 8, 2025
78216cf
set buildlibtorchpackages to true
alinpahontu2912 Jul 10, 2025
5756844
test build and sign
alinpahontu2912 Jul 10, 2025
31fc2a3
fix conditions
alinpahontu2912 Jul 10, 2025
a857f27
change condition
alinpahontu2912 Jul 10, 2025
b934907
test
alinpahontu2912 Jul 10, 2025
b286d78
undo comment
alinpahontu2912 Jul 10, 2025
3b07255
test
alinpahontu2912 Jul 10, 2025
50f81a6
add debug to pack.proj
alinpahontu2912 Jul 11, 2025
72e656f
extra debugging
alinpahontu2912 Jul 11, 2025
405e479
test
alinpahontu2912 Jul 11, 2025
1ef86ff
update names
alinpahontu2912 Jul 11, 2025
bba4f59
split linux cuda packages
alinpahontu2912 Jul 14, 2025
a1201f8
attempt restitch windows packages
alinpahontu2912 Jul 14, 2025
be72ff5
disable parallel windows cuda and linux cuda jobs
alinpahontu2912 Jul 14, 2025
ca39c83
fix condition
alinpahontu2912 Jul 14, 2025
35b39a0
update packages project files
alinpahontu2912 Jul 14, 2025
b71b98b
minimize jobs
alinpahontu2912 Jul 14, 2025
1fe0996
change jobs dependencies
alinpahontu2912 Jul 14, 2025
def759f
change dependencies
alinpahontu2912 Jul 14, 2025
acdc68c
test new approach
alinpahontu2912 Jul 15, 2025
1b18547
fix yaml styling
alinpahontu2912 Jul 15, 2025
4e064f6
restitch windows cuda packages
alinpahontu2912 Jul 15, 2025
c985303
update cuda nuggets splits
alinpahontu2912 Jul 15, 2025
9f6d291
add missing windows cuda dll
alinpahontu2912 Jul 17, 2025
80449e9
update cuda load dll
alinpahontu2912 Jul 17, 2025
b8e5280
fix references
alinpahontu2912 Jul 23, 2025
4f2dc30
try load multiple dlls
alinpahontu2912 Jul 23, 2025
077a325
fix project package
alinpahontu2912 Jul 25, 2025
473ac33
remove debug prints and update devguide and releasenotes
alinpahontu2912 Jul 29, 2025
2244f1a
keep track of current size of libraries
alinpahontu2912 Jul 29, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions DEVGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ For this reason, we do the following
1. The head, referenceable packages that deliver a functioning runtime are any of:

libtorch-cpu
libtorch-cuda-12.1-linux-x64
libtorch-cuda-12.1-win-x64
libtorch-cuda-12.8-linux-x64
libtorch-cuda-12.8-win-x64

2. These packages are combo packages that reference multiple parts. The parts are **not** independently useful.
Some parts deliver a single vast file via `primary` and `fragment` packages. A build task is then used to "stitch" these files back together
Expand All @@ -120,7 +120,7 @@ For this reason, we do the following
install/detect/link of PyTorch CUDA on all downstream systems, whcih is extremely problematic
for many practical reasons).

For example, the CUDA package fragments are defined in [libtorch-cuda](src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj). See more details later in this document.
For example, the CUDA package fragments are defined in [libtorch-cuda](src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj). See more details later in this document.

3. The `libtorch-*` packages are built in Azure DevOps CI
[using this build pipeline](https://donsyme.visualstudio.com/TorchSharp/_build?definitionId=1&_a=summary) but only in main
Expand Down Expand Up @@ -166,12 +166,12 @@ version of PyTorch then quite a lot of careful work needs to be done.

To update the version, update this in [Dependencies.props](build/Dependencies.props):

<LibTorchVersion>2.2.0</LibTorchVersion>
<LibTorchVersion>2.7.1</LibTorchVersion>

The libtorch version number is also referenced in source code, in the file 'src/TorchSharp/Torch.cs':

```C#
const string libtorchPackageVersion = "2.2.0.1";
const string libtorchPackageVersion = "2.7.1.0";
```

3. Run these to test downloads and update SHA hashes for the various LibTorch downloads
Expand All @@ -183,9 +183,9 @@ On Windows:
dotnet build src\Redist\libtorch-cpu\libtorch-cpu.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCpuPackages=true
dotnet build src\Redist\libtorch-cpu\libtorch-cpu.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCpuPackages=true

dotnet build src\Redist\libtorch-cuda-12.1\libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=linux /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src\Redist\libtorch-cuda-12.1\libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src\Redist\libtorch-cuda-12.1\libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src\Redist\libtorch-cuda-12.8\libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=linux /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src\Redist\libtorch-cuda-12.8\libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src\Redist\libtorch-cuda-12.8\libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCudaPackages=true

On Linux / Mac:

Expand All @@ -194,23 +194,23 @@ On Linux / Mac:
dotnet build src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCpuPackages=true
dotnet build src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCpuPackages=true

dotnet build src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=linux /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=linux /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Release /t:Build /p:IncludeLibTorchCudaPackages=true
dotnet build src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:TargetOS=windows /p:Configuration=Debug /t:Build /p:IncludeLibTorchCudaPackages=true


Each of these will take a **very very long time** depending on your broadband connection. This can't currently be done in CI.
Each of these can take a **very very long time** depending on your broadband connection. This can't currently be done in CI.

If file names in the distribution have changed, or files have been removed, you will get errors saying that files cannot be found. That's okay and will be taken care of in the next step.

4. At this point you must **very very carefully** update the `<File Include= ...` entries under src\Redist projects for
[libtorch-cpu](src/Redist/libtorch-cpu/libtorch-cpu.proj) and [libtorch-cuda](src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj).
[libtorch-cpu](src/Redist/libtorch-cpu/libtorch-cpu.proj) and [libtorch-cuda](src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj).

This is the step in the upgrade process that takes the most effort and time. It requires extreme care.

Check the contents of the unzip of the archive, e.g.

dir bin\obj\x64.Release\libtorch-cpu\libtorch-cxx11-abi-shared-with-deps-2.2.0cpu\libtorch\lib\*.so*
dir bin\obj\x64.Release\libtorch-cpu\libtorch-cxx11-abi-shared-with-deps-2.7.1cpu\libtorch\lib\*.so*

You may also need to precisely refactor the binaries into multiple parts so each package ends up under ~300MB. Before release 2.2.0 of libtorch, this really only affected the CUDA packagages, but it is now also affecting the CPU packages on Linux and OSX. Windows CPU is still small enough to be contained in just one package. The NuGet gallery does not allow packages larger than 250MB, so if files are 300MB, after compression, they are likely to be smaller than 250MB. However, you have to look out: if the compression is poor, then packages may end up larger. Note that it is 250 million
bytes that is the limit, **not** 250*1024*1024. In other words, it is 250 MB, not 250 MiB. Note that Windows Explorer will show file sizes in KiB, not thousands of bytes. Use 'dir' from a CMD window to get the exact size in bytes for each file. For example -- the file `libtorch_cpu.so` shows up as 511,872 KB in Windows Explorer, but 524,156,144 bytes in CMD. The 2.4% difference can be significant. Getting the partitioning right requires precision.
Expand Down Expand Up @@ -256,7 +256,7 @@ On Linux / Mac:
5. Add the SHA files:

git add src\Redist\libtorch-cpu\*.sha
git add src\Redist\libtorch-cuda-12.1\*.sha
git add src\Redist\libtorch-cuda-12.8\*.sha

After this you may as well submit to CI just to see what happens, though keep going with the other steps below as well.

Expand Down Expand Up @@ -290,10 +290,12 @@ On Linux / Mac:
dotnet test -c Debug
dotnet test -c Release

**Note**: The CI does not run tests for the CUDA packages on Linux or Windows, they have to be executed manually.

10. Try building packages locally. The build (including CI) doesn't build `libtorch-*` packages by default, just the managed package. To
get CI to build new `libtorch-*` packages update this version and set `BuildLibTorchPackages` in [azure-pipelines.yml](azure-pipelines.yml):

<LibTorchPackageVersion>2.0.1.1</LibTorchPackageVersion>
<LibTorchPackageVersion>2.7.1.0</LibTorchPackageVersion>

dotnet pack -c Release -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=true /p:IncludeLibTorchCpuPackages=true /p:IncludeLibTorchCudaPackages=true
dotnet pack -c Release -v:n /p:SkipNative=true /p:SkipTests=true /p:TargetOS=linux /p:IncludeTorchSharpPackage=true /p:IncludeLibTorchCpuPackages=true /p:IncludeLibTorchCudaPackages=true
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<SourceDir>$(RepoRoot)src/</SourceDir>
<PkgDir>$(RepoRoot)pkg/</PkgDir>

<LibTorchPackageVersion>2.5.1.0</LibTorchPackageVersion>
<LibTorchPackageVersion>2.7.1.0</LibTorchPackageVersion>
<LibTorchPackageVersion Condition="'$(TargetOS)' == 'mac' and '$(TargetArchitecture)' == 'x64'">2.2.2.0</LibTorchPackageVersion>

<!-- when building on local machines the massive downloads get placed up one directory -->
Expand Down Expand Up @@ -86,7 +86,7 @@
<!-- use stable versions for libtorch packages based on LibTorch version number scheme-->
<!-- we manually update these -->
<PropertyGroup Condition="'$(MSBuildProjectName.IndexOf(`libtorch-`))' != '-1'">
<LibTorchPackageVersion>2.5.1.0</LibTorchPackageVersion>
<LibTorchPackageVersion>2.7.1.0</LibTorchPackageVersion>
<LibTorchPackageVersion Condition="'$(TargetOS)' == 'mac' and '$(TargetArchitecture)' == 'x64'">2.2.2.0</LibTorchPackageVersion>
<EnablePackageValidation>false</EnablePackageValidation>
<VersionPrefix>$(LibTorchPackageVersion)</VersionPrefix>
Expand Down
5 changes: 3 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<NativeAssemblyReference Include="cudnn_ops64_9" Variant="cuda\" />
<NativeAssemblyReference Include="cufft64_11" Variant="cuda\" />
<NativeAssemblyReference Include="cufftw64_11" Variant="cuda\" />
<NativeAssemblyReference Include="cupti64_2023.1.1" Variant="cuda\" />
<NativeAssemblyReference Include="cupti64_2025.1.0" Variant="cuda\" />
<NativeAssemblyReference Include="curand64_10" Variant="cuda\" />
<NativeAssemblyReference Include="cusolver64_11" Variant="cuda\" />
<NativeAssemblyReference Include="cusolverMg64_11" Variant="cuda\" />
Expand All @@ -49,8 +49,9 @@
<NativeAssemblyReference Include="libiompstubs5md" Variant="cuda\" />
<NativeAssemblyReference Include="nvJitLink_120_0" Variant="cuda\" />
<NativeAssemblyReference Include="nvToolsExt64_1" Variant="cuda\" />
<NativeAssemblyReference Include="nvrtc-builtins64_121" Variant="cuda\" />
<NativeAssemblyReference Include="nvrtc-builtins64_128" Variant="cuda\" />
<NativeAssemblyReference Include="nvrtc64_120_0" Variant="cuda\" />
<NativeAssemblyReference Include="nvrtc64_120_0.alt" Variant="cuda\" />
<NativeAssemblyReference Include="torch" Variant="cuda\" />
<NativeAssemblyReference Include="torch_cpu" Variant="cuda\" />
<NativeAssemblyReference Include="torch_cuda" Variant="cuda\" />
Expand Down
4 changes: 4 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## TorchSharp Release Notes

Releases, starting with 9/2/2021, are listed with the most recent release at the top.
# NuGet Version 0.105.2

This release upgrades the libtorch backend to v2.7.1, using CUDA 12.8.

# NuGet Version 0.105.1

__Bug Fixes__:
Expand Down
18 changes: 7 additions & 11 deletions TorchSharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TorchSharp", "TorchSharp",
pkg\TorchSharp\TorchSharp.symbols.nupkgproj = pkg\TorchSharp\TorchSharp.symbols.nupkgproj
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTorchSharp", "bin\obj\x64.Debug\Native\LibTorchSharp\LibTorchSharp.vcxproj", "{CAD9DB7F-3223-3324-884D-FA2381593DA7}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTorchSharp", "bin\obj\x64.Debug\Native\LibTorchSharp\LibTorchSharp.vcxproj", "{E7467DDF-893C-38A8-8E19-6B4E3FB10F55}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LibTorchSharp", "bin\obj\x64.Release\Native\LibTorchSharp\LibTorchSharp.vcxproj", "{BB811429-0DF1-3D22-B664-09C2F5A9E0AB}"
EndProject
Expand All @@ -46,7 +46,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Redist", "Redist", "{D8C60CD8-8429-45F2-A755-47B6CD10FDF8}"
ProjectSection(SolutionItems) = preProject
src\Redist\libtorch-cpu\libtorch-cpu.proj = src\Redist\libtorch-cpu\libtorch-cpu.proj
src\Redist\libtorch-cuda-12.1\libtorch-cuda-12.1.proj = src\Redist\libtorch-cuda-12.1\libtorch-cuda-12.1.proj
src\Redist\libtorch-cuda-12.8\libtorch-cuda-12.8.proj = src\Redist\libtorch-cuda-12.8\libtorch-cuda-12.8.proj
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Native-Release", "Native-Release", "{4DB9E84D-324C-408F-87A6-246E86205540}"
Expand Down Expand Up @@ -107,14 +107,10 @@ Global
{42B45168-476D-4BFA-87B8-81A34E6295CD}.Release|Any CPU.Build.0 = Release|Any CPU
{42B45168-476D-4BFA-87B8-81A34E6295CD}.Release|x64.ActiveCfg = Release|Any CPU
{42B45168-476D-4BFA-87B8-81A34E6295CD}.Release|x64.Build.0 = Release|Any CPU
{CAD9DB7F-3223-3324-884D-FA2381593DA7}.Debug|Any CPU.ActiveCfg = Debug|x64
{CAD9DB7F-3223-3324-884D-FA2381593DA7}.Debug|x64.ActiveCfg = Debug|x64
{CAD9DB7F-3223-3324-884D-FA2381593DA7}.Release|Any CPU.ActiveCfg = Release|x64
{CAD9DB7F-3223-3324-884D-FA2381593DA7}.Release|x64.ActiveCfg = Release|x64
{E4C0DBEE-0815-311B-9065-137BB50BD793}.Debug|Any CPU.ActiveCfg = Debug|x64
{E4C0DBEE-0815-311B-9065-137BB50BD793}.Debug|x64.ActiveCfg = Debug|x64
{E4C0DBEE-0815-311B-9065-137BB50BD793}.Release|Any CPU.ActiveCfg = Release|x64
{E4C0DBEE-0815-311B-9065-137BB50BD793}.Release|x64.ActiveCfg = Release|x64
{E7467DDF-893C-38A8-8E19-6B4E3FB10F55}.Debug|Any CPU.ActiveCfg = Debug|x64
{E7467DDF-893C-38A8-8E19-6B4E3FB10F55}.Debug|x64.ActiveCfg = Debug|x64
{E7467DDF-893C-38A8-8E19-6B4E3FB10F55}.Release|Any CPU.ActiveCfg = Release|x64
{E7467DDF-893C-38A8-8E19-6B4E3FB10F55}.Release|x64.ActiveCfg = Release|x64
{DD652544-711E-4029-83FF-DA4A9600E6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DD652544-711E-4029-83FF-DA4A9600E6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DD652544-711E-4029-83FF-DA4A9600E6E7}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -180,7 +176,7 @@ Global
{6C323B05-9028-4B09-911C-3C03AE058BEE} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{42B45168-476D-4BFA-87B8-81A34E6295CD} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{567456AD-B026-4CB6-B98D-4FC930C90223} = {D3D38B03-B557-484D-8348-8BADEE4DF592}
{CAD9DB7F-3223-3324-884D-FA2381593DA7} = {CF2C1A9E-3A8A-4329-8A6E-7880C15AAC3D}
{E7467DDF-893C-38A8-8E19-6B4E3FB10F55} = {CF2C1A9E-3A8A-4329-8A6E-7880C15AAC3D}
{BB811429-0DF1-3D22-B664-09C2F5A9E0AB} = {4DB9E84D-324C-408F-87A6-246E86205540}
{CF2C1A9E-3A8A-4329-8A6E-7880C15AAC3D} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{D8C60CD8-8429-45F2-A755-47B6CD10FDF8} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
Expand Down
19 changes: 11 additions & 8 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ parameters:
# push them to the artifacts feed of the Azure CI project
- name: BuildLibTorchPackages
type: boolean
default: false
default: true
- name: PushPackagesToFeed
type: boolean
default: false

# Set which source branch to build libtorch-* packages.
# The build-libtorch jobs are only run if the source branch is the same as this value.
# The default is 'main' branch.
Expand Down Expand Up @@ -117,7 +118,7 @@ jobs:
condition: eq('${{ parameters.BuildLibTorchPackages }}', true)
displayName: Download libtorch native binaries

- script: dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=linux /t:Build /p:IncludeLibTorchCudaPackages=true
- script: dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=linux /t:Build /p:IncludeLibTorchCudaPackages=true
condition: eq('${{ parameters.BuildLibTorchPackages }}', true)
displayName: Download libtorch native CUDA binaries

Expand Down Expand Up @@ -157,7 +158,7 @@ jobs:
- script: dotnet build -c $(BuildConfig) src/Redist/libtorch-cpu/libtorch-cpu.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /t:Build /p:IncludeLibTorchCpuPackages=true
displayName: Download libtorch native binaries

- script: dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.1/libtorch-cuda-12.1.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /t:Build /p:IncludeLibTorchCudaPackages=true
- script: dotnet build -c $(BuildConfig) src/Redist/libtorch-cuda-12.8/libtorch-cuda-12.8.proj /p:UpdateSHA=true /p:SkipTests=true /p:TargetOS=windows /t:Build /p:IncludeLibTorchCudaPackages=true
condition: eq('${{ parameters.BuildLibTorchPackages }}', true)
displayName: Download libtorch native CUDA binaries

Expand Down Expand Up @@ -348,9 +349,10 @@ jobs:
# Only run if BuildLibTorchPackages is true
- job: Build_libtorch_cuda_win_Packages
################################################################################
condition: and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}'), eq('${{ parameters.BuildLibTorchPackages }}', true))
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}'), eq('${{ parameters.BuildLibTorchPackages }}', true))
dependsOn:
- Windows_Native_Build_For_Packages
- Build_TorchSharp_And_libtorch_cpu_Packages
variables:
BuildConfig: Release
OfficialBuildId: $(BUILD.BUILDNUMBER)
Expand Down Expand Up @@ -382,7 +384,7 @@ jobs:
- script: dotnet restore pkg/pack.proj /p:Configuration=Release
displayName: Restore package projects

- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true pkg/pack.proj
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true /p:TargetOS=windows pkg/pack.proj
displayName: Create Packages

# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can
Expand All @@ -403,9 +405,10 @@ jobs:
################################################################################
- job: Build_libtorch_cuda_linux_Packages
################################################################################
condition: and(ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}'), eq('${{ parameters.BuildLibTorchPackages }}', true))
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), eq(variables['build.sourcebranchname'], '${{ parameters.SourceBranchName }}'), eq('${{ parameters.BuildLibTorchPackages }}', true))
dependsOn:
- Linux_Native_Build_For_Packages
- Build_libtorch_cuda_win_Packages
variables:
BuildConfig: Release
OfficialBuildId: $(BUILD.BUILDNUMBER)
Expand Down Expand Up @@ -448,7 +451,7 @@ jobs:
- script: dotnet restore pkg/pack.proj /p:Configuration=Release
displayName: Restore package projects

- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:ApiCompatGenerateSuppressionFile=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true pkg/pack.proj
- script: dotnet pack -c $(BuildConfig) --no-build -v:n /p:SkipNative=true /p:SkipTests=true /p:ApiCompatGenerateSuppressionFile=true /p:IncludeTorchSharpPackage=false /p:IncludeLibTorchCpuPackages=false /p:IncludeLibTorchCudaPackages=true /p:TargetOS=linux pkg/pack.proj
displayName: Create Packages

# We are 10GB space-constrained on the Azure Pipelines CI system so clean up what we can
Expand Down Expand Up @@ -859,4 +862,4 @@ jobs:
publishVstsFeed: 'TorchSharp/TestPackages'
allowPackageConflicts: true
# often fails - try but ignore the error until we sort it out
continueOnError: true
continueOnError: true
4 changes: 2 additions & 2 deletions build/BranchInfo.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<MajorVersion>0</MajorVersion>
<MinorVersion>105</MinorVersion>
<PatchVersion>1</PatchVersion>
<PreviousPackageVersion>0.105.0</PreviousPackageVersion>
<PatchVersion>2</PatchVersion>
<PreviousPackageVersion>0.105.1</PreviousPackageVersion>
</PropertyGroup>
</Project>
Loading