This project can be used to generate a nuget holding tensorflow cpu libraries for windows and linux runtimes. The Copy-NativeTensorFlowLibs.ps1 script can be used to download all the libraries from Google. The examples have been updated to use this nuget to check that things are working. (Make sure to update your package source to have the packages directory in your nuget source before trying this at home).tags/v0.12
@@ -22,6 +22,7 @@ EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowDatasets", "src\TensorFlowDatasets\TensorFlowDatasets.csproj", "{DF151A51-E9FD-41BD-B0F4-08A743755D44}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TensorFlowNET.Examples.GPU", "test\TensorFlowNET.Examples\TensorFlowNET.Examples.GPU.csproj", "{6F6B3382-8F87-4CD9-BF87-C81D5405685A}" | |||
EndProject | |||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EA9A238E-B93F-4809-AB3D-339B2990FBFF}" | |||
ProjectSection(SolutionItems) = preProject | |||
scripts\Copy-NativeTensorFlowLibs.ps1 = scripts\Copy-NativeTensorFlowLibs.ps1 | |||
@@ -33,6 +34,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SciSharp.TensorFlow-Gpu.Red | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist", "src\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj", "{E26AA660-F734-444C-A982-3F19C2AF8829}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist", "src\runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist\runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist.csproj", "{54ED61EB-DE05-4052-A92D-15B26478E700}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist", "src\runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist\runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist.csproj", "{977C27F4-2196-4CA4-9A79-80A0F72DBB11}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SciSharp.TensorFlow-Cpu.Redist", "src\SciSharp.TensorFlow-Cpu.Redist\SciSharp.TensorFlow-Cpu.Redist.csproj", "{6AD4A403-2E82-4795-AC61-50D8B271CFC8}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
@@ -91,6 +98,18 @@ Global | |||
{E26AA660-F734-444C-A982-3F19C2AF8829}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{E26AA660-F734-444C-A982-3F19C2AF8829}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{E26AA660-F734-444C-A982-3F19C2AF8829}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{54ED61EB-DE05-4052-A92D-15B26478E700}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{54ED61EB-DE05-4052-A92D-15B26478E700}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{54ED61EB-DE05-4052-A92D-15B26478E700}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{54ED61EB-DE05-4052-A92D-15B26478E700}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{977C27F4-2196-4CA4-9A79-80A0F72DBB11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{977C27F4-2196-4CA4-9A79-80A0F72DBB11}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{977C27F4-2196-4CA4-9A79-80A0F72DBB11}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{977C27F4-2196-4CA4-9A79-80A0F72DBB11}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{6AD4A403-2E82-4795-AC61-50D8B271CFC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{6AD4A403-2E82-4795-AC61-50D8B271CFC8}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{6AD4A403-2E82-4795-AC61-50D8B271CFC8}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{6AD4A403-2E82-4795-AC61-50D8B271CFC8}.Release|Any CPU.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
@@ -7,14 +7,22 @@ | |||
The TensorFlow libraries are copied for Windows and Linux and it becomes | |||
possible to bundle a meta-package containing them. | |||
.PARAMETER CpuLibraries | |||
Switch indicating if the script should download the CPU or GPU version of the | |||
.PARAMETER SkipCpuLibraries | |||
Setting this to true skips the downloading of the CPU version of the | |||
TensorFlow libraries. | |||
By default the GPU version of the libraries is downloaded. | |||
By default the CPU version of the libraries are downloaded and put in the | |||
relevant projects. | |||
.PARAMETER SkipGpuLibraries | |||
Setting this to tru skips the downloading of the GPU version of the | |||
TensorFlow libraries. | |||
By default the GPU version of the libraries are downloaded and put in the | |||
releavant projects. | |||
#> | |||
param( | |||
[switch] $CpuLibraries = $false | |||
[switch] $SkipCpuLibraries = $false, | |||
[switch] $SkipGpuLibraries = $false | |||
) | |||
function Expand-TarGzFiles { | |||
@@ -128,22 +136,32 @@ function Copy-Archive { | |||
} | |||
$LinuxGpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-linux-x86_64-1.14.0.tar.gz" | |||
$LinuxCpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.14.0.tar.gz" | |||
$LinuxFiles = @(".\libtensorflow.tar", ".\lib\libtensorflow.so", ".\lib\libtensorflow.so.1", ".\lib\libtensorflow.so.1.14.0", ` | |||
".\lib\libtensorflow_framework.so", ".\lib\libtensorflow_framework.so.1", ".\lib\libtensorflow_framework.so.1.14.0") | |||
$WindowsGpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.14.0.zip" | |||
$WindowsCpuArchive = "https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-windows-x86_64-1.14.0.zip" | |||
$WindowsFiles = @("lib\tensorflow.dll") | |||
$PackagesDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "packages") | |||
if (-not $CpuLibraries) { | |||
$WindowsArchive = $WindowsGpuArchive | |||
$LinuxArchive = $LinuxGpuArchive | |||
if (-not $SkipGpuLibraries) { | |||
$Archive = Copy-Archive -ArchiveUrl $WindowsGpuArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist") | |||
Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory | |||
$Archive = Copy-Archive -ArchiveUrl $LinuxGpuArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist") | |||
Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory | |||
} | |||
$Archive = Copy-Archive -ArchiveUrl $WindowsArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist") | |||
Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory | |||
if (-not $SkipCpuLibraries) { | |||
$Archive = Copy-Archive -ArchiveUrl $WindowsCpuArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist") | |||
Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory | |||
$Archive = Copy-Archive -ArchiveUrl $LinuxCpuArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist") | |||
Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory | |||
} | |||
$Archive = Copy-Archive -ArchiveUrl $LinuxArchive -TargetDirectory $PackagesDirectory | |||
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "src", "runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist") | |||
Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory |
@@ -0,0 +1,63 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers> | |||
<AssemblyName>SciSharp.Tensorflow-Cpu.Redist</AssemblyName> | |||
<PackageId>SciSharp.Tensorflow-Cpu.Redist</PackageId> | |||
<Version>1.0.0</Version> | |||
<Authors>SciSharp team</Authors> | |||
<Company>SciSharp STACK</Company> | |||
<RepositoryUrl>https://github.com/SciSharp/TensorFlow.NET</RepositoryUrl> | |||
<RepositoryType>git</RepositoryType> | |||
<Description> | |||
Meta-package for GPU Tensoflow library runtime distribution. | |||
Libraries can be directly downloaded from https://storage.googleapis.com/tensorflow/libtensorflow/ | |||
</Description> | |||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | |||
<PackageProjectUrl>https://github.com/SciSharp/TensorFlow.NET</PackageProjectUrl> | |||
<PackageTags>native;tensorflow;machine-learning;ML</PackageTags> | |||
<PackageOutputPath>../../packages</PackageOutputPath> | |||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | |||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | |||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> | |||
<IncludeBuildOutput>false</IncludeBuildOutput> | |||
</PropertyGroup> | |||
<!-- Need to add some dependencies so Meta-Project will pull runtime Project(s) --> | |||
<Target Name="ValidateRuntimePack" BeforeTargets="GenerateNuspec"> | |||
<ItemGroup> | |||
<RuntimeLinux Include="../../packages/runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist.*.nupkg" /> | |||
<RuntimeWin Include="../../packages/runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist.*.nupkg" /> | |||
</ItemGroup> | |||
<Message Importance="high" Text="Package runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist: found" Condition="Exists('@(RuntimeLinux)')" /> | |||
<Message Importance="high" Text="Package runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist: not found" Condition="!Exists('@(RuntimeLinux)')" /> | |||
<Message Importance="high" Text="Package runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist: found" Condition="Exists('@(RuntimeWin)')" /> | |||
<Message Importance="high" Text="Package runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist: not found" Condition="!Exists('@(RuntimeWin)')" /> | |||
<Error Text="You must locally 'dotnet pack' at least one runtime.{rid}.SciSharp.Tensorflow-Cpu.Redist project." Condition="!Exists('@(RuntimeLinux)') AND !Exists('@(RuntimeWin)')" /> | |||
</Target> | |||
<PropertyGroup> | |||
<RestoreSources>../../packages;$(RestoreSources);https://api.nuget.org/v3/index.json</RestoreSources> | |||
</PropertyGroup> | |||
<ItemGroup Condition="Exists('../../packages/runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist.1.0.0.nupkg')"> | |||
<PackageReference Include="runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist" Version="1.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup Condition="Exists('../../packages/runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist.1.0.0.nupkg')"> | |||
<PackageReference Include="runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist" Version="1.0.0" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<RuntimeLinux Include="../../packages/runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist.*.nupkg" /> | |||
<RuntimeWin Include="../../packages/runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist.*.nupkg" /> | |||
<Content Include="runtime.json" Condition="Exists('@(RuntimeLinux)') AND Exists('@(RuntimeWin)')"> | |||
<PackagePath>runtime.json</PackagePath> | |||
<Pack>true</Pack> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,14 @@ | |||
{ | |||
"runtimes": { | |||
"linux-x64": { | |||
"SciSharp.TensorFlow-Gpu.Redist": { | |||
"runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist": "1.0.0" | |||
} | |||
}, | |||
"win-x64": { | |||
"SciSharp.TensorFlow-Gpu.Redist": { | |||
"runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist": "1.0.0" | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> | |||
<AssemblyName>SciSharp.Tensorflow-Cpu.Redist</AssemblyName> | |||
<PackageId>runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist</PackageId> | |||
<Version>1.0.0</Version> | |||
<Authors>SciSharp team</Authors> | |||
<Company>SciSharp STACK</Company> | |||
<RepositoryUrl>https://github.com/SciSharp/TensorFlow.NET</RepositoryUrl> | |||
<RepositoryType>git</RepositoryType> | |||
<Description> | |||
Distribution of the Linux CPU Tensoflow library. | |||
The libraries can be directly downloaded from https://storage.googleapis.com/tensorflow/libtensorflow/ | |||
</Description> | |||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | |||
<PackageProjectUrl>https://github.com/SciSharp/TensorFlow.NET</PackageProjectUrl> | |||
<PackageTags>native;tensorflow;machine-learning;ML</PackageTags> | |||
<PackageOutputPath>../../packages</PackageOutputPath> | |||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | |||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | |||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> | |||
<IncludeBuildOutput>false</IncludeBuildOutput> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<!-- All dlls will be dropped in a folder available through DllImport.--> | |||
<Content Include="*.so.*"> | |||
<PackagePath>runtimes/$(RuntimeIdentifier)/native/%(Filename)%(Extension)</PackagePath> | |||
<Pack>true</Pack> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,39 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>netstandard2.0</TargetFramework> | |||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | |||
<AssemblyName>SciSharp.Tensorflow-Cpu.Redist</AssemblyName> | |||
<PackageId>runtime.win-x64.SciSharp.Tensorflow-Cpu.Redist</PackageId> | |||
<Version>1.0.0</Version> | |||
<Authors>SciSharp team</Authors> | |||
<Company>SciSharp STACK</Company> | |||
<RepositoryUrl>https://github.com/SciSharp/TensorFlow.NET</RepositoryUrl> | |||
<RepositoryType>git</RepositoryType> | |||
<Description> | |||
Distribution of the windows GPU Tensoflow library. | |||
The libraries can be directly downloaded from https://storage.googleapis.com/tensorflow/libtensorflow/ | |||
</Description> | |||
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression> | |||
<PackageProjectUrl>https://github.com/SciSharp/TensorFlow.NET</PackageProjectUrl> | |||
<PackageTags>native;tensorflow;machine-learning;ML</PackageTags> | |||
<PackageOutputPath>../../packages</PackageOutputPath> | |||
<GeneratePackageOnBuild>false</GeneratePackageOnBuild> | |||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems> | |||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> | |||
<IncludeBuildOutput>false</IncludeBuildOutput> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<!-- All dlls will be dropped in a folder available through DllImport.--> | |||
<Content Include="*.dll"> | |||
<PackagePath>runtimes/$(RuntimeIdentifier)/native/%(Filename)%(Extension)</PackagePath> | |||
<Pack>true</Pack> | |||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | |||
</Content> | |||
</ItemGroup> | |||
</Project> |
@@ -13,7 +13,8 @@ | |||
<ItemGroup> | |||
<PackageReference Include="Colorful.Console" Version="1.2.9" /> | |||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> | |||
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.14.0" /> | |||
<PackageReference Include="SciSharp.TensorFlow-Cpu.Redist" Version="1.0.0" /> | |||
<!--<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.14.0" />--> | |||
<PackageReference Include="SharpZipLib" Version="1.1.0" /> | |||
<PackageReference Include="System.Drawing.Common" Version="4.5.1" /> | |||
</ItemGroup> | |||