public OpenCLKernel(OpenCLProgram ocl, string kernelName)
 {
     // make a copy of the queue descriptor
     queue = ocl.Queue;
     // load chosen kernel from program
     kernel = ocl.Program.CreateKernel(kernelName);
 }
        public OpenCLBuffer(OpenCLProgram ocl, T[] buffer, int flags = ON_DEVICE + ON_HOST + READ_WRITE)
        {
            queue = ocl.Queue;
            int clflags = (int)ComputeMemoryFlags.UseHostPointer;

            if ((flags & READ_ONLY) > 0)
            {
                clflags += (int)ComputeMemoryFlags.ReadOnly;
            }
            if ((flags & WRITE_ONLY) > 0)
            {
                clflags += (int)ComputeMemoryFlags.WriteOnly;
            }
            if ((flags & READ_WRITE) > 0)
            {
                clflags += (int)ComputeMemoryFlags.ReadWrite;
            }
            cpuBuffer = buffer;
            if ((flags & ON_DEVICE) > 0)
            {
                gpuBuffer = new ComputeBuffer <T>(ocl.Context, (ComputeMemoryFlags)clflags, cpuBuffer);
                CopyToDevice();
            }
        }