from __future__ import division import numpy as np import pyopencl as cl import pyopencl.array as cl_array import pyopencl.clrandom as cl_random import loopy as lp from pyopencl.tools import pytest_generate_tests_for_pyopencl \ as pytest_generate_tests def test_owed_barriers(ctx_factory): dtype = np.float32 ctx = ctx_factory() order = "C" queue = cl.CommandQueue(ctx, properties=cl.command_queue_properties.PROFILING_ENABLE) knl = lp.make_kernel(ctx.devices[0], "{[i]: 0<=i<100}", [ "[i:l.0] z[i] = a[i]" ], [ lp.ArrayArg("a", dtype, shape=(100,)), ]) kernel_gen = lp.generate_loop_schedules(knl) kernel_gen = lp.check_kernels(kernel_gen) for gen_knl in kernel_gen: compiled = lp.CompiledKernel(ctx, gen_knl) print compiled.code if __name__ == "__main__": import sys if len(sys.argv) > 1: exec(sys.argv[1]) else: from py.test.cmdline import main main([__file__])