Example #1
0
 def _execute_and_check(self):
     prg = cl.Program(cfg.OPENCL.ctx,
                      gpu_util.get_source([self.kernel_fn])).build()
     mem, ar = self._create_mem_objs(self.n)
     prg.float_test(cfg.OPENCL.queue, (self.n, ), None, mem)
     cl.enqueue_copy(cfg.OPENCL.queue, ar, mem)
     res = ar == np.array([0, 1], dtype=cfg.PRECISION.np_float)
     self.assertTrue(res.all())
Example #2
0
 def setUp(self):
     syris.init(device_index=0)
     self.prg = g_util.get_program(
         g_util.get_source(["polyobject.cl",
                            "heapsort.cl"],
                           precision_sensitive=True))
     self.num = 10
     self.data = np.array([1, 8, np.nan, -1, np.nan, 8, 680, 74, 2, 0]).\
         astype(cfg.PRECISION.np_float)
     self.mem = cl.Buffer(cfg.OPENCL.ctx, cl.mem_flags.READ_WRITE |
                          cl.mem_flags.COPY_HOST_PTR, hostbuf=self.data)
Example #3
0
 def setUp(self):
     syris.init(device_index=0)
     self.num_0 = np.array([17 - 38j], dtype=cfg.PRECISION.np_cplx)
     self.num_1 = np.array([-135 + 563j], dtype=cfg.PRECISION.np_cplx)
     self.mem_0 = cl.Buffer(cfg.OPENCL.ctx, cl.mem_flags.READ_WRITE |
                            cl.mem_flags.COPY_HOST_PTR, hostbuf=self.num_0)
     self.mem_1 = cl.Buffer(cfg.OPENCL.ctx, cl.mem_flags.READ_WRITE |
                            cl.mem_flags.COPY_HOST_PTR, hostbuf=self.num_1)
     self.mem_out = cl.Buffer(cfg.OPENCL.ctx, cl.mem_flags.READ_WRITE, cfg.PRECISION.cl_cplx)
     self.host_array = np.empty(1, cfg.PRECISION.np_cplx)
     src = gpu_util.get_source(["vcomplex.cl"])
     self.prg = cl.Program(cfg.OPENCL.ctx, src).build()
Example #4
0
 def setUp(self):
     default_syris_init()
     self.prg = g_util.get_program(
         g_util.get_source(["polyobject.cl", "heapsort.cl"],
                           precision_sensitive=True))
     self.num = 10
     self.data = np.array([1, 8, np.nan, -1, np.nan, 8, 680, 74, 2,
                           0]).astype(cfg.PRECISION.np_float)
     self.mem = cl.Buffer(cfg.OPENCL.ctx,
                          cl.mem_flags.READ_WRITE
                          | cl.mem_flags.COPY_HOST_PTR,
                          hostbuf=self.data)
Example #5
0
 def setUp(self):
     default_syris_init()
     self.num_0 = np.array([17 - 38j], dtype=cfg.PRECISION.np_cplx)
     self.num_1 = np.array([-135 + 563j], dtype=cfg.PRECISION.np_cplx)
     self.mem_0 = cl.Buffer(cfg.OPENCL.ctx,
                            cl.mem_flags.READ_WRITE
                            | cl.mem_flags.COPY_HOST_PTR,
                            hostbuf=self.num_0)
     self.mem_1 = cl.Buffer(cfg.OPENCL.ctx,
                            cl.mem_flags.READ_WRITE
                            | cl.mem_flags.COPY_HOST_PTR,
                            hostbuf=self.num_1)
     self.mem_out = cl.Buffer(cfg.OPENCL.ctx, cl.mem_flags.READ_WRITE,
                              cfg.PRECISION.cl_cplx)
     self.host_array = np.empty(1, cfg.PRECISION.np_cplx)
     src = gpu_util.get_source(["vcomplex.cl"])
     self.prg = cl.Program(cfg.OPENCL.ctx, src).build()