OpenCL-Wrapper  by ProjectPhysX

Lightweight OpenCL wrapper for simplified C++ development

Created 3 years ago
442 stars

Top 67.7% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a C++ wrapper for OpenCL, aiming to simplify development by abstracting away boilerplate code and common complexities. It targets C++ developers who need to leverage GPU acceleration via OpenCL but find the native C++ bindings cumbersome. The wrapper offers a more streamlined API for device selection, memory management, and kernel execution, potentially reducing development time and improving code readability.

How It Works

The wrapper simplifies OpenCL by providing high-level C++ objects for Device, Memory, and Kernel. Device handles platform and device selection, including automatic compilation of embedded OpenCL C code and device-specific workarounds. Memory unifies host and device memory management, simplifying data transfers and tracking memory usage. Kernel abstracts kernel parameter linking and execution, allowing for chained calls and automatic error checking against parameter mismatches. OpenCL C code is embedded directly within C++ source files using a stringification macro, preserving syntax highlighting and simplifying the build process.

Quick Start & Requirements

  • Install: Compile with make.sh (Linux/macOS/Android) or open OpenCL-Wrapper.sln in Visual Studio Community (Windows).
  • Prerequisites: C++17 compiler (g++ >= 8), GPU drivers with OpenCL runtime installed. Detailed OS-specific driver installation instructions are provided for Windows, Linux, and Android.
  • Setup: Requires installing GPU drivers and OpenCL runtimes, which can be time-consuming depending on the OS and hardware.
  • Links: Official Documentation

Highlighted Details

  • Simplifies device selection (e.g., fastest device, most memory).
  • Unified host/device memory management with automatic zero-copy for CPUs/iGPUs.
  • Embedded OpenCL C code with syntax highlighting and simplified stringification.
  • Includes numerous device-specific workarounds and patches for cross-compatibility.
  • Example usage demonstrates a significant reduction in code lines compared to native OpenCL C++ bindings.

Maintenance & Community

The project is maintained by ProjectPhysX. No specific community channels (Discord, Slack) or roadmap are explicitly mentioned in the README.

Licensing & Compatibility

The project appears to be licensed under the MIT License, which is permissive for commercial use and closed-source linking.

Limitations & Caveats

The README notes that unbalanced round brackets () and arbitrarily long string literals within the embedded OpenCL C code require specific handling using the )+R( syntax. Preprocessor replacement macros within the embedded code are not supported and must be passed as arguments to the Device constructor.

Health Check
Last Commit

2 weeks ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
7 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.