/// <summary> /// Runs CPU benchmark and outputs summary results, /// with an overall statistic provided (index to 100 on a Intel Skylake 6142). /// </summary> /// <returns>Relative CPU index (baseline 100)</returns> static int DumpCPUBenchmark() { Console.WriteLine("-----------------------------------------------------------------------------------"); Console.WriteLine("CPU BENCHMARK"); Position ps = Position.StartPosition; EncodedPositionBoard zb = default; MGMove nmove = ConverterMGMoveEncodedMove.EncodedMoveToMGChessMove(new EncodedMove("e2e4"), MGChessPositionConverter.MGChessPositionFromFEN(ps.FEN)); float ops1 = Benchmarking.DumpOperationTimeAndMemoryStats(() => MGPosition.FromPosition(ps), "MGPosition.FromPosition"); float ops2 = Benchmarking.DumpOperationTimeAndMemoryStats(() => MGChessPositionConverter.MGChessPositionFromFEN(ps.FEN), "MGChessPositionFromFEN"); float ops3 = Benchmarking.DumpOperationTimeAndMemoryStats(() => ConverterMGMoveEncodedMove.MGChessMoveToEncodedMove(nmove), "MGChessMoveToLZPositionMove"); float ops4 = Benchmarking.DumpOperationTimeAndMemoryStats(() => EncodedBoardZobrist.ZobristHash(zb), "ZobristHash"); // Performance metric is against a baseline system (Intel Skylake 6142) const float REFERENCE_BM1_OPS = 2160484; const float REFERENCE_BM2_OPS = 448074; const float REFERENCE_BM3_OPS = 157575582; const float REFERENCE_BM4_OPS = 112731351; float relative1 = ops1 / REFERENCE_BM1_OPS; float relative2 = ops2 / REFERENCE_BM2_OPS; float relative3 = ops3 / REFERENCE_BM3_OPS; float relative4 = ops4 / REFERENCE_BM4_OPS; float avg = StatUtils.Average(relative1, relative2, relative3, relative4); Console.WriteLine(); Console.WriteLine($"CERES CPU BENCHMARK SCORE: {avg*100,4:F0}"); return((int)MathF.Round(avg * 100, 0)); }
private async void RunDarknetVideo_Impl() { ConsoleLog("Viewing " + Path.GetFileName(VideoPath) + ". You can continue using the app."); Stopwatch watch = new Stopwatch(); watch.Start(); await(Task.Run(Async_VideoTagging_Start).ConfigureAwait(true)); // await (Task.Run(() => { API_ImageDetection.TagVideo(VideoPath, true); }).ConfigureAwait(true)); watch.Stop(); ConsoleLog("Video completed in " + Benchmarking.TimePassed(watch), "Find ouput in videos folder."); }
private MeasureResults GenerateBenchmarks(BenchmarkType type, StructureType types, int start, int count, int step, int control) { switch (type) { default: case BenchmarkType.Add: return(UAM.Kora.Benchmarking.MeasureSeriesAdd(types, start, count, step)); case BenchmarkType.Delete: return(Benchmarking.MeasureSeriesDelete(types, start, count, step)); case BenchmarkType.Search: return(Benchmarking.MeasureSeriesSearch(types, start, count, step, control)); case BenchmarkType.Successor: return(Benchmarking.MeasureSeriesSuccessor(types, start, count, step, control)); case BenchmarkType.Memory: return(Benchmarking.MeasureSeriesMemory(types, start, count, step)); } }
/* Runs YOLO Image classification for the queued list of images. */ private async void RunYOLO_Impl() { if (ShowResultImage) { ConsoleLog("Tagging " + ImageQueue.Count + " images.", "(Close image popups to advance.)"); } else { ConsoleLog("Tagging " + ImageQueue.Count + " images.", "(Silent mode.)"); } // MessageBox.Show(Environment.CurrentDirectory); Stopwatch watch = new Stopwatch(); watch.Start(); List <String> OneQueue = new List <String>(); foreach (var str in ImageQueue) { OneQueue.Add(str); } if (ShowResultImage) { await(Task.Run(() => { TagImages_AlwaysShow_Task(OneQueue); }).ConfigureAwait(true)); } else { await(Task.Run(() => { TagImages_NeverShow_Task(OneQueue, "ImageData"); }).ConfigureAwait(true)); } // TagImages_AlwaysShow_Task watch.Stop(); ConsoleLog("Tagged " + ImageQueue.Count + " images in " + Benchmarking.TimePassed(watch), "(Showing tagged images as well.)"); }
private async void GenerateImageBatch_Impl() { ConsoleLog("Batching images from " + Path.GetFileName(VideoPath)); Stopwatch watch = new Stopwatch(); watch.Start(); // Populates images in "{ProjectDir}/ImageBatch"... await(Task.Run(GenerateImageBatch_Task).ConfigureAwait(true)); ConsoleLog("(1/3) Batching complete. Preparing list..."); // Makes a list of images from "{ProjectDir}/ImageBatch"... await(Task.Run(MakeImageQueueFileFromFolder_Task).ConfigureAwait(true)); ConsoleLog("(2/3) List prepared. Proceeding with detection..."); String QueueFileDir = Path.Combine(Properties.Settings.Default.ProjectDir, "ImageBatch", "ImageQueue.txt"); await(Task.Run(() => { TagImages_NeverShow_Task(QueueFileDir); }).ConfigureAwait(true)); ConsoleLog("(3/3) Completed tagging images."); watch.Stop(); ConsoleLog("Video taggin completed in " + Benchmarking.TimePassed(watch)); }
public void TestKernelLoadTime() { Benchmarking.TimeAction("Kernel Load", () => { var kernel = Kernel.Instance; }); }
public void BenchmarkPerformance() { List <DummyPersistanceObject> list = new List <DummyPersistanceObject>(); for (int i = 0; i < 100000; i++) { list.Add(new DummyPersistanceObject() { Bar1 = i, Bar2 = "hello" }); } Benchmarking.TimeAction("Standard serialization", () => { using (MemoryStream ms = new MemoryStream()) { BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(ms, list); ms.Position = 0; list = new List <DummyPersistanceObject>(); list = (List <DummyPersistanceObject>)bf.Deserialize(ms); } }); GC.Collect(); Benchmarking.TimeAction("Manual Serialization", () => { using (MemoryStream ms = new MemoryStream()) { BinaryWriter bw = new BinaryWriter(ms); foreach (var foo in list) { foo.Write(bw); } ms.Position = 0; BinaryReader reader = new BinaryReader(ms); list = new List <DummyPersistanceObject>(); for (int i = 0; i < 100000; i++) { list.Add(DummyPersistanceObject.Read(reader)); } } }); GC.Collect(); Benchmarking.TimeAction("Custom Serializer", () => { using (MemoryStream ms = new MemoryStream()) { foreach (var foo in list) { Serializer.Serialize(ms, foo); } ms.Position = 0; list = new List <DummyPersistanceObject>(); for (int i = 0; i < 100000; i++) { list.Add(Serializer.Deserialize <DummyPersistanceObject>(ms)); } } }); }