#http://documen.tician.de/pyopencl/

import pyopencl as cl
import numpy as np
import struct
import timing
timings = timing.Timing()

#ctx = cl.create_some_context()
mf = cl.mem_flags

class Bitonic:
    def __init__(self, max_elements, cta_size, dtype):

        plat = cl.get_platforms()[0]
        device = plat.get_devices()[0]
        self.ctx = cl.Context(devices=[device])
        self.queue = cl.CommandQueue(self.ctx, device)



        self.loadProgram()
        self.uintsz = dtype.itemsize
        self.d_tempKeys = cl.Buffer(self.ctx, mf.READ_WRITE, size=self.uintsz * max_elements)
        self.d_tempValues = cl.Buffer(self.ctx, mf.READ_WRITE, size=self.uintsz * max_elements)