--- id: pyopencl version: "2026.1.2" license: MIT license_treatment: permissive maintenance: active --- # pyopencl — Python wrapper for OpenCL License: permissive · Maintenance: active · Downloads: 175.2K/mo ## What it is and what it does PyOpenCL is a Python wrapper around the OpenCL API that lets you write code to run on GPUs and other massively parallel compute devices. It follows the design philosophy of its sister project PyCUDA, offering automatic resource cleanup via RAII patterns, complete access to OpenCL's API surface, automatic error translation to Python exceptions, and a C++-based implementation for performance. The package supports Apple, AMD, and Nvidia OpenCL implementations and is actively maintained with broad platform coverage. Typical use involves creating an OpenCL context tied to available compute devices, building or loading kernels written in OpenCL C, and managing data transfer between host and device memory. The runtime dependencies (numpy, pytools, platformdirs, importlib-resources, typing_extensions) support array handling, platform detection, and utility functions. Installation via conda or pre-built wheels is recommended to avoid building from source, which requires a C++17 compiler and OpenCL headers. Use it for: - Accelerate numerical computations (linear algebra, FFTs, simulations) by offloading to GPU - Implement custom compute kernels for image processing or signal processing on parallel hardware - Prototype heterogeneous computing workflows that mix CPU and GPU workloads in a single Python script - Deploy machine learning inference on embedded or mobile GPUs via OpenCL - Run scientific simulations (physics, chemistry) that benefit from massively parallel execution ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. PyOpenCL provides Python bindings to OpenCL, enabling you to write GPU and massively parallel compute code that runs on diverse hardware accelerators through a Pythonic interface. Yes, if you need GPU acceleration and want to target diverse hardware via OpenCL. The package is production-stable, actively maintained, permissively licensed, and widely used. Install friction is moderate due to compiled dependencies and OpenCL driver requirements, but pre-built wheels and conda packages ease setup. No known security vulnerabilities. Not necessary if you are locked into a single vendor (CUDA-only or Metal-only) or do not need GPU compute. ## Install pip install pyopencl uv add pyopencl poetry add pyopencl ## Installing pyopencl Before you install: Medium install friction due to compiled C++ components and OpenCL driver dependencies. The package is actively maintained with recent commits and offers pre-built wheels for common platforms (Linux, macOS, Windows across multiple architectures), though building from source requires a C++17-compatible compiler and an OpenCL implementation. License in practice: MIT license permits commercial, academic, and private use with minimal restrictions, making it suitable for proprietary and open-source projects alike. Quickstart: pip install pyopencl import pyopencl as cl import numpy as np platforms = cl.get_platforms() devices = platforms[0].get_devices() ctx = cl.Context(devices) queue = cl.CommandQueue(ctx) Requires an OpenCL implementation (vendor drivers from Apple, AMD, Nvidia, or open-source alternatives) installed on your system; pre-built wheels simplify setup but do not include OpenCL drivers themselves. Verify before relying: - Whether pre-built wheels bundle OpenCL runtime or only headers/bindings - Performance characteristics on specific hardware (GPUs, accelerators) relative to alternatives - Maturity of support for recent OpenCL standards beyond 1.2 ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 175.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags GPU computing from Python, OpenCL Python bindings, parallel compute acceleration, GPGPU programming, heterogeneous computing Python, massively parallel devices, OpenCL wrapper, gpu-computing, parallel-processing, heterogeneous-compute [View on SkillFed](https://skillfed.io/packages/pyopencl) · [View on PyPI](https://pypi.org/project/pyopencl/)