{"id":13418459,"url":"https://github.com/Polytonic/Chlorine","last_synced_at":"2025-03-15T03:31:17.086Z","repository":{"id":10631857,"uuid":"12855931","full_name":"Polytonic/Chlorine","owner":"Polytonic","description":"Dead Simple OpenCL","archived":false,"fork":false,"pushed_at":"2016-04-10T01:28:31.000Z","size":983,"stargazers_count":429,"open_issues_count":5,"forks_count":24,"subscribers_count":15,"default_branch":"master","last_synced_at":"2024-08-02T13:30:14.068Z","etag":null,"topics":["compute","cplusplus","gpgpu","opencl"],"latest_commit_sha":null,"homepage":"http://polytonic.github.io/Chlorine/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Polytonic.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-16T01:34:37.000Z","updated_at":"2024-06-19T05:08:28.000Z","dependencies_parsed_at":"2022-09-01T22:20:12.773Z","dependency_job_id":null,"html_url":"https://github.com/Polytonic/Chlorine","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polytonic%2FChlorine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polytonic%2FChlorine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polytonic%2FChlorine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Polytonic%2FChlorine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Polytonic","download_url":"https://codeload.github.com/Polytonic/Chlorine/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243681024,"owners_count":20330152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["compute","cplusplus","gpgpu","opencl"],"created_at":"2024-07-30T22:01:02.587Z","updated_at":"2025-03-15T03:31:17.081Z","avatar_url":"https://github.com/Polytonic.png","language":"C++","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"readme":"# [Chlorine](http://polytonic.github.io/Chlorine/)\n[![Build Status](http://img.shields.io/travis/Polytonic/Chlorine/master.svg?style=flat-square)](https://travis-ci.org/Polytonic/Chlorine)\n[![Coverage Status](http://img.shields.io/coveralls/Polytonic/Chlorine.svg?style=flat-square)](https://coveralls.io/r/Polytonic/Chlorine)\n[![OpenCL Version](http://img.shields.io/badge/OpenCL-1.2%2B-brightgreen.svg?style=flat-square)](https://www.khronos.org/opencl/)\n\n## Summary\nChlorine is the easiest way to interact with [OpenCL](https://www.khronos.org/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.\n\n## Getting Started\nChlorine is composed of just two headers: [chlorine.hpp](https://github.com/Polytonic/Chlorine/blob/master/chlorine/include/chlorine.hpp), and its dependency, the [OpenCL C++ Bindings](https://www.khronos.org/registry/cl/). To integrate Chlorine into your own project, [install OpenCL](https://github.com/Polytonic/Chlorine/blob/master/build/readme.md); 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](https://github.com/Polytonic/Chlorine/tree/master/examples/swap) if you prefer.\n\n**main.cpp**\n```c++\nstd::vector\u003cfloat\u003e data(10, 3.1415f);        // Create Some Sample Data\nch::Worker worker(\"kernel.cl\");              // Initialize a Chlorine Worker\nauto event = worker.call(\"square\", data);    // Call Kernel Square Function\nstd::cout \u003c\u003c \"Data: \" \u003c\u003c data[0] \u003c\u003c \"\\n\";    // Prints 9.8696; Like Magic!\n\n// Print Some Profiling Data\nstd::cout \u003c\u003c \"Elapsed Time: \" \u003c\u003c ch::elapsed(event) \u003c\u003c \"ns\\n\";\n```\n**kernel.cl**\n```c\n__kernel void square(__global float * data) {\n    unsigned int i = get_global_id(0);\n    data[i] = data[i] * data[i];\n}\n```\n\nIf you're looking to compile the examples or just want to play around in the sandbox project, follow these steps! Chlorine uses the [cmake](http://www.cmake.org/) build system, which is used to generate platform-specific makefiles or project files.\n\n```bash\ngit clone https://github.com/Polytonic/Chlorine\ncd Chlorine\ncd build\n```\n\nNow 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.\n\n```bash\n# UNIX Makefile\ncmake ..\n\n# Mac OSX\ncmake -G \"Xcode\" ..\n\n# Microsoft Windows\ncmake -G \"Visual Studio 14\" ..\ncmake -G \"Visual Studio 14 Win64\" ..\n...\n```\n\nTo run tests, you will need to pull down the test framework, then call the right test script.\n\n```bash\ngit submodule update --init\nmake check # UNIX\nmake_check # Windows\n```\n\nFor a performance and time-investment analysis, check out some basic [benchmarking data](https://www.tinycranes.com/blog/2015/05/visualizing-the-mandelbrot-set#mandelbrot-chart)!\n\n## Documentation\nChlorine 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](https://en.wikipedia.org/wiki/Variadic_template) to support the following types:\n\n - [Arithmetic Scalar Types](http://www.cplusplus.com/reference/type_traits/is_arithmetic/)\n - [OpenCL Vector Types](https://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/vectorDataTypes.html)\n - [C-Style Arrays](http://www.cplusplus.com/doc/tutorial/arrays/)\n - [STL Arrays](http://www.cplusplus.com/reference/array/array/)\n - [STL Valarrays](http://www.cplusplus.com/reference/valarray/)\n - [STL Vectors](http://www.cplusplus.com/reference/vector/vector/)\n\nThe 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](http://www.doxygen.org) to generate the HTML documentation.\n\nFor 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`.\n\nNote 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`.\n\n## License\n\u003eThe MIT License (MIT)\n\n\u003eCopyright (c) 2015 Kevin Fung\n\n\u003ePermission 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:\n\n\u003eThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\n\u003eTHE 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPolytonic%2FChlorine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FPolytonic%2FChlorine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FPolytonic%2FChlorine/lists"}