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);
        }
Example #2
0
        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);
        }
Example #3
0
        public static double GetDeviceGFlops_Single(AcceleratorDevice Device)
        {
            ComputeMethod method = new ComputeMethod(Kernels.PerformanceKernel, "SinglePerformance", Device);

            return(GetGFlops(method, true));
        }
Example #4
0
 public static ComputeMethod CompileKernel(string Kernel, string Method, AcceleratorDevice Device)
 {
     return(new ComputeMethod(Kernel, Method, Device));
 }