Browse Source

Merge pull request #363 from chaami/redist

Attempt to provide meta-packages for TensorFlow.lib
tags/v0.12
Haiping GitHub 6 years ago
parent
commit
b95ed0d649
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 558 additions and 0 deletions
  1. +60
    -0
      TensorFlow.NET.Redist.sln
  2. +63
    -0
      redist/SciSharp.TensorFlow-Cpu.Redist/SciSharp.TensorFlow-Cpu.Redist.csproj
  3. +14
    -0
      redist/SciSharp.TensorFlow-Cpu.Redist/runtime.json
  4. +81
    -0
      redist/SciSharp.TensorFlow-Gpu.Redist/SciSharp.TensorFlow-Gpu.Redist.csproj
  5. +14
    -0
      redist/SciSharp.TensorFlow-Gpu.Redist/runtime.json
  6. +39
    -0
      redist/runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist.csproj
  7. +40
    -0
      redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj
  8. +39
    -0
      redist/runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist/runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist.csproj
  9. +1
    -0
      redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist/.gitignore
  10. +40
    -0
      redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist.csproj
  11. +167
    -0
      scripts/Copy-NativeTensorFlowLibs.ps1
  12. BIN
      tensorflowlib/runtimes/win-x64/native/tensorflow.zip

+ 60
- 0
TensorFlow.NET.Redist.sln View File

