From 1690fa89f0dfa898d341911f685083617d7d6684 Mon Sep 17 00:00:00 2001 From: Zhou Wang Date: Fri, 13 Jan 2017 09:47:02 +0100 Subject: [PATCH] Add samples for Eval V2 - add device specifier when loading model - rename CPPEvalV2Client to CNTKLibraryCPPEvalExamples - rename CNTKLibraryManagedExamples to CNTKLibraryCSExamples - rename CNTKLibrarymanagedExamples to CNTKLibraryCSExamples - add CNTKLibraryCSEvalGPUExamples and CNTLibraryEvalExamples.sln - complete examples - update project configuraitons - rename program.cs to Program.cs; update packages.config - rename CNTKLibraryCPP/CSExamples to CNTKLibraryCPP/CSEvalexamples - remove AnyCPU - add file header, adapt output message --- CNTK.sln | 2 +- .../CNTKLibraryCPPEvalExamples.cpp} | 2 +- .../CNTKLibraryCPPEvalExamples.vcxproj} | 6 +- ...NTKLibraryCPPEvalExamples.vcxproj.filters} | 2 +- .../EvalMultithreads.cpp | 0 .../App.config | 6 ++ .../CNTKLibraryCSEvalCPUOnlyExamples.csproj | 74 ++++++++++++++++++ .../CNTKLibraryCSEvalExamples.cs} | 41 +++------- .../Program.cs | 25 ++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../packages.config | 4 + .../CNTKLibraryCSEvalGPUExamples/App.config | 6 ++ .../CNTKLibraryCSEvalGPUExamples.csproj | 76 +++++++++++++++++++ .../CNTKLibraryCSEvalGPUExamples/Program.cs | 25 ++++++ .../Properties/AssemblyInfo.cs | 36 +++++++++ .../packages.config | 4 + .../Evaluation/CNTKLibraryEvalExamples.sln | 33 ++++++++ .../CSEvalClient/CSEvalClient.csproj | 6 +- .../Evaluation/CSEvalClient/packages.config | 2 +- Makefile | 8 +- .../App.config | 0 .../CNTKLibraryCSEvalExamplesTest.csproj} | 14 ++-- .../CNTKLibraryCSEvalExamplesTest/Program.cs | 32 ++++++++ .../Properties/AssemblyInfo.cs | 0 .../V2LibraryTests/V2LibraryTests.vcxproj | 2 +- .../V2LibraryTests.vcxproj.filters | 6 +- 26 files changed, 392 insertions(+), 56 deletions(-) rename Examples/Evaluation/{CPPEvalV2Client/CPPEvalV2Client.cpp => CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp} (86%) rename Examples/Evaluation/{CPPEvalV2Client/CPPEvalV2Client.vcxproj => CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj} (94%) rename Examples/Evaluation/{CPPEvalV2Client/CPPEvalV2Client.vcxproj.filters => CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj.filters} (93%) rename Examples/Evaluation/{CPPEvalV2Client => CNTKLibraryCPPEvalExamples}/EvalMultithreads.cpp (100%) create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/App.config create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalCPUOnlyExamples.csproj rename Examples/Evaluation/{CNTKLibraryManagedExamples/Program.cs => CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs} (91%) create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Program.cs create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Properties/AssemblyInfo.cs create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/packages.config create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/App.config create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/CNTKLibraryCSEvalGPUExamples.csproj create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Program.cs create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Properties/AssemblyInfo.cs create mode 100644 Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/packages.config create mode 100644 Examples/Evaluation/CNTKLibraryEvalExamples.sln rename Tests/EndToEndTests/EvalClientTests/{CNTKLibraryManagedExamplesTest => CNTKLibraryCSEvalExamplesTest}/App.config (100%) rename Tests/EndToEndTests/EvalClientTests/{CNTKLibraryManagedExamplesTest/CNTKLibraryManagedExamplesTest.csproj => CNTKLibraryCSEvalExamplesTest/CNTKLibraryCSEvalExamplesTest.csproj} (91%) create mode 100644 Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Program.cs rename Tests/EndToEndTests/EvalClientTests/{CNTKLibraryManagedExamplesTest => CNTKLibraryCSEvalExamplesTest}/Properties/AssemblyInfo.cs (100%) diff --git a/CNTK.sln b/CNTK.sln index 1e20ce1b3..944add367 100644 --- a/CNTK.sln +++ b/CNTK.sln @@ -1451,7 +1451,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PerformanceProfilerDll", "S {86883653-8A61-4038-81A0-2379FAE4200A} = {86883653-8A61-4038-81A0-2379FAE4200A} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryManagedExamplesTest", "Tests\EndToEndTests\EvalClientTests\CNTKLibraryManagedExamplesTest\CNTKLibraryManagedExamplesTest.csproj", "{3500A847-E024-4E7D-92DD-CC587C17460B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalExamplesTest", "Tests\EndToEndTests\EvalClientTests\CNTKLibraryCSEvalExamplesTest\CNTKLibraryCSEvalExamplesTest.csproj", "{3500A847-E024-4E7D-92DD-CC587C17460B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.cpp b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp similarity index 86% rename from Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.cpp rename to Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp index 078a6fbc9..0808d8456 100644 --- a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.cpp +++ b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp @@ -2,7 +2,7 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.md file in the project root for full license information. // -// CPPEvalV2Client.cpp : Sample application shows how to evaluate a model using CNTK V2 API. +// CNTKLibraryCPPevalExamples.cpp : Sample application shows how to evaluate a model using CNTK V2 API. // #include diff --git a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj similarity index 94% rename from Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj rename to Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj index 89346621e..a30adfe38 100644 --- a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj +++ b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj @@ -7,14 +7,14 @@ - + {D771A06D-CC25-4582-B5CD-D2A4782BB005} Win32Proj - CPPEvalV2Client - CPPEvalV2Client + CNTKLibraryCPPEvalExamples + CNTKLibraryCPPEvalExamples diff --git a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj.filters b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj.filters similarity index 93% rename from Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj.filters rename to Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj.filters index e617092ca..fd9871835 100644 --- a/Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.vcxproj.filters +++ b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.vcxproj.filters @@ -15,7 +15,7 @@ - + Source Files diff --git a/Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp b/Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp similarity index 100% rename from Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp rename to Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp diff --git a/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/App.config b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/App.config new file mode 100644 index 000000000..d1428ad71 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalCPUOnlyExamples.csproj b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalCPUOnlyExamples.csproj new file mode 100644 index 000000000..378b79350 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalCPUOnlyExamples.csproj @@ -0,0 +1,74 @@ + + + + + Debug + x64 + {8AAD7322-10B1-48C3-9BC7-005A7910C5E6} + Exe + Properties + CNTKLibraryCSEvalExamples + CNTKLibraryCSEvalCPUOnlyExamples + v4.5 + 512 + true + + + + + + true + $(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalCPUOnlyExamples.$(Configuration)\ + DEBUG;TRACE + 4 + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + $(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalCPUOnlyExamples.$(Configuration)\ + TRACE + 4 + true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + + + + ..\packages\CNTK.CPUOnly.2.0-beta8\lib\net45\x64\CNTKLibraryManaged-2.0.dll + True + + + + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Examples/Evaluation/CNTKLibraryManagedExamples/Program.cs b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs similarity index 91% rename from Examples/Evaluation/CNTKLibraryManagedExamples/Program.cs rename to Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs index a18eb1bb9..9deabedfd 100644 --- a/Examples/Evaluation/CNTKLibraryManagedExamples/Program.cs +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/CNTKLibraryCSEvalExamples.cs @@ -2,7 +2,7 @@ // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.md file in the project root for full license information. // -// program.cs -- Example for using C# Eval V2 API. +// CNTKLibraryCSEvalExamples.cs -- Examples for using CNTK Library C# Eval API. // using System; @@ -10,13 +10,11 @@ using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; using CNTK; -namespace CNTKLibraryManagedExampleTest +namespace CNTKLibraryCSEvalExamples { - public class Program + public class CNTKLibraryManagedExamples { // // The example shows @@ -26,13 +24,13 @@ namespace CNTKLibraryManagedExampleTest // - how to evaluate a model. // - how to retrieve evaluation result and retrieve output data in dense format. // - static void EvaluationSingleImage(DeviceDescriptor device) + public static void EvaluationSingleImage(DeviceDescriptor device) { const string outputName = "Plus2060"; var inputDataMap = new Dictionary(); // Load the model. - Function modelFunc = Function.LoadModel("z.model"); + Function modelFunc = Function.LoadModel("z.model", device); // Get output variable based on name Variable outputVar = modelFunc.Outputs.Where(variable => string.Equals(variable.Name, outputName)).Single(); @@ -85,13 +83,13 @@ namespace CNTKLibraryManagedExampleTest // - how to evaluate a model. // - how to retrieve evaluation result and retrieve output data in dense format. // - static void EvaluationBatchOfImages(DeviceDescriptor device) + public static void EvaluationBatchOfImages(DeviceDescriptor device) { const string outputName = "Plus2060"; var inputDataMap = new Dictionary(); // Load the model. - Function modelFunc = Function.LoadModel("z.model"); + Function modelFunc = Function.LoadModel("z.model", device); // Get output variable based on name Variable outputVar = modelFunc.Outputs.Where(variable => string.Equals(variable.Name, outputName)).Single(); @@ -157,12 +155,12 @@ namespace CNTKLibraryManagedExampleTest // - how to evaluate a model. // - how to retrieve evaluation result and retrieve output data in the one-hot vector format. // - static void EvaluationSingleSequenceUsingOneHot(DeviceDescriptor device) + public static void EvaluationSingleSequenceUsingOneHot(DeviceDescriptor device) { var vocabToIndex = buildVocabIndex("ATIS.vocab"); var indexToVocab = buildInvVocabIndex("ATIS.label"); - Function myFunc = Function.LoadModel("atis.model"); + Function myFunc = Function.LoadModel("atis.model", device); Console.WriteLine("Evaluate single sequence using one-hot vector"); @@ -237,12 +235,12 @@ namespace CNTKLibraryManagedExampleTest // - how to evaluate a model. // - how to retrieve evaluation result and retrieve output data in the one-hot vector format. // - static void EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor device) + public static void EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor device) { var vocabToIndex = buildVocabIndex("ATIS.vocab"); var indexToVocab = buildInvVocabIndex("ATIS.label"); - Function myFunc = Function.LoadModel("atis.model"); + Function myFunc = Function.LoadModel("atis.model", device); Console.WriteLine("Evaluate batch of sequences with variable length using one-hot vector"); @@ -367,22 +365,5 @@ namespace CNTKLibraryManagedExampleTest { return File.ReadAllLines(filePath); } - - static void Main(string[] args) - { - Console.WriteLine("======== Evaluate model using C# ========"); - - EvaluationSingleImage(DeviceDescriptor.CPUDevice); - EvaluationBatchOfImages(DeviceDescriptor.CPUDevice); - //TODO: Add examples with OneHot. - //EvaluationSingleSequenceUsingOneHot(DeviceDescriptor.CPUDevice); - //EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor.CPUDevice); - - // TODO: using GPU. - //EvaluationSingleImage(DeviceDescriptor.GPUDevice(0)); - //EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0)); - - Console.WriteLine("======== Evaluation completes. ========"); - } } } diff --git a/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Program.cs b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Program.cs new file mode 100644 index 000000000..467be4920 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Program.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +// +// Program.cs -- Example for using CNTK Library C# Eval CPUOnly Nuget Package. +// + +using System; +using CNTK; + +namespace CNTKLibraryCSEvalExamples +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("======== Evaluate model using C# CPUOnly Build ========"); + + CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.CPUDevice); + CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.CPUDevice); + + Console.WriteLine("======== Evaluation completes. ========"); + } + } +} diff --git a/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Properties/AssemblyInfo.cs b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..b1d66d891 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CNTKLibraryCSEvalCPUOnlyExamples")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CNTKLibraryCSEvalCPUOnlyExamples")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8aad7322-10b1-48c3-9bc7-005a7910c5e6")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/packages.config b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/packages.config new file mode 100644 index 000000000..7722e9352 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalCPUOnlyExamples/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/App.config b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/App.config new file mode 100644 index 000000000..d1428ad71 --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/CNTKLibraryCSEvalGPUExamples.csproj b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/CNTKLibraryCSEvalGPUExamples.csproj new file mode 100644 index 000000000..5c3df83cc --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/CNTKLibraryCSEvalGPUExamples.csproj @@ -0,0 +1,76 @@ + + + + + Debug + x64 + {307E5BAC-DA03-45D2-ADEC-FE6620090109} + Exe + Properties + CNTKLibraryCSEvalExamples + CNTKLibraryCSEvalGPUExamples + v4.5 + 512 + true + + + + + + true + $(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalGPUExamples.$(Configuration)\ + DEBUG;TRACE + 4 + true + full + x64 + prompt + MinimumRecommendedRules.ruleset + + + $(SolutionDir)..\..\$(Platform)\CNTKLibraryCSEvalGPUExamples.$(Configuration)\ + TRACE + 4 + true + true + pdbonly + x64 + prompt + MinimumRecommendedRules.ruleset + + + + ..\packages\CNTK.GPU.2.0-beta8\lib\net45\x64\CNTKLibraryManaged-2.0.dll + True + + + + + + + + CNTKLibraryCSEvalExamples.cs + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Program.cs b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Program.cs new file mode 100644 index 000000000..47410c98e --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Program.cs @@ -0,0 +1,25 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +// +// Program.cs -- Example for using CNTK Library C# Eval GPU Nuget Package. +// + +using System; +using CNTK; + +namespace CNTKLibraryCSEvalExamples +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("======== Evaluate model using C# GPU Build ========"); + + CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.GPUDevice(0)); + CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0)); + + Console.WriteLine("======== Evaluation completes. ========"); + } + } +} diff --git a/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Properties/AssemblyInfo.cs b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..208d9061f --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharpEvalGPUExamples")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharpEvalGPUExamples")] +[assembly: AssemblyCopyright("Copyright © 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("307e5bac-da03-45d2-adec-fe6620090109")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/packages.config b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/packages.config new file mode 100644 index 000000000..d4ef0f02a --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryCSEvalGPUExamples/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Examples/Evaluation/CNTKLibraryEvalExamples.sln b/Examples/Evaluation/CNTKLibraryEvalExamples.sln new file mode 100644 index 000000000..0a0f6991a --- /dev/null +++ b/Examples/Evaluation/CNTKLibraryEvalExamples.sln @@ -0,0 +1,33 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CNTKLibraryCPPEvalExamples", "CNTKLibraryCPPEvalExamples\CNTKLibraryCPPEvalExamples.vcxproj", "{D771A06D-CC25-4582-B5CD-D2A4782BB005}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalCPUOnlyExamples", "CNTKLibraryCSEvalCPUOnlyExamples\CNTKLibraryCSEvalCPUOnlyExamples.csproj", "{8AAD7322-10B1-48C3-9BC7-005A7910C5E6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CNTKLibraryCSEvalGPUExamples", "CNTKLibraryCSEvalGPUExamples\CNTKLibraryCSEvalGPUExamples.csproj", "{307E5BAC-DA03-45D2-ADEC-FE6620090109}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D771A06D-CC25-4582-B5CD-D2A4782BB005}.Debug|x64.ActiveCfg = Release|x64 + {D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.ActiveCfg = Release|x64 + {D771A06D-CC25-4582-B5CD-D2A4782BB005}.Release|x64.Build.0 = Release|x64 + {8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Debug|x64.ActiveCfg = Debug|x64 + {8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Debug|x64.Build.0 = Debug|x64 + {8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Release|x64.ActiveCfg = Release|x64 + {8AAD7322-10B1-48C3-9BC7-005A7910C5E6}.Release|x64.Build.0 = Release|x64 + {307E5BAC-DA03-45D2-ADEC-FE6620090109}.Debug|x64.ActiveCfg = Debug|x64 + {307E5BAC-DA03-45D2-ADEC-FE6620090109}.Debug|x64.Build.0 = Debug|x64 + {307E5BAC-DA03-45D2-ADEC-FE6620090109}.Release|x64.ActiveCfg = Release|x64 + {307E5BAC-DA03-45D2-ADEC-FE6620090109}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Examples/Evaluation/CSEvalClient/CSEvalClient.csproj b/Examples/Evaluation/CSEvalClient/CSEvalClient.csproj index de7aca73a..891ea70e1 100644 --- a/Examples/Evaluation/CSEvalClient/CSEvalClient.csproj +++ b/Examples/Evaluation/CSEvalClient/CSEvalClient.csproj @@ -50,7 +50,7 @@ - ..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta7\lib\net45\x64\EvalWrapper.dll + ..\packages\Microsoft.Research.CNTK.CpuEval-mkl.2.0-beta8\lib\net45\x64\EvalWrapper.dll True @@ -86,11 +86,11 @@ - + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + \ No newline at end of file diff --git a/Examples/Evaluation/CSEvalClient/packages.config b/Examples/Evaluation/CSEvalClient/packages.config index 8857df238..364920415 100644 --- a/Examples/Evaluation/CSEvalClient/packages.config +++ b/Examples/Evaluation/CSEvalClient/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Makefile b/Makefile index ad2010cbe..951021c5e 100644 --- a/Makefile +++ b/Makefile @@ -513,7 +513,7 @@ CNTKLIBRARY_TESTS_SRC =\ $(CNTKLIBRARY_TESTS_SRC_PATH)/DeviceSelectionTests.cpp \ $(CNTKLIBRARY_TESTS_SRC_PATH)/MinibatchSourceTest.cpp \ $(CNTKLIBRARY_TESTS_SRC_PATH)/UserDefinedFunctionTests.cpp \ - Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp \ + Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp \ CNTKLIBRARY_TESTS:=$(BINDIR)/v2librarytests CNTKLIBRARY_TESTS_OBJ := $(patsubst %.cu, $(OBJDIR)/%.o, $(patsubst %.cpp, $(OBJDIR)/%.o, $(CNTKLIBRARY_TESTS_SRC))) @@ -633,11 +633,11 @@ $(EVAL_EXTENDED_CLIENT): $(EVAL_EXTENDED_CLIENT_OBJ) | $(EVAL_LIB) $(READER_LIBS ######################################## # Eval V2 Sample client ######################################## -EVALV2_SAMPLE_CLIENT:=$(BINDIR)/cppevalv2client +EVALV2_SAMPLE_CLIENT:=$(BINDIR)/CNTKLibraryCPPEvalExamples EVALV2_SAMPLE_CLIENT_SRC=\ - $(SOURCEDIR)/../Examples/Evaluation/CPPEvalV2Client/CPPEvalV2Client.cpp \ - $(SOURCEDIR)/../Examples/Evaluation/CPPEvalV2Client/EvalMultithreads.cpp + $(SOURCEDIR)/../Examples/Evaluation/CNTKLibraryCPPEvalExamples/CNTKLibraryCPPEvalExamples.cpp \ + $(SOURCEDIR)/../Examples/Evaluation/CNTKLibraryCPPEvalExamples/EvalMultithreads.cpp EVALV2_SAMPLE_CLIENT_OBJ:=$(patsubst %.cpp, $(OBJDIR)/%.o, $(EVALV2_SAMPLE_CLIENT_SRC)) diff --git a/Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/App.config b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/App.config similarity index 100% rename from Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/App.config rename to Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/App.config diff --git a/Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/CNTKLibraryManagedExamplesTest.csproj b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/CNTKLibraryCSEvalExamplesTest.csproj similarity index 91% rename from Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/CNTKLibraryManagedExamplesTest.csproj rename to Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/CNTKLibraryCSEvalExamplesTest.csproj index f5420ae73..a1645f712 100644 --- a/Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/CNTKLibraryManagedExamplesTest.csproj +++ b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/CNTKLibraryCSEvalExamplesTest.csproj @@ -14,8 +14,8 @@ false true Properties - CNTKLibraryManagedExamplesTest - CNTKLibraryManagedExamplesTest + CNTKLibraryCSEvalExamples + CNTKLibraryCSEvalExamplesTest v4.5 512 @@ -76,13 +76,11 @@ - - Program.cs + + CNTKLibraryCSEvalExamples.cs + - - - - + \ No newline at end of file diff --git a/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Program.cs b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Program.cs new file mode 100644 index 000000000..800f04b26 --- /dev/null +++ b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Program.cs @@ -0,0 +1,32 @@ +// +// Copyright (c) Microsoft. All rights reserved. +// Licensed under the MIT license. See LICENSE.md file in the project root for full license information. +// +// Program.cs -- Tests of CNTK Library C# Eval examples. +// + +using System; +using CNTK; + +namespace CNTKLibraryCSEvalExamples +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("======== Evaluate model using C# ========"); + + CNTKLibraryManagedExamples.EvaluationSingleImage(DeviceDescriptor.CPUDevice); + CNTKLibraryManagedExamples.EvaluationBatchOfImages(DeviceDescriptor.CPUDevice); + //TODO: Add examples with OneHot. + //EvaluationSingleSequenceUsingOneHot(DeviceDescriptor.CPUDevice); + //EvaluationBatchOfSequencesUsingOneHot(DeviceDescriptor.CPUDevice); + + // TODO: using GPU. + //EvaluationSingleImage(DeviceDescriptor.GPUDevice(0)); + //EvaluationBatchOfImages(DeviceDescriptor.GPUDevice(0)); + + Console.WriteLine("======== Evaluation completes. ========"); + } + } +} diff --git a/Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/Properties/AssemblyInfo.cs b/Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Properties/AssemblyInfo.cs similarity index 100% rename from Tests/EndToEndTests/EvalClientTests/CNTKLibraryManagedExamplesTest/Properties/AssemblyInfo.cs rename to Tests/EndToEndTests/EvalClientTests/CNTKLibraryCSEvalExamplesTest/Properties/AssemblyInfo.cs diff --git a/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj b/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj index ad77254c2..cb6dcacb8 100644 --- a/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj +++ b/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj @@ -114,7 +114,7 @@ - + diff --git a/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj.filters b/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj.filters index 4f9dbe396..300bbbc0a 100644 --- a/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj.filters +++ b/Tests/UnitTests/V2LibraryTests/V2LibraryTests.vcxproj.filters @@ -54,9 +54,6 @@ Source Files - - Source Files - Source Files @@ -78,6 +75,9 @@ Source Files + + Source Files +