Skip to content

clEsperanto/CLIc

CLIc

Build & test CI-Tests Codecov License GitHub release (latest by date including pre-releases) CppStd OpenCL Website GitHub issues GitHub stars GitHub forks

CLIc is a prototype backend library for CLesperanto - a multi-language framework for GPU-accelerated image processing. It uses the OpenCL kernels from CLIJ

It is a preliminary projet and mainly focussed on running a kernel using the OpenCL C++ API from Khronos.

Usage example

#include "clesperanto.h"  // CLIc include

int main( int argc, char** argv)
{
    // Initialisation of clEsperanto with default device
    cle::BackendManager::getInstance().setBackend();
    auto device = cle::BackendManager::getInstance().getBackend().getDevice("", "all");

    // host vector to hold input and output
    std::vector<float> input (width * height * depth); 
    std::vector<float> output (input.size()); 

    /*
     * ... fill input with data to process  
     */

    // push data from host to device
    auto gpu_src = cle::Push<float>(input.data(), width, height, depth, device);
    // apply filter with parameters
    auto gpu_dst = cle::tier1::AddImageAndScalar(device, gpu_src, nullptr, 10);
    // pull output from device to host
    cle::Pull<float>(gpu_dst, output.data()); 

    return EXIT_SUCCESS;
}

See more complete example on usage by looking at the kernels tests.

Installation

Requirements

CLIc rely on OpenCL language for parallelisation and CMake for configuration and build.
Follow the compilation guideline for helps on building the library.

Quick install

Clone the repository and update the submodules

git clone git@github.com:clEsperanto/CLIc.git
cd CLIc

Create a build folder and configure cmake to generate the adapted makefile. Then compile the library and install it at specified location on your system.

cmake -S . -B ./build -D CMAKE_INSTALL_PREFIX=/path/to/installation/folder
cmake --build ./build --parallel 10 --target install

You can modify installation location using -D CMAKE_INSTALL_PREFIX=/path/to/installation/folder. If not specify, the default location is /usr/local.

CLIc can be uninstall by running the following command

cmake --build ./build --target uninstall

Kernels

CLIc filters rely on the clEsperanto branch of CLIj OpenCL kernels. They are managed as a submodule of this repository.

Contributing

Contributions are very welcome. Before spending effort on coding and filing a pull-request, please get in touch with us, file an issue, and let's discuss your potential contribution. More information on how to add new kernels to the library can be found in the documentation.

Feedback welcome!

clEsperanto is developed in the open because we believe in the open source community. Feel free to drop feedback as github issue or via image.sc.
And if you liked our work, star the repository, share it with your friends, and use it to make cool stuff!

Acknowledgements

We acknowledge support by the Deutsche Forschungsgemeinschaft under Germany’s Excellence Strategy (EXC2068) Cluster of Excellence Physics of Life of TU Dresden. This project has been made possible in part by grant number 2021-237734 (GPU-accelerating Fiji and friends using distributed CLIJ, NEUBIAS-style, EOSS4) from the Chan Zuckerberg Initiative DAF, an advised fund of the Silicon Valley Community Foundation.