@@ -0,0 +1,60 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{1E65784D-C976-4DFF-991A-DD5C57FFC8E2}"
ProjectSection(SolutionItems) = preProject
scripts\Copy-NativeTensorFlowLibs.ps1 = scripts\Copy-NativeTensorFlowLibs.ps1
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist", "redist\runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist\runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist.csproj", "{9834D2B4-01BF-4D18-8DCF-F498AC481FE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist", "redist\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist\runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj", "{9D853997-3143-4F87-B995-7D7024CF4E1A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist", "redist\runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist\runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist.csproj", "{878C1EE4-B945-41BF-98DE-C4747C28022A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist", "redist\runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist\runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist.csproj", "{744A3D51-CEF6-4685-B4C3-718FA61143A0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SciSharp.TensorFlow-Cpu.Redist", "redist\SciSharp.TensorFlow-Cpu.Redist\SciSharp.TensorFlow-Cpu.Redist.csproj", "{0A281E9C-6E3D-4172-84BA-2B5F6E9F4D5B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SciSharp.TensorFlow-Gpu.Redist", "redist\SciSharp.TensorFlow-Gpu.Redist\SciSharp.TensorFlow-Gpu.Redist.csproj", "{1910BE36-82E3-4465-B3B1-788BFD252DB7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{9834D2B4-01BF-4D18-8DCF-F498AC481FE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9834D2B4-01BF-4D18-8DCF-F498AC481FE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9834D2B4-01BF-4D18-8DCF-F498AC481FE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9834D2B4-01BF-4D18-8DCF-F498AC481FE7}.Release|Any CPU.Build.0 = Release|Any CPU
{9D853997-3143-4F87-B995-7D7024CF4E1A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9D853997-3143-4F87-B995-7D7024CF4E1A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9D853997-3143-4F87-B995-7D7024CF4E1A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9D853997-3143-4F87-B995-7D7024CF4E1A}.Release|Any CPU.Build.0 = Release|Any CPU
{878C1EE4-B945-41BF-98DE-C4747C28022A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{878C1EE4-B945-41BF-98DE-C4747C28022A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{878C1EE4-B945-41BF-98DE-C4747C28022A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{878C1EE4-B945-41BF-98DE-C4747C28022A}.Release|Any CPU.Build.0 = Release|Any CPU
{744A3D51-CEF6-4685-B4C3-718FA61143A0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{744A3D51-CEF6-4685-B4C3-718FA61143A0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{744A3D51-CEF6-4685-B4C3-718FA61143A0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{744A3D51-CEF6-4685-B4C3-718FA61143A0}.Release|Any CPU.Build.0 = Release|Any CPU
{0A281E9C-6E3D-4172-84BA-2B5F6E9F4D5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A281E9C-6E3D-4172-84BA-2B5F6E9F4D5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A281E9C-6E3D-4172-84BA-2B5F6E9F4D5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A281E9C-6E3D-4172-84BA-2B5F6E9F4D5B}.Release|Any CPU.Build.0 = Release|Any CPU
{1910BE36-82E3-4465-B3B1-788BFD252DB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1910BE36-82E3-4465-B3B1-788BFD252DB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1910BE36-82E3-4465-B3B1-788BFD252DB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1910BE36-82E3-4465-B3B1-788BFD252DB7}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CD7D5F34-42AE-4CCB-BDFA-1619B3A84708}
EndGlobalSection
EndGlobal

+ 63
- 0
redist/SciSharp.TensorFlow-Cpu.Redist/SciSharp.TensorFlow-Cpu.Redist.csproj View File

@@ -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>

+ 14
- 0
redist/SciSharp.TensorFlow-Cpu.Redist/runtime.json View File

@@ -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"
}
}
}
}

+ 81
- 0
redist/SciSharp.TensorFlow-Gpu.Redist/SciSharp.TensorFlow-Gpu.Redist.csproj View File

@@ -0,0 +1,81 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<!-- TensorFlow doesn't support Gpus on Mac Os. -->
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<AssemblyName>SciSharp.Tensorflow-Gpu.Redist</AssemblyName>

<PackageId>SciSharp.Tensorflow-Gpu.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-Gpu.Redist.*.nupkg" />
<RuntimeWin Include="../../packages/runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist.*.nupkg" />
</ItemGroup>
<Message
Importance="high"
Text="Package runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist: found"
Condition="Exists('@(RuntimeLinux)')" />
<Message
Importance="high"
Text="Package runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist: not found"
Condition="!Exists('@(RuntimeLinux)')" />
<Message
Importance="high"
Text="Package runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist: found"
Condition="Exists('@(RuntimeWin)')" />
<Message
Importance="high"
Text="Package runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist: not found"
Condition="!Exists('@(RuntimeWin)')" />
<Error
Text="You must locally 'dotnet pack' at least one runtime.{rid}.SciSharp.Tensorflow-Gpu.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-Gpu.Redist.1.0.0.nupkg')">
<PackageReference Include="runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist" Version="1.0.0" />
</ItemGroup>
<ItemGroup Condition="Exists('../../packages/runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist.1.0.0.nupkg')">
<PackageReference Include="runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<RuntimeLinux Include="../../packages/runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist.*.nupkg" />
<RuntimeWin Include="../../packages/runtime.win-x64.SciSharp.Tensorflow-Gpu.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>

+ 14
- 0
redist/SciSharp.TensorFlow-Gpu.Redist/runtime.json View File

@@ -0,0 +1,14 @@
{
"runtimes": {
"linux-x64": {
"SciSharp.TensorFlow-Gpu.Redist": {
"runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist": "1.0.0"
}
},
"win-x64": {
"SciSharp.TensorFlow-Gpu.Redist": {
"runtime.win-x64.SciSharp.Tensorflow-Gpu.Redist": "1.0.0"
}
}
}
}

+ 39
- 0
redist/runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Cpu.Redist.csproj View File

@@ -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>

+ 40
- 0
redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.linux-x64.SciSharp.TensorFlow-Gpu.Redist.csproj View File

@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<AssemblyName>SciSharp.Tensorflow-Gpu.Redist</AssemblyName>

<PackageId>runtime.linux-x64.SciSharp.Tensorflow-Gpu.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 GPU Tensoflow library.
Dll 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>

+ 39
- 0
redist/runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist/runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist.csproj View File

@@ -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>

+ 1
- 0
redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist/.gitignore View File

@@ -0,0 +1 @@
tensorflow.dll

+ 40
- 0
redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist/runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist.csproj View File

@@ -0,0 +1,40 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netstandard2.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<AssemblyName>SciSharp.Tensorflow-Gpu.Redist</AssemblyName>

<PackageId>runtime.win-x64.SciSharp.Tensorflow-Gpu.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.
Dll 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>

+ 167
- 0
scripts/Copy-NativeTensorFlowLibs.ps1 View File

@@ -0,0 +1,167 @@
<#
.SYNOPSIS
Copy the native TensorFlow library to enable the packing a nuget to make
them available to TensorFlow.NET

.DESCRIPTION
The TensorFlow libraries are copied for Windows and Linux and it becomes
possible to bundle a meta-package containing them.

.PARAMETER SkipCpuLibraries
Setting this to true skips the downloading of the CPU version of the
TensorFlow libraries.
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] $SkipCpuLibraries = $false,
[switch] $SkipGpuLibraries = $false
)

function Expand-TarGzFiles {
<#
.SYNOPSIS
Expands the given list of files from the given archive into the given
target directory.

.PARAMETER Archive
Path to the archive that should be considered.

.PARAMETER Files
Files that should be extracted from the archive.

.PARAMETER TargetDirectory
Directory into which the files should be expanded.

#>
param
(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $Archive,
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string []] $Files,
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $TargetDirectory
)

& 7z e $Archive -o"$TargetDirectory"
$TarArchive = Join-Path $TargetDirectory "libtensorflow.tar"

& 7z e $TarArchive $Files -o"$TargetDirectory"
Remove-Item $TarArchive
}

function Expand-ZipFiles {
<#
.SYNOPSIS
Expands the given list of files from the given archive into the given target directory.

.PARAMETER Archive
Path to the archive that should be considered.

.PARAMETER Files
Files that should be extracted from the archive.

.PARAMETER TargetDirectory
Directory into which the files should be expanded.
#>
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $Archive,
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string []] $Files,
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $TargetDirectory
)

& 7z e $Archive $Files -o"$TargetDirectory"
}

function Split-ArchiveFromUrl {
<#
.SYNOPSIS
Extracts the archive name out of the given Url.

.PARAMETER ArchiveUrl
Url of the archive that will be downloaded.

#>
param(
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)] [string] $ArchiveUrl
)
$uriParts = $ArchiveUrl.split("/")
$ArchivePath = $uriParts[$uriParts.Count - 1]

return $ArchivePath
}

