All Projects → Polytonic → Chlorine

Polytonic / Chlorine

Dead Simple OpenCL

Programming Languages

cplusplus
227 projects

Projects that are alternatives of or similar to Chlorine

CLU
The OpenCL Utility library
Stars: ✭ 18 (-95.7%)
Mutual labels:  opencl, gpgpu
slibs
Single file libraries for C/C++
Stars: ✭ 80 (-80.91%)
Mutual labels:  opencl, gpgpu
john-packages
Community packages of John the Ripper (a Docker image, a Flatpak, a Windows PortableApp, and Ubuntu SNAP packages)
Stars: ✭ 31 (-92.6%)
Mutual labels:  opencl, gpgpu
learn-gpgpu
Algorithms implemented in CUDA + resources about GPGPU
Stars: ✭ 37 (-91.17%)
Mutual labels:  opencl, gpgpu
Hipsycl
Implementation of SYCL for CPUs, AMD GPUs, NVIDIA GPUs
Stars: ✭ 377 (-10.02%)
Mutual labels:  gpgpu, opencl
Amplifier.NET
Amplifier allows .NET developers to easily run complex applications with intensive mathematical computation on Intel CPU/GPU, NVIDIA, AMD without writing any additional C kernel code. Write your function in .NET and Amplifier will take care of running it on your favorite hardware.
Stars: ✭ 142 (-66.11%)
Mutual labels:  opencl, gpgpu
RayTracing
Realtime GPU Path tracer based on OpenCL and OpenGL
Stars: ✭ 120 (-71.36%)
Mutual labels:  opencl, gpgpu
Computecpp Sdk
Collection of samples and utilities for using ComputeCpp, Codeplay's SYCL implementation
Stars: ✭ 239 (-42.96%)
Mutual labels:  gpgpu, opencl
Aparapi
The New Official Aparapi: a framework for executing native Java and Scala code on the GPU.
Stars: ✭ 352 (-15.99%)
Mutual labels:  gpgpu, opencl
rindow-neuralnetworks
Neural networks library for machine learning on PHP
Stars: ✭ 37 (-91.17%)
Mutual labels:  opencl, gpgpu
Arrayfire
ArrayFire: a general purpose GPU library.
Stars: ✭ 3,693 (+781.38%)
Mutual labels:  gpgpu, opencl
Amgcl
C++ library for solving large sparse linear systems with algebraic multigrid method
Stars: ✭ 390 (-6.92%)
Mutual labels:  gpgpu, opencl
CUDAfy.NET
CUDAfy .NET allows easy development of high performance GPGPU applications completely from the .NET. It's developed in C#.
Stars: ✭ 56 (-86.63%)
Mutual labels:  opencl, gpgpu
rectdetect
Realtime rectangle detector with GPGPU
Stars: ✭ 51 (-87.83%)
Mutual labels:  opencl, gpgpu
gpuowl
GPU Mersenne primality test.
Stars: ✭ 77 (-81.62%)
Mutual labels:  opencl, gpgpu
sycl-bench
SYCL Benchmark Suite
Stars: ✭ 30 (-92.84%)
Mutual labels:  opencl, gpgpu
Opencl Intercept Layer
Intercept Layer for Debugging and Analyzing OpenCL Applications
Stars: ✭ 189 (-54.89%)
Mutual labels:  gpgpu, opencl
Occa
JIT Compilation for Multiple Architectures: C++, OpenMP, CUDA, HIP, OpenCL, Metal
Stars: ✭ 230 (-45.11%)
Mutual labels:  gpgpu, opencl
ufo-core
GLib-based framework for GPU-based data processing
Stars: ✭ 20 (-95.23%)
Mutual labels:  opencl, gpgpu
Arrayfire Python
Python bindings for ArrayFire: A general purpose GPU library.
Stars: ✭ 358 (-14.56%)
Mutual labels:  gpgpu, opencl

Chlorine

Build Status Coverage Status OpenCL Version

Summary

Chlorine is the easiest way to interact with OpenCL compatible devices. It is a header-only C++11 library that allows you to write cross-platform code that runs on GPUs without ever touching the complicated OpenCL API, leaving you free to write code that matters: kernels that process data.

Getting Started

Chlorine is composed of just two headers: chlorine.hpp, and its dependency, the OpenCL C++ Bindings. To integrate Chlorine into your own project, install OpenCL; then add chlorine/include to your include paths and link with OpenCL. Chlorine also requires a compiler with C++11 support. An example of how to use Chlorine is below, or read a more detailed walkthrough if you prefer.

main.cpp

std::vector<float> data(10, 3.1415f);        // Create Some Sample Data
ch::Worker worker("kernel.cl");              // Initialize a Chlorine Worker
auto event = worker.call("square", data);    // Call Kernel Square Function
std::cout << "Data: " << data[0] << "\n";    // Prints 9.8696; Like Magic!

// Print Some Profiling Data
std::cout << "Elapsed Time: " << ch::elapsed(event) << "ns\n";

kernel.cl

__kernel void square(__global float * data) {
    unsigned int i = get_global_id(0);
    data[i] = data[i] * data[i];
}

If you're looking to compile the examples or just want to play around in the sandbox project, follow these steps! Chlorine uses the cmake build system, which is used to generate platform-specific makefiles or project files.

git clone https://github.com/Polytonic/Chlorine
cd Chlorine
cd build

Now generate a project file or makefile for your platform. If you want to use a particular IDE, make sure it is installed; don't forget to set the Start-Up Project in Visual Studio or the Target in Xcode.

# UNIX Makefile
cmake ..

# Mac OSX
cmake -G "Xcode" ..

# Microsoft Windows
cmake -G "Visual Studio 14" ..
cmake -G "Visual Studio 14 Win64" ..
...

To run tests, you will need to pull down the test framework, then call the right test script.

git submodule update --init
make check # UNIX
make_check # Windows

For a performance and time-investment analysis, check out some basic benchmarking data!

Documentation

Chlorine focuses on making OpenCL frictionless; you should work with your data, not wrangle with an API. Chlorine offers a non-invasive approach to integrating parallel programming into your code through a magic method ::call(...) which accepts any number of arguments (of any type). Arguments to ::call(...) are automagically mapped in the order they are passed, to parameters of the indicated kernel function, and data is transferred back when the kernel function finishes. This is achieved through the use of variadic templates to support the following types:

The class declaration is useful as a quick API reference, and all method implementations in Chlorine should have annotations. If you want a more sophisticated API reference, you can use Doxygen to generate the HTML documentation.

For convenience, Chlorine also provides a simple version of clinfo, allowing you to print basic information about OpenCL devices on your computer. You can build it using cmake.

Note that kernels may not automatically perform type promotion. When working with floating point numbers, be sure to use the appropriate literal. For instance, 3.14 vs. 3.14f.

License

The MIT License (MIT)

Copyright (c) 2015 Kevin Fung

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].