Example #1
0
def get_context(backend):
    if backend == 'cuda':
        from compyle.cuda import set_context
        set_context()
        from pycuda.autoinit import context
        return context
    elif backend == 'opencl':
        from compyle.opencl import get_context
        return get_context()
    else:
        raise RuntimeError('Unsupported GPU backend %s' % backend)
Example #2
0
 def setUpClass(cls):
     print("SetupClass")
     pytest.importorskip("pycuda")
     from compyle.cuda import set_context
     set_context()