function Copy-Archive {
<#
.SYNOPSIS
This function copies the given binary file to the given target location.

.PARAMETER ArchiveUrl
Url where the archive should be downloaded from.

.PARAMETER TargetDirectory
Target directory where the archive should be downloaded.
#>
param (
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string] $ArchiveUrl,
[Parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName = $true)]
[string] $TargetDirectory
)

$ArchiveName = Split-ArchiveFromUrl $ArchiveUrl

$TargetPath = [IO.Path]::Combine($PSScriptRoot, "..", "packages", $ArchiveName)

if (Test-Path $TargetPath -PathType Leaf) {
Write-Error "$TargetPath already exists, please remove to download againg."
return $TargetPath
}

if (-not (Test-Path $TargetDirectory -PathType Container)) {
Write-Host "Creating missing $TargetDirectory"
New-Item -Path $TargetDirectory -ItemType Directory
}
Write-Host "Downloading $ArchiveUrl, this might take a while..."
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($ArchiveUrl, $TargetPath)

return $TargetPath
}

$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 $SkipGpuLibraries) {
$Archive = Copy-Archive -ArchiveUrl $WindowsGpuArchive -TargetDirectory $PackagesDirectory
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "redist", "runtime.win-x64.SciSharp.TensorFlow-Gpu.Redist")
Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory

$Archive = Copy-Archive -ArchiveUrl $LinuxGpuArchive -TargetDirectory $PackagesDirectory
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "redist", "runtime.linux-x64.SciSharp.Tensorflow-Gpu.Redist")
Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory
}

if (-not $SkipCpuLibraries) {
$Archive = Copy-Archive -ArchiveUrl $WindowsCpuArchive -TargetDirectory $PackagesDirectory
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "redist", "runtime.win-x64.SciSharp.TensorFlow-Cpu.Redist")
Expand-ZipFiles $Archive $WindowsFiles $TargetDirectory

$Archive = Copy-Archive -ArchiveUrl $LinuxCpuArchive -TargetDirectory $PackagesDirectory
$TargetDirectory = [IO.Path]::Combine($PSScriptRoot, "..", "redist", "runtime.linux-x64.SciSharp.Tensorflow-Cpu.Redist")
Expand-TarGzFiles $Archive $LinuxFiles $TargetDirectory
}


BIN
tensorflowlib/runtimes/win-x64/native/tensorflow.zip View File


Loading…
Cancel
Save