public ComputeMethod(string Kernel, string Method, AcceleratorDevice device) { this.Source = Kernel; this.Method = Method; this.Device = device; cl = new EasyCL() { Accelerator = device }; cl.LoadKernel(Kernel); }
public static double GetDeviceBandwidth_GBps(AcceleratorDevice Device) { ComputeMethod method = new ComputeMethod(Kernels.PerformanceKernel, "Bandwidth", Device); int[] values = Enumerable.Range(0, 1000000).ToArray(); double bytes = values.Length * sizeof(int); method.Invoke(values.Length, values); method.Invoke(values.Length); Stopwatch total = Stopwatch.StartNew(); method.Invoke(values.Length); double bytespersec = bytes / total.Elapsed.TotalSeconds; double GBytespersec = bytespersec / (8 * 1000 * 1000 * 1000.0); return(GBytespersec); }
public static double GetDeviceGFlops_Single(AcceleratorDevice Device) { ComputeMethod method = new ComputeMethod(Kernels.PerformanceKernel, "SinglePerformance", Device); return(GetGFlops(method, true)); }
public static ComputeMethod CompileKernel(string Kernel, string Method, AcceleratorDevice Device) { return(new ComputeMethod(Kernel, Method, Device)); }