private static GPURepairRecord GetGPURepairRecord(IEnumerable <GPURepairRecord> records) { GPURepairRecord record = new GPURepairRecord(); record.Kernel = records.First().Kernel; // if the runs have multiple statuses, choose the one based on priority GPURepairTimeRecord.Status status; if (records.Select(x => x.ResultEnum).Distinct().Count() == 1) { status = records.First().ResultEnum; } else { status = records.Select(x => x.ResultEnum).OrderByDescending(x => x.Priority).First(); } records = records.Where(x => x.ResultEnum == status); record.Result = status.ToString(); record.Clang = records.Select(x => x.Clang).Average(); record.Opt = records.Select(x => x.Opt).Average(); record.Bugle = records.Select(x => x.Bugle).Average(); record.Instrumentation = records.Select(x => x.Instrumentation).Average(); record.VCGen = records.Select(x => x.VCGen).Average(); record.Cruncher = records.Select(x => x.Cruncher).Average(); record.Repair = records.Select(x => x.Repair).Average(); record.Total = records.Select(x => x.Total).Average(); record.Lines = records.Select(x => x.Lines).Average(); record.Blocks = records.Select(x => x.Blocks).Average(); record.Commands = records.Select(x => x.Commands).Average(); record.CallCommands = records.Select(x => x.CallCommands).Average(); record.Barriers = records.Select(x => x.Barriers).Average(); record.GridLevelBarriers = records.Select(x => x.GridLevelBarriers).Average(); record.LoopBarriers = records.Select(x => x.LoopBarriers).Average(); record.Changes = records.Select(x => x.Changes).Average(); record.SolutionCalls = records.Select(x => x.SolutionCalls).Average(); record.SolutionGrid = records.Select(x => x.SolutionGrid).Average(); record.SolutionLoop = records.Select(x => x.SolutionLoop).Average(); record.SourceWeight = records.Select(x => x.SourceWeight).Average(); record.RepairedWeight = records.Select(x => x.RepairedWeight).Average(); record.RunsAfterOpt = records.Select(x => x.RunsAfterOpt).Average(); record.FailsAfterOpt = records.Select(x => x.FailsAfterOpt).Average(); record.mhsCount = records.Select(x => x.mhsCount).Average(); record.mhsTime = records.Select(x => x.mhsTime).Average(); record.MaxSATCount = records.Select(x => x.MaxSATCount).Average(); record.MaxSATTime = records.Select(x => x.MaxSATTime).Average(); record.SATCount = records.Select(x => x.SATCount).Average(); record.SATTime = records.Select(x => x.SATTime).Average(); record.VerCount = records.Select(x => x.VerCount).Average(); record.VerTime = records.Select(x => x.VerTime).Average(); record.OptCount = records.Select(x => x.OptCount).Average(); record.OptTime = records.Select(x => x.OptTime).Average(); record.ExceptionMessage = string.Join(";", records.Select(x => x.ExceptionMessage).Distinct()); return(record); }
public static string Result(this GPURepairRecord record, BaseReportRecord report_record) { if (report_record.GPUVerify.Result != "PASS") { return(record.Result); } if (record.ResultEnum == GPURepairTimeRecord.Status.Success && record.Changes == 0) { return("UNCHANGED"); } return(record.Result); }
public async Task Generate() { List <GPURepairTimeRecord> timings = CsvWrapper.Read <GPURepairTimeRecord>(timeFile); List <GPURepairRecord> records = new List <GPURepairRecord>(); foreach (GPURepairTimeRecord timing in timings) { timing.Kernel = Common.StandardizeKernelName(timing.Kernel); records.Add(new GPURepairRecord { Kernel = timing.Kernel, Result = timing.Result, Clang = timing.Clang, Opt = timing.Opt, Bugle = timing.Bugle, Instrumentation = timing.Instrumentation, VCGen = timing.VCGen, Cruncher = timing.Cruncher, Repair = timing.Repair, Total = timing.Total, }); } IEnumerable <string> directories = Directory.EnumerateDirectories(directory, "*", SearchOption.AllDirectories); foreach (string directory in directories) { GPURepairRecord record = records.FirstOrDefault(x => x.Kernel == Common.StandardizeKernelName(directory)); if (record == null) { continue; } foreach (string file in Directory.GetFiles(directory)) { if (file.Contains("metrics.log")) { string[] lines = File.ReadAllLines(file); foreach (string line in lines) { string[] array = line.Split(new char[] { ';' }); if (array[0] == "Blocks") { record.Blocks = int.Parse(array[1]); } else if (array[0] == "Commands") { record.Commands = int.Parse(array[1]); } else if (array[0] == "CallCommands") { record.CallCommands = int.Parse(array[1]); } else if (array[0] == "Barriers") { record.Barriers = int.Parse(array[1]); } else if (array[0] == "GridLevelBarriers") { record.GridLevelBarriers = int.Parse(array[1]); } else if (array[0] == "LoopBarriers") { record.LoopBarriers = int.Parse(array[1]); } else if (array[0] == "Changes") { record.Changes = int.Parse(array[1]); } else if (array[0] == "SolutionCalls") { record.SolutionCalls = int.Parse(array[1]); } else if (array[0] == "SolutionGrid") { record.SolutionGrid = int.Parse(array[1]); } else if (array[0] == "SolutionLoop") { record.SolutionLoop = int.Parse(array[1]); } else if (array[0] == "RunsAfterOpt") { record.RunsAfterOpt = record.RunsAfterOpt + 1; } else if (array[0] == "FailsAfterOpt") { record.FailsAfterOpt = record.FailsAfterOpt + 1; } else if (array[0] == "ExceptionMessage") { record.ExceptionMessage = array[1]; } else if (array[0] == "SourceWeight") { record.SourceWeight = int.Parse(array[1]); } else if (array[0] == "RepairedWeight") { record.RepairedWeight = int.Parse(array[1]); } else if (array[0] == "Watch") { if (array[1] == "MaxSAT") { record.MaxSATCount = record.MaxSATCount + 1; record.MaxSATTime = record.MaxSATTime + int.Parse(array[2]); } else if (array[1] == "mhs") { record.mhsCount = record.mhsCount + 1; record.mhsTime = record.mhsTime + int.Parse(array[2]); } else if (array[1] == "Verification") { record.VerCount = record.VerCount + 1; record.VerTime = record.VerTime + int.Parse(array[2]); } else if (array[1] == "Optimization") { record.OptCount = record.OptCount + 1; record.OptTime = record.OptTime + int.Parse(array[2]); } else if (array[1] == "SAT") { record.SATCount = record.SATCount + 1; record.SATTime = record.SATTime + int.Parse(array[2]); } } } } else if (file.Contains(".cu") || file.Contains(".cl") || file.Contains(".h")) { record.Lines += await GetLines(file); } } } CsvWrapper.Write(records.OrderBy(x => x.Kernel), summaryFile); }
private static void PrepareResults(string directory) { IEnumerable <ToolComparisonRecord> cuda = DataAnalyzer.ToolComparisonRecords.Where(x => !x.Kernel.Contains("OpenCL")); IEnumerable <ToolComparisonRecord> opencl = DataAnalyzer.ToolComparisonRecords.Where(x => x.Kernel.Contains("OpenCL")); IEnumerable <ToolComparisonRecord> cuda_verified = cuda.Where(x => x.GPUVerify_Status == "PASS"); IEnumerable <ToolComparisonRecord> opencl_verified = opencl.Where(x => x.GPUVerify_Status == "PASS"); IEnumerable <ToolComparisonRecord> cuda_verified_as_unchanged = cuda_verified.Where(x => x.AutoSync_Status == "UNCHANGED"); IEnumerable <ToolComparisonRecord> cuda_verified_gr_unchanged = cuda_verified.Where(x => x.GPURepair_Status == "UNCHANGED"); IEnumerable <ToolComparisonRecord> opencl_verified_gr_unchanged = opencl_verified.Where(x => x.GPURepair_Status == "UNCHANGED"); IEnumerable <ToolComparisonRecord> cuda_verified_gr_changed = cuda_verified.Where(x => x.GPURepair_Status == "PASS"); IEnumerable <ToolComparisonRecord> opencl_verified_gr_changed = opencl_verified.Where(x => x.GPURepair_Status == "PASS"); IEnumerable <ToolComparisonRecord> cuda_verified_as_timeout = cuda_verified.Where(x => x.AutoSync_Status == "TIMEOUT"); IEnumerable <ToolComparisonRecord> cuda_verified_gr_timeout = cuda_verified.Where(x => x.GPURepair_Status == "FAIL(7)"); IEnumerable <ToolComparisonRecord> opencl_verified_gr_timeout = opencl_verified.Where(x => x.GPURepair_Status == "FAIL(7)"); int cuda_verified_as_errors = cuda_verified.Count() - (cuda_verified_as_unchanged.Count() + cuda_verified_as_timeout.Count()); int cuda_verified_gr_errors = cuda_verified.Count() - (cuda_verified_gr_unchanged.Count() + cuda_verified_gr_changed.Count() + cuda_verified_gr_timeout.Count()); int opencl_verified_gr_errors = opencl_verified.Count() - (opencl_verified_gr_unchanged.Count() + opencl_verified_gr_changed.Count() + opencl_verified_gr_timeout.Count()); IEnumerable <ToolComparisonRecord> cuda_repairable = cuda.Where(x => x.GPUVerify_Status == "FAIL(6)"); IEnumerable <ToolComparisonRecord> opencl_repairable = opencl.Where(x => x.GPUVerify_Status == "FAIL(6)"); IEnumerable <ToolComparisonRecord> cuda_repairable_as_repaired = cuda_repairable.Where(x => x.AutoSync_Status == "REPAIRED"); IEnumerable <ToolComparisonRecord> cuda_repairable_gr_repaired = cuda_repairable.Where(x => x.GPURepair_Status == "PASS"); IEnumerable <ToolComparisonRecord> opencl_repairable_gr_repaired = opencl_repairable.Where(x => x.GPURepair_Status == "PASS"); IEnumerable <ToolComparisonRecord> cuda_repairable_as_repairerror = cuda_repairable.Where(x => x.AutoSync_Status == "REPAIR_ERROR"); IEnumerable <ToolComparisonRecord> cuda_repairable_gr_repairerror = cuda_repairable.Where(x => x.GPURepair_Status == "FAIL(202)"); IEnumerable <ToolComparisonRecord> opencl_repairable_gr_repairerror = opencl_repairable.Where(x => x.GPURepair_Status == "FAIL(202)"); IEnumerable <ToolComparisonRecord> cuda_repairable_as_timeout = cuda_repairable.Where(x => x.AutoSync_Status == "TIMEOUT"); IEnumerable <ToolComparisonRecord> cuda_repairable_gr_timeout = cuda_repairable.Where(x => x.GPURepair_Status == "FAIL(7)"); IEnumerable <ToolComparisonRecord> opencl_repairable_gr_timeout = opencl_repairable.Where(x => x.GPURepair_Status == "FAIL(7)"); int cuda_repairable_as_errors = cuda_repairable.Count() - (cuda_repairable_as_repaired.Count() + cuda_repairable_as_repairerror.Count() + cuda_repairable_as_timeout.Count()); int cuda_repairable_gr_errors = cuda_repairable.Count() - (cuda_repairable_gr_repaired.Count() + cuda_repairable_gr_repairerror.Count() + cuda_repairable_gr_timeout.Count()); int opencl_repairable_gr_errors = opencl_repairable.Count() - (opencl_repairable_gr_repaired.Count() + opencl_repairable_gr_repairerror.Count() + opencl_repairable_gr_timeout.Count()); List <ToolComparisonRecord> cuda_repairable_gr_repaired_grid = new List <ToolComparisonRecord>(); foreach (ToolComparisonRecord record in cuda_repairable_gr_repaired) { GPURepairRecord repair_record = FileParser.GPURepair.FirstOrDefault(x => x.Kernel == record.Kernel); if (repair_record != null && repair_record.SolutionGrid != 0) { cuda_repairable_gr_repaired_grid.Add(record); } } int cuda_repairable_gr_repaired_count = cuda_repairable_gr_repaired.Count() - cuda_repairable_gr_repaired_grid.Count; IEnumerable <ToolComparisonRecord> cuda_unrepairable = cuda.Where(x => x.GPUVerify_Status != "PASS" && x.GPUVerify_Status != "FAIL(6)"); IEnumerable <ToolComparisonRecord> opencl_unrepairable = opencl.Where(x => x.GPUVerify_Status != "PASS" && x.GPUVerify_Status != "FAIL(6)"); IEnumerable <ToolComparisonRecord> cuda_unrepairable_as_errors = cuda_unrepairable.Where(x => x.AutoSync_Status == "ERROR"); IEnumerable <ToolComparisonRecord> cuda_unrepairable_as_falsepositives = cuda_unrepairable.Where(x => x.AutoSync_Status == "FALSE_POSITIVE"); string file = directory + Path.DirectorySeparatorChar + "report" + Path.DirectorySeparatorChar + "tables" + Path.DirectorySeparatorChar + "results.tex"; string content = File.ReadAllText(file); content = content.Replace("@@cuda@@", cuda); content = content.Replace("@@opencl@@", opencl); content = content.Replace("@@cuda_verified@@", cuda_verified); content = content.Replace("@@opencl_verified@@", opencl_verified); content = content.Replace("@@cuda_verified_as_unchanged@@", cuda_verified_as_unchanged); content = content.Replace("@@cuda_verified_gr_unchanged@@", cuda_verified_gr_unchanged); content = content.Replace("@@opencl_verified_gr_unchanged@@", opencl_verified_gr_unchanged); content = content.Replace("@@cuda_verified_gr_changed@@", cuda_verified_gr_changed); content = content.Replace("@@opencl_verified_gr_changed@@", opencl_verified_gr_changed); content = content.Replace("@@cuda_verified_as_timeout@@", cuda_verified_as_timeout); content = content.Replace("@@cuda_verified_gr_timeout@@", cuda_verified_gr_timeout); content = content.Replace("@@opencl_verified_gr_timeout@@", opencl_verified_gr_timeout); content = content.Replace("@@cuda_verified_as_errors@@", cuda_verified_as_errors); content = content.Replace("@@cuda_verified_gr_errors@@", cuda_verified_gr_errors); content = content.Replace("@@opencl_verified_gr_errors@@", opencl_verified_gr_errors); content = content.Replace("@@cuda_repairable@@", cuda_repairable); content = content.Replace("@@opencl_repairable@@", opencl_repairable); content = content.Replace("@@cuda_repairable_as_repaired@@", cuda_repairable_as_repaired); content = content.Replace("@@cuda_repairable_gr_repaired@@", cuda_repairable_gr_repaired_count); content = content.Replace("@@opencl_repairable_gr_repaired@@", opencl_repairable_gr_repaired); content = content.Replace("@@cuda_repairable_gr_repaired_grid@@", cuda_repairable_gr_repaired_grid); content = content.Replace("@@cuda_repairable_as_repairerror@@", cuda_repairable_as_repairerror); content = content.Replace("@@cuda_repairable_gr_repairerror@@", cuda_repairable_gr_repairerror); content = content.Replace("@@opencl_repairable_gr_repairerror@@", opencl_repairable_gr_repairerror); content = content.Replace("@@cuda_repairable_as_timeout@@", cuda_repairable_as_timeout); content = content.Replace("@@cuda_repairable_gr_timeout@@", cuda_repairable_gr_timeout); content = content.Replace("@@opencl_repairable_gr_timeout@@", opencl_repairable_gr_timeout); content = content.Replace("@@cuda_repairable_as_errors@@", cuda_repairable_as_errors); content = content.Replace("@@cuda_repairable_gr_errors@@", cuda_repairable_gr_errors); content = content.Replace("@@opencl_repairable_gr_errors@@", opencl_repairable_gr_errors); content = content.Replace("@@cuda_unrepairable@@", cuda_unrepairable); content = content.Replace("@@opencl_unrepairable@@", opencl_unrepairable); content = content.Replace("@@cuda_unrepairable_as_errors@@", cuda_unrepairable_as_errors); content = content.Replace("@@cuda_unrepairable_as_falsepositives@@", cuda_unrepairable_as_falsepositives); File.WriteAllText(file, content); }