def _setup_cl(self, context=None): """ OpenCL setup. """ if context is None: self.context = context = clu.create_some_context() else: self.context = context self.queue = queue = cl.CommandQueue(context) # allocate device memory self._allocate_memory() # create the program self._create_program()
def setUp(self): self.np = np = 4 x = numpy.array([0, 1, 1, 0]) y = numpy.array([0, 0, 1, 1]) h = numpy.ones_like(x) * 0.3 pa = get_particle_array(name="test", cl_precision="single", x=x, y=y, h=h) self.scale_fac = 2.0 self.particles = particles = CLParticles( [pa,], OpenCLNeighborLocatorType.LinkedListSPHNeighborLocator, DomainManagerType.LinkedListManager) self.ctx = create_some_context()