public static List <long> Validate(ValidationSceneFactory sceneFactory) { var stopwatch = System.Diagnostics.Stopwatch.StartNew(); var scene = sceneFactory.MakeScene(); stopwatch.Stop(); var sceneLoadTime = stopwatch.ElapsedMilliseconds; var algorithms = new Dictionary <string, Integrator>() { { "PathTracer", new PathTracer() { TotalSpp = sceneFactory.SamplesPerPixel, MaxDepth = sceneFactory.MaxDepth, MinDepth = 1 } }, { "ClassicBidir", new ClassicBidir() { NumIterations = sceneFactory.SamplesPerPixel / 2, MaxDepth = sceneFactory.MaxDepth, RenderTechniquePyramid = false } }, { "Vcm", new VertexConnectionAndMerging() { NumIterations = sceneFactory.SamplesPerPixel / 2, MaxDepth = sceneFactory.MaxDepth, RenderTechniquePyramid = false, } } }; var(images, times) = RenderImages(scene, algorithms.Values, algorithms.Keys, sceneFactory.Name); if (!ValidateImages(images)) { Console.WriteLine("Validation error: Average image values too far appart!"); throw new Exception("Validation error: Average image values too far appart!"); } times.Add(sceneLoadTime); return(times); }
public static List <long> Benchmark(ValidationSceneFactory sceneFactory, int numTrials) { var totalTimes = Validate(sceneFactory); for (int i = 1; i < numTrials; ++i) { var times = Validate(sceneFactory); for (int k = 0; k < totalTimes.Count; ++k) { totalTimes[k] += times[k]; } } // Normalize for (int k = 0; k < totalTimes.Count; ++k) { totalTimes[k] /= numTrials; } return(totalTimes); }