diff --git a/src/Vts.Benchmark/Benchmarks/MonteCarloSimulationBenchmarks.cs b/src/Vts.Benchmark/Benchmarks/MonteCarloSimulationBenchmarks.cs new file mode 100644 index 000000000..5e8b6c664 --- /dev/null +++ b/src/Vts.Benchmark/Benchmarks/MonteCarloSimulationBenchmarks.cs @@ -0,0 +1,32 @@ +using BenchmarkDotNet.Attributes; +using NLog; +using System.Collections.Generic; +using Vts.MonteCarlo; + +namespace Vts.Benchmark.Benchmarks; + +public class MonteCarloSimulationBenchmarks +{ + private MonteCarloSimulation _simulation; + + [ParamsSource(nameof(SimulationInputs))] + public SimulationInput Input { get; set; } + + public static IEnumerable SimulationInputs() + { + yield return new SimulationInput { N = 10000 }; + // we can add more SimulationInput instances with different configurations if needed + } + + [GlobalSetup] + public void Setup() + { + LogManager.SuspendLogging(); // logging can interfere with benchmark results, it is also suspended in NLog config for benchmarks + + _simulation = new MonteCarloSimulation(Input); + } + + [Benchmark] + public SimulationOutput RunSimulation() + => _simulation.Run(); +} \ No newline at end of file diff --git a/src/Vts.Benchmark/Benchmarks/ParallelMonteCarloSimulationBenchmarks.cs b/src/Vts.Benchmark/Benchmarks/ParallelMonteCarloSimulationBenchmarks.cs new file mode 100644 index 000000000..34ab0aa35 --- /dev/null +++ b/src/Vts.Benchmark/Benchmarks/ParallelMonteCarloSimulationBenchmarks.cs @@ -0,0 +1,35 @@ +using BenchmarkDotNet.Attributes; +using NLog; +using System.Collections.Generic; +using Vts.MonteCarlo; + +namespace Vts.Benchmark.Benchmarks; + +public class ParallelMonteCarloSimulationBenchmarks +{ + private ParallelMonteCarloSimulation _simulation; + + [ParamsSource(nameof(SimulationInputs))] + public SimulationInput Input { get; set; } + + public static IEnumerable SimulationInputs() + { + yield return new SimulationInput { N = 10000 }; + // we can add more SimulationInput instances with different configurations if needed + } + + [Params(4)] // we can add more parameters separated by commas for different CPU counts + public int NumberOfCpUs { get; set; } + + [GlobalSetup] + public void Setup() + { + LogManager.SuspendLogging(); + + _simulation = new ParallelMonteCarloSimulation(Input, NumberOfCpUs); + } + + [Benchmark] + public SimulationOutput RunSingleInParallel() + => _simulation.RunSingleInParallel(); +} \ No newline at end of file diff --git a/src/Vts.Benchmark/Helpers/CsvTools.cs b/src/Vts.Benchmark/Helpers/CsvTools.cs new file mode 100644 index 000000000..2d0953c81 --- /dev/null +++ b/src/Vts.Benchmark/Helpers/CsvTools.cs @@ -0,0 +1,90 @@ +using System; +using System.IO; +using System.Text.RegularExpressions; +using Vts.Benchmark.Benchmarks; + +namespace Vts.Benchmark.Helpers; + +/// +/// Provides utility methods and helper functions for benchmarking tasks +/// within the Vts.Benchmark.Helpers namespace. +/// +public static class CsvTools +{ + /// + /// Constructs the full path to the CSV file generated by BenchmarkDotNet based on the execution mode. + /// + /// + /// A boolean indicating whether the benchmark is running in parallel mode. + /// If true, the path for the parallel benchmark CSV file is returned. + /// Otherwise, the path for the non-parallel benchmark CSV file is returned. + /// + /// + /// The full path to the CSV file containing the benchmark results. + /// + internal static string GetCsvFullPath(bool runInParallel) + { + var inputPath = Path.GetFullPath(Directory.GetCurrentDirectory()); + const string filePath = "\\BenchmarkDotNet.Artifacts\\results\\"; + var csvFile = runInParallel ? + $"{typeof(ParallelMonteCarloSimulationBenchmarks).FullName}-report.csv" : + $"{typeof(MonteCarloSimulationBenchmarks).FullName}-report.csv"; + return Path.GetFullPath(inputPath + filePath + csvFile); + } + + /// + /// Reads values from a CSV file located at the specified path. + /// + /// The full path to the CSV file. + /// + /// An array of strings representing the values read from the CSV file, or null + /// if the file does not exist. + /// + internal static string[] ReadValuesFromCsv(string fullPath) + { + if (!File.Exists(fullPath)) + { + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine(@"CSV results file not found: {0}", fullPath); + Console.ForegroundColor = ConsoleColor.White; + return null; + } + + try + { + using var reader = new StreamReader(fullPath); + // read header line + reader.ReadLine(); + // read data line + var line = reader.ReadLine(); + var values = line?.Split(','); + return values; + } + catch (Exception e) + { + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine(@"Unable to access the CSV file: {0} {1}", fullPath, e.Message); + Console.ForegroundColor = ConsoleColor.White; + return null; + } + } + + + /// + /// Extracts a double value from a specified index in an array of strings. + /// + /// The array of strings containing the values to parse. + /// The index of the value to extract within the array. + /// + /// The parsed double value if successful; otherwise, null if the value cannot be parsed + /// or if the index is out of bounds. + /// + internal static double? ReadValue(string[] values, int index) + { + if (values.Length < 4) return null; + // excise double from string of type "###.## ms" + var valueMatch = Regex.Match(values[index], @"-?\d+(?:\.\d+)?").Value; + if (!double.TryParse(valueMatch, out var value)) return null; + return value; + } +} diff --git a/src/Vts.Benchmark/NLog.config b/src/Vts.Benchmark/NLog.config new file mode 100644 index 000000000..a6478e968 --- /dev/null +++ b/src/Vts.Benchmark/NLog.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Vts.Benchmark/Program.cs b/src/Vts.Benchmark/Program.cs index e5079574b..5b27f3ff5 100644 --- a/src/Vts.Benchmark/Program.cs +++ b/src/Vts.Benchmark/Program.cs @@ -7,66 +7,92 @@ using BenchmarkDotNet.Loggers; using BenchmarkDotNet.Running; using System; -using System.IO; -using System.Text.RegularExpressions; -using Vts.MonteCarlo; +using Vts.Benchmark.Benchmarks; -namespace Vts.Benchmark +namespace Vts.Benchmark; + +public static class Program { - public static class Program + /// + /// Set up execution of Monte Carlo Command Line application and run benchmark + /// collecting estimate of the Mean time of execution and Standard Deviation. + /// Output to CSV file. + /// Notes: 1) Build Vts.Benchmark in Release configuration + /// 2) Pull down enables running BenchmarkMonteCarlo or BenchmarkMonteCarloParallel + /// 3) Run with Debug tab -> Start Without Debugging + /// 4) Prior run mean data (in BenchmarkDotNet.Artifacts) is used as validation mean. + /// If no prior run data, prior mean set in code is used as validation mean. + /// + /// command line parameters + public static void Main(string[] args) { - public static void Main(string[] args) + // check for -p or --parallel argument to run parallel benchmark + var runInParallel = args.Length > 0 && (args[0] == "-p" || args[0] == "--parallel"); + + // configure BenchmarkDotNet + var config = new ManualConfig() + .AddJob(new Job("Benchmark")) + .AddLogger(ConsoleLogger.Default) + .AddColumn(TargetMethodColumn.Method, + StatisticColumn.Mean, + StatisticColumn.Error, + StatisticColumn.StdDev, + StatisticColumn.Median) + .AddExporter(CsvExporter.Default, HtmlExporter.Default, MarkdownExporter.GitHub) + .AddAnalyser(EnvironmentAnalyser.Default); + config.UnionRule = ConfigUnionRule.Union; + + // If the previous CSV file exists, get the prior mean using helper methods + var fullPath = Helpers.CsvTools.GetCsvFullPath(runInParallel); + var values = Helpers.CsvTools.ReadValuesFromCsv(fullPath); + // write out result of current run and standard deviation compared against prior mean + var priorMean = runInParallel ? 4.35 : 7.76; // [ms] put default values here in case there is no file + if (values != null) { - // Set up execution of Monte Carlo Command Line application and run benchmark - // collecting estimate of the Mean time of execution and Standard Deviation. - // Output to CSV file. - // Notes: 1) Build Vts.Benchmark in Benchmark configuration (the Post-Processor - // Program.cs will show compile errors on the CommandLine.Switch statements but this - // is okay since not included in the benchmark - // 2) Run with Debug tab -> Start Without Debugging - var config = new ManualConfig() - .AddJob(new Job("Benchmark").WithCustomBuildConfiguration("Benchmark")) - .AddLogger(ConsoleLogger.Default) - .AddColumn(TargetMethodColumn.Method, - StatisticColumn.Mean, - StatisticColumn.Error, - StatisticColumn.StdDev, - StatisticColumn.Median) - .AddExporter(CsvExporter.Default, HtmlExporter.Default, MarkdownExporter.GitHub) - .AddAnalyser(EnvironmentAnalyser.Default); - config.UnionRule = ConfigUnionRule.Union; - var summary = BenchmarkRunner.Run(config); - Console.WriteLine(summary); - // Read CSV file for Mean and Standard Deviation (StDev) data - var inputPath = Path.GetFullPath(Directory.GetCurrentDirectory()); - const string csvFile = "\\BenchmarkDotNet.Artifacts\\results\\Vts.MonteCarlo.MonteCarloSimulation-report.csv"; - var filePath = Path.GetFullPath(inputPath + csvFile); - using var reader = new StreamReader(filePath); - // read header line - reader.ReadLine(); - // read data line - var line = reader.ReadLine(); - if (line == null) return; - var values = line.Split(','); - // excise double from string of type "###.## ms" - var mean = double.Parse(Regex.Match(values[1], @"-?\d+(?:\.\d+)?").Value); // has 'ms' appended - var standardDeviation = double.Parse(Regex.Match(values[3], @"-?\d+(?:\.\d+)?").Value); // has 'ms' appended - // write out result of current run and standard deviation compared against prior mean - const double priorMean = 84.0; // ms - // output 1 sigma results - Console.ForegroundColor = ConsoleColor.Cyan; - Console.Write("SUMMARY: (Mean = {0:F} ms) +/- (SD = {1:F} ms)", mean, standardDeviation); - // output if result is larger than established mean + 1-SD - if (mean > standardDeviation + priorMean) + var meanValue = Helpers.CsvTools.ReadValue(values, 1); // the mean is the 2nd value + if (meanValue == null) { - Console.ForegroundColor = ConsoleColor.Red; - Console.WriteLine(" is 1-SD > prior mean = {0:F}", priorMean); + Console.ForegroundColor = ConsoleColor.Yellow; + Console.WriteLine(@"Could not read results from file"); + Console.ForegroundColor = ConsoleColor.White; } else { - Console.ForegroundColor = ConsoleColor.Cyan; - Console.WriteLine(" is within 1-SD of prior mean = {0:F}", priorMean); + priorMean = (double)meanValue; + Console.WriteLine(@"Prior mean is {0:F}", priorMean); } } + + // run the benchmark + var summary = runInParallel ? + // This line is used to run the parallel benchmark + BenchmarkRunner.Run(config) : + // This line is used to run the non-parallel benchmark + BenchmarkRunner.Run(config); + + Console.WriteLine(summary); + + // Read CSV file for Mean and Standard Deviation (StDev) data using helper methods + fullPath = Helpers.CsvTools.GetCsvFullPath(runInParallel); + values = Helpers.CsvTools.ReadValuesFromCsv(fullPath); + if (values == null) return; + var mean = Helpers.CsvTools.ReadValue(values, 1); // the mean is the 2nd value + var standardDeviation = Helpers.CsvTools.ReadValue(values, 3); //the standard deviation is the 4th value + + // output 1 sigma results + Console.ForegroundColor = ConsoleColor.Cyan; + Console.Write(@"SUMMARY: (Mean = {0:F} ms) +/- (2-SD = {1:F} ms)", mean, 2 * standardDeviation); + // check if mean is within 1 standard deviation about the prior mean + if (mean < priorMean - 2* standardDeviation || mean > priorMean + 2 * standardDeviation) + { + Console.ForegroundColor = ConsoleColor.DarkRed; + Console.WriteLine(@" is not within 2-SD (95.4%) of prior mean = {0:F}", priorMean); + } + else + { + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine(@" is within 2-SD (95.4%) of prior mean = {0:F}", priorMean); + } + Console.ForegroundColor = ConsoleColor.White; } -} +} \ No newline at end of file diff --git a/src/Vts.Benchmark/Properties/launchSettings.json b/src/Vts.Benchmark/Properties/launchSettings.json new file mode 100644 index 000000000..9400096d7 --- /dev/null +++ b/src/Vts.Benchmark/Properties/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "BenchmarkMonteCarlo": { + "commandName": "Project" + }, + "BenchmarkMonteCarloParallel": { + "commandLineArgs": "-p", + "commandName": "Project" + } + } +} \ No newline at end of file diff --git a/src/Vts.sln b/src/Vts.sln index 5756d6d37..a5813861d 100644 --- a/src/Vts.sln +++ b/src/Vts.sln @@ -25,10 +25,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vts.Benchmark", "Vts.Benchm EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Benchmark|Any CPU = Benchmark|Any CPU - Benchmark|Mixed Platforms = Benchmark|Mixed Platforms - Benchmark|Win32 = Benchmark|Win32 - Benchmark|x86 = Benchmark|x86 Debug|Any CPU = Debug|Any CPU Debug|Mixed Platforms = Debug|Mixed Platforms Debug|Win32 = Debug|Win32 @@ -37,16 +33,8 @@ Global Release|Mixed Platforms = Release|Mixed Platforms Release|Win32 = Release|Win32 Release|x86 = Release|x86 - ReleaseWhiteList|Any CPU = ReleaseWhiteList|Any CPU - ReleaseWhiteList|Mixed Platforms = ReleaseWhiteList|Mixed Platforms - ReleaseWhiteList|Win32 = ReleaseWhiteList|Win32 - ReleaseWhiteList|x86 = ReleaseWhiteList|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Benchmark|Any CPU.ActiveCfg = Debug|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Benchmark|x86.ActiveCfg = Debug|Any CPU {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Debug|Any CPU.Build.0 = Debug|Any CPU {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -61,19 +49,6 @@ Global {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Release|Win32.ActiveCfg = Release|Any CPU {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Release|Win32.Build.0 = Release|Any CPU {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.Release|x86.ActiveCfg = Release|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {8E45BF42-5B0B-4AEF-9E63-B2966622FC23}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Any CPU.ActiveCfg = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Any CPU.Build.0 = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Mixed Platforms.ActiveCfg = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Mixed Platforms.Build.0 = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Win32.ActiveCfg = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|Win32.Build.0 = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|x86.ActiveCfg = Benchmark|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Benchmark|x86.Build.0 = Benchmark|Any CPU {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Debug|Any CPU.Build.0 = Debug|Any CPU {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -87,20 +62,6 @@ Global {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Release|Mixed Platforms.Build.0 = Release|Any CPU {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Release|Win32.ActiveCfg = Release|Any CPU {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.Release|x86.ActiveCfg = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|Any CPU.Build.0 = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {DBF062BD-84EE-4ADF-ADB7-A27B10EAB13F}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Any CPU.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Any CPU.Build.0 = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Mixed Platforms.Build.0 = Debug|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|Win32.Build.0 = Debug|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|x86.ActiveCfg = Debug|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Benchmark|x86.Build.0 = Debug|Any CPU {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -114,16 +75,6 @@ Global {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Release|Mixed Platforms.Build.0 = Release|Any CPU {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Release|Win32.ActiveCfg = Release|Any CPU {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.Release|x86.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|Any CPU.Build.0 = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {2C5074CA-FBA8-46F1-A430-5437D67B63E5}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Benchmark|Any CPU.ActiveCfg = Debug|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Benchmark|x86.ActiveCfg = Debug|Any CPU {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Debug|Any CPU.Build.0 = Debug|Any CPU {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -136,15 +87,6 @@ Global {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Release|Mixed Platforms.Build.0 = Release|Any CPU {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Release|Win32.ActiveCfg = Release|Any CPU {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.Release|x86.ActiveCfg = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {169F5A43-1079-4E1F-87A2-C5E8E7A69BF9}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Benchmark|Any CPU.ActiveCfg = Debug|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Benchmark|x86.ActiveCfg = Debug|Any CPU {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Debug|Any CPU.Build.0 = Debug|Any CPU {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -157,15 +99,6 @@ Global {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Release|Mixed Platforms.Build.0 = Release|Any CPU {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Release|Win32.ActiveCfg = Release|Any CPU {36DE9584-F033-4EC0-A18F-1AE60EE55754}.Release|x86.ActiveCfg = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {36DE9584-F033-4EC0-A18F-1AE60EE55754}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.Benchmark|Any CPU.ActiveCfg = Debug|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.Benchmark|x86.ActiveCfg = Debug|Any CPU {8A1194A0-C773-483B-BD78-9D013105CEA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8A1194A0-C773-483B-BD78-9D013105CEA1}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A1194A0-C773-483B-BD78-9D013105CEA1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -178,19 +111,6 @@ Global {8A1194A0-C773-483B-BD78-9D013105CEA1}.Release|Mixed Platforms.Build.0 = Release|Any CPU {8A1194A0-C773-483B-BD78-9D013105CEA1}.Release|Win32.ActiveCfg = Release|Any CPU {8A1194A0-C773-483B-BD78-9D013105CEA1}.Release|x86.ActiveCfg = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {8A1194A0-C773-483B-BD78-9D013105CEA1}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Any CPU.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Any CPU.Build.0 = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Mixed Platforms.ActiveCfg = Debug|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Mixed Platforms.Build.0 = Debug|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Win32.ActiveCfg = Debug|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|Win32.Build.0 = Debug|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|x86.ActiveCfg = Debug|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Benchmark|x86.Build.0 = Debug|Any CPU {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -207,13 +127,6 @@ Global {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Release|Win32.Build.0 = Release|Any CPU {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Release|x86.ActiveCfg = Release|Any CPU {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.Release|x86.Build.0 = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|Any CPU.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|Mixed Platforms.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|Mixed Platforms.Build.0 = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|Win32.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|Win32.Build.0 = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|x86.ActiveCfg = Release|Any CPU - {3B0676C4-5CF1-4A0B-97E4-0CDF2B035702}.ReleaseWhiteList|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Vts/MonteCarlo/MonteCarloSimulation.cs b/src/Vts/MonteCarlo/MonteCarloSimulation.cs index 421118212..4b66a8ac0 100644 --- a/src/Vts/MonteCarlo/MonteCarloSimulation.cs +++ b/src/Vts/MonteCarlo/MonteCarloSimulation.cs @@ -7,9 +7,6 @@ using Vts.MonteCarlo.Controllers; using Vts.MonteCarlo.Extensions; using Vts.MonteCarlo.Factories; -#if BENCHMARK -using BenchmarkDotNet.Attributes; -#endif namespace Vts.MonteCarlo { @@ -179,9 +176,6 @@ public void SetOutputPathForDatabases(string outputPath) /// Run the simulation /// /// SimulationOutput -#if BENCHMARK - [Benchmark] -#endif public virtual SimulationOutput Run() { _isCancelled = false; diff --git a/src/Vts/MonteCarlo/ParallelMonteCarloSimulation.cs b/src/Vts/MonteCarlo/ParallelMonteCarloSimulation.cs index 0e9e32754..8ec932ed7 100644 --- a/src/Vts/MonteCarlo/ParallelMonteCarloSimulation.cs +++ b/src/Vts/MonteCarlo/ParallelMonteCarloSimulation.cs @@ -7,9 +7,6 @@ using Vts.Common.Logging; using Vts.IO; using Vts.MonteCarlo.Factories; -#if BENCHMARK -using BenchmarkDotNet.Attributes; -#endif namespace Vts.MonteCarlo { @@ -26,21 +23,10 @@ public class ParallelMonteCarloSimulation /// /// SimulationInput class passed in /// -#if BENCHMARK - [ParamsSource(nameof(SimulationInputs))] -#endif public SimulationInput Input { get; set; } /// /// number of CPUs /// -#if BENCHMARK - public IEnumerable SimulationInputs() - { - yield return new SimulationInput { N = 100 }; - } - - [Params(4)] -#endif public int NumberOfCPUs { get; set; } /// /// simulation statistics @@ -54,10 +40,8 @@ public IEnumerable SimulationInputs() /// number of parallel CPUs to be run public ParallelMonteCarloSimulation(SimulationInput input, int numberOfCpus) { -#if !BENCHMARK Input = input; NumberOfCPUs = numberOfCpus; -#endif } /// @@ -69,9 +53,6 @@ public ParallelMonteCarloSimulation() : this(new SimulationInput(), 2) { } /// Method to run single MC simulation in parallel /// /// array of SimulationOutput -#if BENCHMARK - [Benchmark] -#endif public SimulationOutput RunSingleInParallel() { var threads = NumberOfCPUs; diff --git a/src/Vts/Vts.csproj b/src/Vts/Vts.csproj index 710853952..1a9c45262 100644 --- a/src/Vts/Vts.csproj +++ b/src/Vts/Vts.csproj @@ -18,7 +18,7 @@ 12.2.0.0 12.2.0.0 - Debug;Release;Benchmark + Debug;Release license.md logo.png readme.md @@ -27,9 +27,6 @@ Virtual Tissue Simulator True - - true - Vts.xml @@ -124,9 +121,6 @@ - - -