Skip to content

Commit 2b698e6

Browse files
harishskDmitry-A
authored andcommitted
Updated the redistributed version of Tensorflow to 1.14 (dotnet#3929)
* Fixed build errors resulting from upgrade to VS2019 compilers * Added additional message describing the previous fix * Updated Tensorflow to version 1.14 * Removed rename rules for Mac * Updated names of files for Mac * Attempting to fix test errors on Mac * Attempting to fix Mac test errors * Changed list of files to copy from archive for Linux and Mac * Fixed CopyNativeAssemblies to copy the tensorflow binaries that have version number appended * Fixed windows build * Another attempt at fixing both Windows and Linux builds * Changed copying version-suffixed binaries to occur only for non-Windows platforms * Changed copying of versioned assemblies to use HasMetadata
1 parent a04d861 commit 2b698e6

13 files changed

+71
-22
lines changed

Directory.Build.targets

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
</NativeAssemblyReference>
2222
</ItemGroup>
2323

24+
<ItemGroup>
25+
<NativeAssemblyReferenceWithMajorVersion Include="@(NativeAssemblyReference->HasMetadata('MajorVersion'))">
26+
<!-- Tensorflow has a different naming scheme for v1.14.0. Those binaries need to be copied along with the standard names -->
27+
<AssemblyPathWithMajorVersion Condition="'$(OS)' != 'Windows_NT'">$(NativeOutputPath)$(LibPrefix)%(NativeAssemblyReference.Identity)$(LibExtension).%(NativeAssemblyReference.MajorVersion)</AssemblyPathWithMajorVersion>
28+
<AssemblyPathWithMajorVersion Condition="$([MSBuild]::IsOSPlatform('osx'))">$(NativeOutputPath)$(LibPrefix)%(NativeAssemblyReference.Identity).%(NativeAssemblyReference.MajorVersion)$(LibExtension)</AssemblyPathWithMajorVersion>
29+
</NativeAssemblyReferenceWithMajorVersion>
30+
</ItemGroup>
31+
2432
<Copy SourceFiles = "@(NativeAssemblyReference->'%(FullAssemblyPath)')"
2533
DestinationFolder="$(OutputPath)"
2634
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
@@ -30,7 +38,19 @@
3038
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
3139
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
3240
</Copy>
33-
41+
42+
<!-- Optionally copy the native binaries that have a version number attended (Only tensorflow right now) -->
43+
<Copy Condition="'$(OS)' != 'Windows_NT'"
44+
SourceFiles = "@(NativeAssemblyReferenceWithMajorVersion->'%(AssemblyPathWithMajorVersion)')"
45+
DestinationFolder="$(OutputPath)"
46+
OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
47+
Retries="$(CopyRetryCount)"
48+
RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
49+
UseHardlinksIfPossible="$(CreateHardLinksForPublishFilesIfPossible)"
50+
UseSymboliclinksIfPossible="$(CreateSymbolicLinksForPublishFilesIfPossible)">
51+
<Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>
52+
</Copy>
53+
3454
</Target>
3555

3656
<Import Project="$(ToolsDir)/versioning.targets" Condition="Exists('$(ToolsDir)/versioning.targets')" />

build/Dependencies.props

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
<SystemDrawingCommonPackageVersion>4.5.0</SystemDrawingCommonPackageVersion>
2222
<SystemIOFileSystemAccessControl>4.5.0</SystemIOFileSystemAccessControl>
2323
<SystemSecurityPrincipalWindows>4.5.0</SystemSecurityPrincipalWindows>
24-
<TensorFlowVersion>1.13.1</TensorFlowVersion>
24+
<TensorFlowVersion>1.14.0</TensorFlowVersion>
25+
<TensorFlowMajorVersion>1</TensorFlowMajorVersion>
2526
</PropertyGroup>
2627

2728
<!-- Code Analyzer Dependencies -->

src/Microsoft.ML.DnnAnalyzer/Microsoft.ML.DnnAnalyzer/Microsoft.ML.DnnAnalyzer.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313

1414
<!-- TensorFlow is 64-bit only -->
1515
<ItemGroup Condition="'$(NativeTargetArchitecture)' == 'x64'">
16-
<NativeAssemblyReference Include="tensorflow" />
17-
<NativeAssemblyReference Condition="'$(OS)' != 'Windows_NT'" Include="tensorflow_framework" />
16+
<NativeAssemblyReference Include="tensorflow">
17+
<MajorVersion>$(TensorFlowMajorVersion)</MajorVersion>
18+
</NativeAssemblyReference>
19+
<NativeAssemblyReference Condition="'$(OS)' != 'Windows_NT'" Include="tensorflow_framework">
20+
<MajorVersion>$(TensorFlowMajorVersion)</MajorVersion>
21+
</NativeAssemblyReference>
1822
</ItemGroup>
1923

2024
</Project>

src/Redist/Microsoft.ML.TensorFlow.Redist/Microsoft.ML.TensorFlow.Redist.proj

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,27 @@
77

88
<ItemGroup>
99
<TensorFlowConfig Include="windows" FileExtension=".zip" FilesFromArchive="lib\tensorflow.dll;include\tensorflow\c\LICENSE" Runtime="win-x64"/>
10-
<TensorFlowConfig Include="linux" FileExtension=".tar.gz" FilesFromArchive="lib\libtensorflow.so;lib\libtensorflow_framework.so;include\tensorflow\c\LICENSE" Runtime="linux-x64" />
11-
<TensorFlowConfig Include="darwin" FileExtension=".tar.gz" FilesFromArchive="lib\libtensorflow.so;lib\libtensorflow_framework.so;include\tensorflow\c\LICENSE" Runtime="osx-x64" />
12-
13-
<AdditionalDownloadFile Include="https://raw.githubusercontent.com/tensorflow/tensorflow/master/LICENSE" DownloadFile="$(IntermediateOutputPath)LICENSE" />
10+
<TensorFlowConfig Include="linux" FileExtension=".tar.gz"
11+
FilesFromArchive="lib\libtensorflow.so;
12+
lib\libtensorflow.so.$(TensorFlowMajorVersion);
13+
lib\libtensorflow.so.$(TensorFlowVersion);
14+
lib\libtensorflow_framework.so;
15+
lib\libtensorflow_framework.so.$(TensorFlowMajorVersion);
16+
lib\libtensorflow_framework.so.$(TensorFlowVersion);
17+
include\tensorflow\c\LICENSE"
18+
Runtime="linux-x64" />
19+
<TensorFlowConfig Include="darwin" FileExtension=".tar.gz"
20+
FilesFromArchive="lib\libtensorflow.dylib;
21+
lib\libtensorflow.$(TensorFlowMajorVersion).dylib;
22+
lib\libtensorflow.$(TensorFlowVersion).dylib;
23+
lib\libtensorflow_framework.dylib;
24+
lib\libtensorflow_framework.$(TensorFlowMajorVersion).dylib;
25+
lib\libtensorflow_framework.$(TensorFlowVersion).dylib;
26+
include\tensorflow\c\LICENSE"
27+
Runtime="osx-x64" />
28+
29+
30+
<AdditionalDownloadFile Include="https://raw.githubusercontent.com/tensorflow/tensorflow/master/LICENSE" DownloadFile="$(IntermediateOutputPath)LICENSE" />
1431
</ItemGroup>
1532

1633
<Target Name="PrepareArchives">
@@ -93,8 +110,6 @@
93110
<!-- batch rather than transform so that we can split FilesFromArchive metadata -->
94111
<_fileFromArchive Include="%(TensorFlowArchive.FilesFromArchive)" ExtractDirectory="%(TensorFlowArchive.ExtractDirectory)" Runtime="%(TensorFlowArchive.Runtime)" />
95112
<_fileFromArchive DestinationFile="%(FileName)%(Extension)"/>
96-
<!-- rename the .so to .dylib since CORECLR's DLLImport convention requires dylib -->
97-
<_fileFromArchive Condition="'%(Runtime)' == 'osx-x64' AND '%(Extension)' == '.so'" DestinationFile="%(FileName).dylib" />
98113
<_fileFromArchive PackagePath="runtimes\%(_fileFromArchive.Runtime)\native\%(_fileFromArchive.DestinationFile)" />
99114

100115
<!-- LICENSE from the package is actually THIRD_PARTY_NOTICES-->
@@ -120,9 +135,6 @@
120135
<Copy SourceFiles="@(FilesFromArchive)"
121136
DestinationFiles="@(FilesFromArchive->'%(TargetPath)')" />
122137

123-
<!-- fix up the renamed libtensorflow, this can only run on mac -->
124-
<Exec Condition="'%(FilesFromArchive.Runtime)' == 'osx-x64' AND '%(FilesFromArchive.FileName)' == 'libtensorflow'"
125-
Command="install_name_tool -change @rpath/libtensorflow_framework.so @rpath/libtensorflow_framework.dylib &quot;%(FilesFromArchive.TargetPath)&quot;" />
126138
</Target>
127139

128140
<!-- Define Build to do the work of downloading and copying assets -->

src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-darwin-x86_64-1.13.1.tar.gz.sha

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
7002EF701BD23C5EF5FF94192E935F0DDF960A21BE2531CEE158586830C00E0BA889900F7F6E8AB568BEE0ACF1F5A6A246BB43D11C4109E9DC782B46377D8142

src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-linux-x86_64-1.13.1.tar.gz.sha

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
E3F6D0309117E9E45780ECF8BC4D0268B3FC9F12E3E38FFE58496789330A4ACD2DC8FF721F3B8900357F6155F8A54000E45B99495F823486B558E8B42532392D

src/Redist/Microsoft.ML.TensorFlow.Redist/libtensorflow-cpu-windows-x86_64-1.13.1.zip.sha

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
59A2B80B441439B851202358CE4A65BA0DDDB319A8A29E87B135DCD9954BC5B0628F2C0C8E72D6942EA3CDCE172805C2BD5421815B3D0210B62BC0936DC59A08

0 commit comments

Comments
 (0)