Beispiel #1
0
        protected virtual void Initialize(DeviceType deviceType, string source)
        {
            Devices = Platform.QueryDevices(deviceType);
            if (Devices.Length == 0)
            {
                throw new OpenCLException("No devices of type " + deviceType + " present");
            }

            Context = Platform.CreateContext(null, Devices, null, IntPtr.Zero);
            CQs     = new CommandQueue[Devices.Length];
            for (int i = 0; i < CQs.Length; i++)
            {
                CQs[i] = Context.CreateCommandQueue(Devices[i], CommandQueueProperties.PROFILING_ENABLE);
            }
            CQ      = CQs[0];
            Program = Context.CreateProgramWithSource(source);
            Program.Build();
            Kernels = Program.CreateKernelDictionary();
        }
Beispiel #2
0
 public void BuildOCLSource(string source)
 {
     oclProgram = oclContext.CreateProgramWithSource(source);
     oclProgram.Build();
     FilterKernel = oclProgram.CreateKernel("FilterImage");
 }