/// <summary> /// Evaluate the OpenCL device. /// </summary> private void EvalOpenCL() { try { // did the caller assign a device? If not, use the first GPU, // failing that, // use the first CPU. Failing that, as well, don't test OpenCL. if (this.device == null) { if (EncogFramework.Instance.CL == null) { EncogFramework.Instance.InitCL(); } this.device = EncogFramework.Instance.CL.ChooseDevice(); } } catch (Exception) { this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "No OpenCL devices, result: 0"); this.clScore = 0; } int small = 0, medium = 0, large = 0, huge = 0; try { small = Evaluate.EvaluateTrain(device, 2, 4, 0, 1); this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, tiny= " + Format.FormatInteger(small / 100)); } catch (Exception) { this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, tiny FAILED"); } try { medium = Evaluate.EvaluateTrain(device, 10, 20, 0, 1); this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, small= " + Format.FormatInteger(medium / 30)); } catch (Exception) { this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, small FAILED"); } try { large = Evaluate.EvaluateTrain(device, 100, 200, 40, 5); this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, large= " + Format.FormatInteger(large)); } catch (Exception) { this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, large FAILED"); } try { huge = Evaluate.EvaluateTrain(device, 200, 300, 200, 50); this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, huge= " + Format.FormatInteger(huge)); } catch (Exception) { this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "Evaluate OpenCL, huge FAILED"); } int result = (small / 100) + (medium / 30) + large + huge; this.report.Report(EncogBenchmark.STEPS, EncogBenchmark.STEP2, "OpenCL result: " + result); this.clScore = result; }