Skip to main content

Open CL Python bindings

Project description

This is yet another set of Python bindings for OpenCL.

Features:

  • Python 2 and Python 3 compatibility.

  • Supports OpenCL 1.1

  • Discoverable properties and methods:

    No more ctx.get_info(pyopencl.context_info.DEVICES) just do ctx.devices

  • Tight integration with ctypes:

    import opencl as cl
    from ctypes import c_float
    ctx =  cl.Context()
    a = cl.empty(ctx, [2, 3], ctype=c_float)
  • Call kernels like a python function with defaults and keyword arguments:

    import opencl as cl
    from ctypes import c_float, c_int
    
    source = '__kernel void foo(__global float*a, int b, float c) ...'
    ...
    # Create a program and context
    
    foo = program.foo
    foo.argnames = 'a', 'b', 'c'
    foo.argtypes = cl.global_memory(c_float, ndim=2), c_int, c_float
    # Equivalent to def foo(a, b=1, c=2.0):
    foo.__defaults__ = 1, 2.0
    
    event = foo(queue, a)
  • Memory objects support indexing and slicing:

    mem2 = memobj[:, 1, :-1]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

opencl-for-python-0.5.0-.tar.gz (496.9 kB view details)

Uploaded Source

File details

Details for the file opencl-for-python-0.5.0-.tar.gz.

File metadata

File hashes

Hashes for opencl-for-python-0.5.0-.tar.gz
Algorithm Hash digest
SHA256 5232b0df3c8c0382468eb50413db1b6db66d39a64b930f80145de9e4a5b5f78b
MD5 7998ee5d32eec2d662e337e7419aefce
BLAKE2b-256 6fa23493690e7f034d1a3c24618ac3125013225d4feb92f87edb141896b836cd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page