Skip to content

Commit feb1b7b

Browse files
authored
Merge pull request #1071 from AsakusaRinne/add_linux_gpu_redist
build: add scripts to split large native library file.
2 parents 945744b + 25f676d commit feb1b7b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+356
-98
lines changed

.github/workflows/build_and_test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ jobs:
2828
- name: Test CPU version
2929
run: dotnet test --no-build --verbosity normal
3030
- name: uninstall redist cpu for unit tests
31-
run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
31+
run: dotnet remove tools/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
3232
- name: install redist gpu for unit tests
33-
run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU
33+
run: dotnet add tools/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Windows-GPU
3434
- name: Restore dependencies
3535
run: dotnet restore
3636
- name: Build GPU version
@@ -52,12 +52,12 @@ jobs:
5252
run: dotnet restore
5353
- name: Build CPU version
5454
run: dotnet build --no-restore
55-
# - name: Test CPU version
56-
# run: dotnet test --no-build --verbosity normal
55+
- name: Test CPU version
56+
run: dotnet test --no-build --verbosity normal
5757
- name: uninstall redist cpu for unit tests
58-
run: dotnet remove helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
58+
run: dotnet remove tools/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist
5959
- name: install redist gpu for unit tests
60-
run: dotnet add helpers/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU
60+
run: dotnet add tools/Tensorflow.UnitTest.RedistHolder package SciSharp.TensorFlow.Redist-Linux-GPU
6161
- name: Restore dependencies
6262
run: dotnet restore
6363
- name: Build GPU version

TensorFlow.NET.sln

Lines changed: 104 additions & 83 deletions
Large diffs are not rendered by default.

src/TensorFlowNET.Core/tensorflow.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,18 @@ public tensorflow()
8686

8787
OpDefLib = new OpDefLibrary();
8888
InitGradientEnvironment();
89+
90+
try
91+
{
92+
var handle = c_api.TF_Version();
93+
}
94+
catch (DllNotFoundException)
95+
{
96+
throw new RuntimeError("Tensorflow.NET cannot find a backend. Please install one of the following packages for your program: " +
97+
"SciSharp.TensorFlow.Redist, SciSharp.TensorFlow.Redist-Linux-GPU, SciSharp.TensorFlow.Redist-Windows-GPU. For more details, " +
98+
"please visit https://github.com/SciSharp/TensorFlow.NET. If it still not work after installing the backend, please submit an " +
99+
"issue to https://github.com/SciSharp/TensorFlow.NET/issues");
100+
}
89101
}
90102

91103
public string VERSION => c_api.StringPiece(c_api.TF_Version());

test/TensorFlowNET.Graph.UnitTest/TensorFlowNET.Graph.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
</ItemGroup>
3535

3636
<ItemGroup>
37-
<ProjectReference Include="..\..\helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
3837
<ProjectReference Include="..\..\src\TensorFlowNET.Core\Tensorflow.Binding.csproj" />
38+
<ProjectReference Include="..\..\tools\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
3939
<ProjectReference Include="..\TensorFlowNET.Keras.UnitTest\Tensorflow.Keras.UnitTest.csproj" />
4040
</ItemGroup>
4141

test/TensorFlowNET.Keras.UnitTest/Tensorflow.Keras.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
</ItemGroup>
2424

2525
<ItemGroup>
26-
<ProjectReference Include="..\..\helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
2726
<ProjectReference Include="..\..\src\TensorFlowNET.Keras\Tensorflow.Keras.csproj" />
27+
<ProjectReference Include="..\..\tools\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
2828
</ItemGroup>
2929

3030
<ItemGroup>

test/TensorFlowNET.Native.UnitTest/Lite/TfLiteTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@ namespace Tensorflow.Native.UnitTest
1313
public class TfLiteTest
1414
{
1515
[TestMethod]
16+
[Ignore]
1617
public void TfLiteVersion()
1718
{
1819
var ver = c_api_lite.StringPiece(c_api_lite.TfLiteVersion());
1920
Assert.IsNotNull(ver);
2021
}
2122

2223
[TestMethod]
24+
[Ignore]
2325
public unsafe void SmokeTest()
2426
{
2527
var model = c_api_lite.TfLiteModelCreateFromFile("Lite/testdata/add.bin");
@@ -85,6 +87,7 @@ public unsafe void SmokeTest()
8587
}
8688

8789
[TestMethod]
90+
[Ignore]
8891
public unsafe void QuantizationParamsTest()
8992
{
9093
var model = c_api_lite.TfLiteModelCreateFromFile("Lite/testdata/add_quantized.bin");

test/TensorFlowNET.Native.UnitTest/Tensorflow.Native.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
</ItemGroup>
5555

5656
<ItemGroup>
57-
<ProjectReference Include="..\..\helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
5857
<ProjectReference Include="..\..\src\TensorFlowNET.Core\Tensorflow.Binding.csproj" />
58+
<ProjectReference Include="..\..\tools\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
5959
</ItemGroup>
6060

6161
</Project>

test/TensorFlowNET.UnitTest/Tensorflow.Binding.UnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
</ItemGroup>
4949

5050
<ItemGroup>
51-
<ProjectReference Include="..\..\helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
5251
<ProjectReference Include="..\..\src\TensorFlowNET.Core\Tensorflow.Binding.csproj" />
5352
<ProjectReference Include="..\..\src\TensorFlowNET.Text\Tensorflow.Text.csproj" />
53+
<ProjectReference Include="..\..\tools\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
5454
</ItemGroup>
5555

5656
<ItemGroup>

test/TensorflowNET.Hub.Unittest/Tensorflow.Hub.Unittest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<ProjectReference Include="..\..\helpers\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
2019
<ProjectReference Include="..\..\src\TensorflowNET.Hub\Tensorflow.Hub.csproj" />
20+
<ProjectReference Include="..\..\tools\Tensorflow.UnitTest.RedistHolder\Tensorflow.UnitTest.RedistHolder.csproj" />
2121
</ItemGroup>
2222

2323
</Project>

0 commit comments

Comments
 (0)