From 16fbe582c402e3c31c5fa37f49e76567e0c8c415 Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Wed, 3 Apr 2019 18:18:41 -0700 Subject: [PATCH 1/8] Expose parallel execution option --- csharp/Directory.Build.props | 8 ++ .../SessionOptions.cs | 16 ++++ .../InferenceTest.cs | 25 ++++--- .../Microsoft.ML.OnnxRuntime.PerfTool.csproj | 1 + .../Program.cs | 74 ++++++++++++------- .../SonomaRunner.cs | 2 - 6 files changed, 87 insertions(+), 39 deletions(-) create mode 100644 csharp/Directory.Build.props diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props new file mode 100644 index 0000000000000..570bd35254d2d --- /dev/null +++ b/csharp/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + D:/projects/onnxruntime/build/Windows/RelWithDebInfo/.. + + diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs index 9a22b1297eb78..7a4015b4a49be 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs @@ -50,6 +50,22 @@ public bool SetSessionGraphOptimizationLevel(uint optimization_level) return result == 0; } + /// + /// Enable parallel execution. + /// + /// + /// Call with true to enable Parallel Execution + /// Call with false to disable Parallel Execution + /// By default, Parallel Execution is disabled + /// + public void EnableParallelExecution(bool enable=true) + { + if (enable) + NativeMethods.OrtDisableSequentialExecution(_nativePtr); + else + NativeMethods.OrtEnableSequentialExecution(_nativePtr); + } + /// /// Default instance /// diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index af019ecbbe4d0..362f711f2c400 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -51,15 +51,18 @@ public void CanCreateAndDisposeSessionWithModelPath() } [Theory] - [InlineData(0)] - [InlineData(2)] - private void CanRunInferenceOnAModel(uint graphOptimizationLevel) + [InlineData(0, true)] + [InlineData(0, false)] + [InlineData(2, true)] + [InlineData(2, false)] + private void CanRunInferenceOnAModel(uint graphOptimizationLevel, bool enableParallelExecution) { string modelPath = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet.onnx"); // Set the graph optimization level for this session. SessionOptions options = new SessionOptions(); Assert.True(options.SetSessionGraphOptimizationLevel(graphOptimizationLevel)); + options.EnableParallelExecution(enableParallelExecution); using (var session = new InferenceSession(modelPath, options)) { @@ -209,20 +212,22 @@ private void TestPreTrainedModelsOpset7And8() "fp16_inception_v1", "fp16_shufflenet", "fp16_tiny_yolov2" }; - + var opsets = new[] { "opset7", "opset8" }; var modelsDir = GetTestModelsDir(); + // return if model directories does not exist(build without 'enable_onnx_tests' option) + if (!Directory.Exists(modelsDir)) + return; foreach (var opset in opsets) { var modelRoot = new DirectoryInfo(Path.Combine(modelsDir, opset)); - //var cwd = Directory.GetCurrentDirectory(); foreach (var modelDir in modelRoot.EnumerateDirectories()) { String onnxModelFileName = null; - + if (skipModels.Contains(modelDir.Name)) continue; - + try { var onnxModelNames = modelDir.GetFiles("*.onnx"); @@ -238,14 +243,14 @@ private void TestPreTrainedModelsOpset7And8() validModelFound = true; } } - + if (!validModelFound) { var modelNamesList = string.Join(",", onnxModelNames.Select(x => x.ToString())); throw new Exception($"Opset {opset}: Model {modelDir}. Can't determine model file name. Found these :{modelNamesList}"); } } - + onnxModelFileName = Path.Combine(modelsDir, opset, modelDir.Name, onnxModelNames[0].Name); using (var session = new InferenceSession(onnxModelFileName)) { @@ -258,7 +263,7 @@ private void TestPreTrainedModelsOpset7And8() if (innodedims[i] < 0) innodedims[i] = -1 * innodedims[i]; } - + var testRoot = new DirectoryInfo(Path.Combine(modelsDir, opset, modelDir.Name)); var testData = testRoot.EnumerateDirectories("test_data*").First(); var dataIn = LoadTensorFromFilePb(Path.Combine(modelsDir, opset, modelDir.Name, testData.ToString(), "input_0.pb")); diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj index 8592e401b9002..7d167dd064e8e 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Microsoft.ML.OnnxRuntime.PerfTool.csproj @@ -32,6 +32,7 @@ + diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs index 75242765498af..39b75c146b2f0 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs @@ -3,12 +3,9 @@ using System; using System.Collections.Generic; -using System.Text; -using System.IO; -using Microsoft.ML.OnnxRuntime; using System.Numerics.Tensors; using System.Diagnostics; - +using CommandLine; namespace Microsoft.ML.OnnxRuntime.PerfTool { @@ -21,35 +18,56 @@ public enum TimingPoint TotalCount = 4 } - class Program + class CommandOptions { + [Option('m', "model_file", Required = true, HelpText = "Model Path.")] + public string ModelFile { get; set; } - public static void Main(string[] args) - { - /* - args[0] = model-file-name - args[1] = input-file-name - args[2] = iteration count - */ + [Option('i', "input_file", Required = true, HelpText = "Input path.")] + public string InputFile { get; set; } - if (args.Length < 3) - { - PrintUsage(); - Environment.Exit(1); - } + [Option('c', "iteration_count", Required = true, HelpText = "Iteration to run.")] + public int IterationCount { get; set; } + + [Option('p', Required = false, HelpText = "Run with parallel exection. Default is false")] + public bool ParallelExecution { get; set; } = false; + + [Option('o', "optimization_level", Required = false, HelpText = "Optimization Level. Default is 1, partial optimization.")] + public uint OptimizationLevel { get; set; } = 1; + } - string modelPath = args[0]; - string inputPath = args[1]; - int iteration = Int32.Parse(args[2]); - Console.WriteLine("Running model {0} in OnnxRuntime with input {1} for {2} times", modelPath, inputPath, iteration); + class Program + { + public static void Main(string[] args) + { + var cmdOptions = Parser.Default.ParseArguments(args); + cmdOptions.WithParsed( + options => { + Main(options); + }); + } + public static void Main(CommandOptions options) + { + string modelPath = options.ModelFile; + string inputPath = options.InputFile; + int iteration = options.IterationCount; + bool parallelExecution = options.ParallelExecution; + uint optLevel = options.OptimizationLevel; + Console.WriteLine("Running model {0} in OnnxRuntime:", modelPath); + Console.WriteLine("input:{0}", inputPath); + Console.WriteLine("iteration count:{0}", iteration); + Console.WriteLine("parallel execution:{0}", parallelExecution); + Console.WriteLine("optimization level:{0}", optLevel); DateTime[] timestamps = new DateTime[(int)TimingPoint.TotalCount]; - RunModelOnnxRuntime(modelPath, inputPath, iteration, timestamps); + RunModelOnnxRuntime(modelPath, inputPath, iteration, timestamps, parallelExecution, optLevel); PrintReport(timestamps, iteration); Console.WriteLine("Done"); - Console.WriteLine("Running model {0} in Sonoma with input {1} for {2} times", modelPath, inputPath, iteration); - RunModelOnnxRuntime(modelPath, inputPath, iteration, timestamps); + Console.WriteLine("Running model {0} in Sonoma:", modelPath); + Console.WriteLine("input:{0}", inputPath); + Console.WriteLine("iteration count:{0}", iteration); + SonomaRunner.RunModelSonoma(modelPath, inputPath, iteration, timestamps); PrintReport(timestamps, iteration); Console.WriteLine("Done"); @@ -74,7 +92,7 @@ public static float[] LoadTensorFromFile(string filename) return tensorData.ToArray(); } - static void RunModelOnnxRuntime(string modelPath, string inputPath, int iteration, DateTime[] timestamps) + static void RunModelOnnxRuntime(string modelPath, string inputPath, int iteration, DateTime[] timestamps, bool parallelExecution, uint optLevel) { if (timestamps.Length != (int)TimingPoint.TotalCount) { @@ -82,8 +100,10 @@ static void RunModelOnnxRuntime(string modelPath, string inputPath, int iteratio } timestamps[(int)TimingPoint.Start] = DateTime.Now; - - using (var session = new InferenceSession(modelPath)) + SessionOptions options = new SessionOptions(); + options.EnableParallelExecution(parallelExecution); + options.SetSessionGraphOptimizationLevel(optLevel); + using (var session = new InferenceSession(modelPath, options)) { timestamps[(int)TimingPoint.ModelLoaded] = DateTime.Now; var inputMeta = session.InputMetadata; diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs index 92b8763f6715d..b59301c3076b6 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Microsoft.ML.Scoring; using System.Diagnostics; From b595a5db783d6832f651e80ae3d60dbba22a314e Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Wed, 3 Apr 2019 18:26:52 -0700 Subject: [PATCH 2/8] delete unnesary file --- csharp/Directory.Build.props | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 csharp/Directory.Build.props diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props deleted file mode 100644 index 570bd35254d2d..0000000000000 --- a/csharp/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - D:/projects/onnxruntime/build/Windows/RelWithDebInfo/.. - - From 27479afd937f0e8a21c2a94cf862ecebbc5c49e1 Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Wed, 3 Apr 2019 18:29:40 -0700 Subject: [PATCH 3/8] add doc --- .../Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs | 10 +++++----- docs/CSharp_API.md | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index 362f711f2c400..5a8fa7ba122db 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -212,7 +212,7 @@ private void TestPreTrainedModelsOpset7And8() "fp16_inception_v1", "fp16_shufflenet", "fp16_tiny_yolov2" }; - + var opsets = new[] { "opset7", "opset8" }; var modelsDir = GetTestModelsDir(); // return if model directories does not exist(build without 'enable_onnx_tests' option) @@ -227,7 +227,7 @@ private void TestPreTrainedModelsOpset7And8() if (skipModels.Contains(modelDir.Name)) continue; - + try { var onnxModelNames = modelDir.GetFiles("*.onnx"); @@ -243,14 +243,14 @@ private void TestPreTrainedModelsOpset7And8() validModelFound = true; } } - + if (!validModelFound) { var modelNamesList = string.Join(",", onnxModelNames.Select(x => x.ToString())); throw new Exception($"Opset {opset}: Model {modelDir}. Can't determine model file name. Found these :{modelNamesList}"); } } - + onnxModelFileName = Path.Combine(modelsDir, opset, modelDir.Name, onnxModelNames[0].Name); using (var session = new InferenceSession(onnxModelFileName)) { @@ -263,7 +263,7 @@ private void TestPreTrainedModelsOpset7And8() if (innodedims[i] < 0) innodedims[i] = -1 * innodedims[i]; } - + var testRoot = new DirectoryInfo(Path.Combine(modelsDir, opset, modelDir.Name)); var testData = testRoot.EnumerateDirectories("test_data*").First(); var dataIn = LoadTensorFromFilePb(Path.Combine(modelsDir, opset, modelDir.Name, testData.ToString(), "input_0.pb")); diff --git a/docs/CSharp_API.md b/docs/CSharp_API.md index 8f4c309917245..c512cfb6676c5 100644 --- a/docs/CSharp_API.md +++ b/docs/CSharp_API.md @@ -111,6 +111,11 @@ Sets the graph optimization level for the session. Default is set to 1. Availabl * 1 -> Enable basic optimizations such as redundant node removals and constant folding * 2 -> Enable all optimizations (includes Level1 and more complex optimizations such as node fusions) + EnableParallelExecution(bool enable); +Enable Parallel Execution for the session. By default, Parallel Execution is disabled. +* True -> Enable parallel execution. +* False -> Disable parallel execution. + AppendExecutionProvider(ExecutionProvider provider); Appends execution provider to the session. For any operator in the graph the first execution provider that implements the operator will be user. ExecutionProvider is defined as the following enum. From 035249631439cc7f63e044479d08bb9b84eccb64 Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Thu, 4 Apr 2019 13:42:06 -0700 Subject: [PATCH 4/8] update nuget retore to 4.3.0 --- tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml | 3 +++ tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml | 3 +++ .../github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml | 3 +++ 3 files changed, 9 insertions(+) diff --git a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml index 2340c150dd6db..31134b090e6fe 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml @@ -4,6 +4,9 @@ jobs: buildDirectory: '$(Build.BinariesDirectory)' steps: - template: templates/set-test-data-variables-step.yml + - task: NuGetToolInstaller@0 + inputs: + versionSpec:'4.3.0' - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml index 0d0c7367e344a..85c7e03753f18 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml @@ -5,6 +5,9 @@ jobs: CUDA_VERSION: '10.0' steps: - template: templates/set-test-data-variables-step.yml + - task: NuGetToolInstaller@0 + inputs: + versionSpec:'4.3.0' - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml index 986e9ca7dfc72..a168b08b38e2c 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml @@ -10,6 +10,9 @@ jobs: steps: # - template: templates/set-test-data-variables-step.yml + - task: NuGetToolInstaller@0 + inputs: + versionSpec:'4.3.0' - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: From 012f138df313cd2aa9fb7774ddacb2461678649f Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Thu, 4 Apr 2019 13:57:34 -0700 Subject: [PATCH 5/8] resolve comments --- csharp/Directory.Build.props | 8 +++ .../SessionOptions.cs | 20 ++++--- .../InferenceTest.cs | 7 +-- .../Program.cs | 10 +--- .../SonomaRunner.cs | 56 ------------------- docs/CSharp_API.md | 9 +-- 6 files changed, 27 insertions(+), 83 deletions(-) create mode 100644 csharp/Directory.Build.props delete mode 100644 csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props new file mode 100644 index 0000000000000..570bd35254d2d --- /dev/null +++ b/csharp/Directory.Build.props @@ -0,0 +1,8 @@ + + + + + D:/projects/onnxruntime/build/Windows/RelWithDebInfo/.. + + diff --git a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs index 7a4015b4a49be..9aded53148f30 100644 --- a/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs +++ b/csharp/src/Microsoft.ML.OnnxRuntime/SessionOptions.cs @@ -51,21 +51,23 @@ public bool SetSessionGraphOptimizationLevel(uint optimization_level) } /// - /// Enable parallel execution. + /// Enable Sequential Execution. By default, it is enabled. /// - /// - /// Call with true to enable Parallel Execution - /// Call with false to disable Parallel Execution - /// By default, Parallel Execution is disabled /// - public void EnableParallelExecution(bool enable=true) + public void EnableSequentialExecution() { - if (enable) - NativeMethods.OrtDisableSequentialExecution(_nativePtr); - else NativeMethods.OrtEnableSequentialExecution(_nativePtr); } + /// + /// Disable Sequential Execution and enable Parallel Execution. + /// + /// + public void DisableSequentialExecution() + { + NativeMethods.OrtDisableSequentialExecution(_nativePtr); + } + /// /// Default instance /// diff --git a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs index 5a8fa7ba122db..30141cf5d776f 100644 --- a/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs +++ b/csharp/test/Microsoft.ML.OnnxRuntime.Tests/InferenceTest.cs @@ -55,14 +55,14 @@ public void CanCreateAndDisposeSessionWithModelPath() [InlineData(0, false)] [InlineData(2, true)] [InlineData(2, false)] - private void CanRunInferenceOnAModel(uint graphOptimizationLevel, bool enableParallelExecution) + private void CanRunInferenceOnAModel(uint graphOptimizationLevel, bool disableSequentialExecution) { string modelPath = Path.Combine(Directory.GetCurrentDirectory(), "squeezenet.onnx"); // Set the graph optimization level for this session. SessionOptions options = new SessionOptions(); Assert.True(options.SetSessionGraphOptimizationLevel(graphOptimizationLevel)); - options.EnableParallelExecution(enableParallelExecution); + if(disableSequentialExecution) options.DisableSequentialExecution(); using (var session = new InferenceSession(modelPath, options)) { @@ -215,9 +215,6 @@ private void TestPreTrainedModelsOpset7And8() var opsets = new[] { "opset7", "opset8" }; var modelsDir = GetTestModelsDir(); - // return if model directories does not exist(build without 'enable_onnx_tests' option) - if (!Directory.Exists(modelsDir)) - return; foreach (var opset in opsets) { var modelRoot = new DirectoryInfo(Path.Combine(modelsDir, opset)); diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs index 39b75c146b2f0..ee77e5f484d66 100644 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs +++ b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/Program.cs @@ -63,14 +63,6 @@ public static void Main(CommandOptions options) RunModelOnnxRuntime(modelPath, inputPath, iteration, timestamps, parallelExecution, optLevel); PrintReport(timestamps, iteration); Console.WriteLine("Done"); - - Console.WriteLine("Running model {0} in Sonoma:", modelPath); - Console.WriteLine("input:{0}", inputPath); - Console.WriteLine("iteration count:{0}", iteration); - SonomaRunner.RunModelSonoma(modelPath, inputPath, iteration, timestamps); - PrintReport(timestamps, iteration); - Console.WriteLine("Done"); - } @@ -101,7 +93,7 @@ static void RunModelOnnxRuntime(string modelPath, string inputPath, int iteratio timestamps[(int)TimingPoint.Start] = DateTime.Now; SessionOptions options = new SessionOptions(); - options.EnableParallelExecution(parallelExecution); + if (parallelExecution) options.DisableSequentialExecution(); options.SetSessionGraphOptimizationLevel(optLevel); using (var session = new InferenceSession(modelPath, options)) { diff --git a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs b/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs deleted file mode 100644 index b59301c3076b6..0000000000000 --- a/csharp/tools/Microsoft.ML.OnnxRuntime.PerfTool/SonomaRunner.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System; -using Microsoft.ML.Scoring; -using System.Diagnostics; - -namespace Microsoft.ML.OnnxRuntime.PerfTool -{ - public class SonomaRunner - { - public static void RunModelSonoma(string modelPath, string inputPath, int iteration, DateTime[] timestamps) - { - if (timestamps.Length != (int)TimingPoint.TotalCount) - { - throw new ArgumentException("Timestamps array must have " + (int)TimingPoint.TotalCount + " size"); - } - - timestamps[(int)TimingPoint.Start] = DateTime.Now; - - var modelName = "lotusrt_squeezenet"; - using (var modelManager = new ModelManager(modelPath, true)) - { - modelManager.InitOnnxModel(modelName, int.MaxValue); - timestamps[(int)TimingPoint.ModelLoaded] = DateTime.Now; - - Tensor[] inputs = new Tensor[1]; - var inputShape = new long[] { 1, 3, 224, 224 }; // hardcoded values - - float[] inputData0 = Program.LoadTensorFromFile(inputPath); - inputs[0] = Tensor.Create(inputData0, inputShape); - string[] inputNames = new string[] {"data_0"}; - string[] outputNames = new string[] { "softmaxout_1" }; - - timestamps[(int)TimingPoint.InputLoaded] = DateTime.Now; - - for (int i = 0; i < iteration; i++) - { - var outputs = modelManager.RunModel( - modelName, - int.MaxValue, - inputNames, - inputs, - outputNames - ); - Debug.Assert(outputs != null); - Debug.Assert(outputs.Length == 1); - } - - timestamps[(int)TimingPoint.RunComplete] = DateTime.Now; - } - - - - } - - - } -} diff --git a/docs/CSharp_API.md b/docs/CSharp_API.md index c512cfb6676c5..97976ae921298 100644 --- a/docs/CSharp_API.md +++ b/docs/CSharp_API.md @@ -111,10 +111,11 @@ Sets the graph optimization level for the session. Default is set to 1. Availabl * 1 -> Enable basic optimizations such as redundant node removals and constant folding * 2 -> Enable all optimizations (includes Level1 and more complex optimizations such as node fusions) - EnableParallelExecution(bool enable); -Enable Parallel Execution for the session. By default, Parallel Execution is disabled. -* True -> Enable parallel execution. -* False -> Disable parallel execution. + EnableSequentialExecution(); +Enable Sequential Execution. By default, it is enabled. + + DisableSequentialExecution(); +Disable Sequential Execution and enable Parallel Execution. AppendExecutionProvider(ExecutionProvider provider); Appends execution provider to the session. For any operator in the graph the first execution provider that implements the operator will be user. ExecutionProvider is defined as the following enum. From efe5d18c68af16b3354654ad575bf4b9e22291db Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Thu, 4 Apr 2019 13:59:01 -0700 Subject: [PATCH 6/8] remove unnessary file --- csharp/Directory.Build.props | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 csharp/Directory.Build.props diff --git a/csharp/Directory.Build.props b/csharp/Directory.Build.props deleted file mode 100644 index 570bd35254d2d..0000000000000 --- a/csharp/Directory.Build.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - D:/projects/onnxruntime/build/Windows/RelWithDebInfo/.. - - From 06842067171877697c916d7082e2a2cda5b71e2f Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Thu, 4 Apr 2019 14:01:01 -0700 Subject: [PATCH 7/8] make git ignore csharp/Directory.Build.props --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 87424510f29ec..a3e9f552dd1c3 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ onnxruntime_profile*.json /docs/python/*_LICENSE /csharp/**/obj/ /csharp/**/bin/ +/csharp/Directory.Build.props docs/python/*.onnx *.onnx onnxprofile_profile_test_*.json From 30a60cdca10f988435961ee9eac15801751a0125 Mon Sep 17 00:00:00 2001 From: Yufeng Li Date: Thu, 4 Apr 2019 14:07:58 -0700 Subject: [PATCH 8/8] fix yaml config for nuget 4.3 --- tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml | 3 ++- tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml | 3 ++- .../github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml index 31134b090e6fe..e53eabe3e1d65 100644 --- a/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-ci-pipeline.yml @@ -5,8 +5,9 @@ jobs: steps: - template: templates/set-test-data-variables-step.yml - task: NuGetToolInstaller@0 + displayName: Use Nuget 4.3 inputs: - versionSpec:'4.3.0' + versionSpec: 4.3.0 - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml index 85c7e03753f18..3eeff55d18ca6 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-ci-pipeline.yml @@ -6,8 +6,9 @@ jobs: steps: - template: templates/set-test-data-variables-step.yml - task: NuGetToolInstaller@0 + displayName: Use Nuget 4.3 inputs: - versionSpec:'4.3.0' + versionSpec: 4.3.0 - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: diff --git a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml index a168b08b38e2c..32400581632bb 100644 --- a/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml +++ b/tools/ci_build/github/azure-pipelines/win-gpu-tensorrt-ci-pipeline.yml @@ -11,8 +11,9 @@ jobs: steps: # - template: templates/set-test-data-variables-step.yml - task: NuGetToolInstaller@0 + displayName: Use Nuget 4.3 inputs: - versionSpec:'4.3.0' + versionSpec: 4.3.0 - task: NuGetCommand@2 displayName: 'NuGet restore' inputs: