{"id":13809682,"url":"https://github.com/cogciprocate/ocl","last_synced_at":"2025-05-14T22:07:57.273Z","repository":{"id":44784435,"uuid":"45285288","full_name":"cogciprocate/ocl","owner":"cogciprocate","description":"OpenCL for Rust","archived":false,"fork":false,"pushed_at":"2024-04-05T21:11:41.000Z","size":35707,"stargazers_count":757,"open_issues_count":35,"forks_count":75,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-05-14T03:20:49.101Z","etag":null,"topics":["amd","async","gpgpu","intel","nvidia","ocl","opencl-api","opencl-library","rust","scientific-computing"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cogciprocate.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-31T02:03:56.000Z","updated_at":"2025-05-05T04:12:54.000Z","dependencies_parsed_at":"2023-02-11T21:00:46.418Z","dependency_job_id":"c790b322-cd94-47c0-a06c-0f8ee66d7261","html_url":"https://github.com/cogciprocate/ocl","commit_stats":{"total_commits":1349,"total_committers":37,"mean_commits":36.45945945945946,"dds":"0.27575982209043737","last_synced_commit":"50ac4316c7be8af353ee5afca1ba10c8e42c788a"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogciprocate%2Focl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogciprocate%2Focl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogciprocate%2Focl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cogciprocate%2Focl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cogciprocate","download_url":"https://codeload.github.com/cogciprocate/ocl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254103849,"owners_count":22015356,"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":["amd","async","gpgpu","intel","nvidia","ocl","opencl-api","opencl-library","rust","scientific-computing"],"created_at":"2024-08-04T02:00:34.370Z","updated_at":"2025-05-14T22:07:52.253Z","avatar_url":"https://github.com/cogciprocate.png","language":"Rust","funding_links":[],"categories":["Frameworks","GPU Programming","Rust"],"sub_categories":[],"readme":"ocl\n===\n\n#### [Documentation](https://docs.rs/ocl) | [Change Log](https://github.com/cogciprocate/ocl/blob/master/RELEASES.md)\n\n[![](https://img.shields.io/crates/v/ocl.svg)](https://crates.io/crates/ocl) [![](https://docs.rs/ocl/badge.svg)](https://docs.rs/ocl)\n[![Supported platforms](https://img.shields.io/badge/platform-windows%20%7C%20macos%20%7C%20linux%20%7C%20bsd-orange.svg)](https://en.wikipedia.org/wiki/Cross-platform)\n[![Linux Build Status](https://travis-ci.org/cogciprocate/ocl.svg?branch=master)](https://travis-ci.org/cogciprocate/ocl)\n\nPure OpenCL\u0026trade; bindings and interfaces for\n[Rust](https://www.rust-lang.org/).\n\n## Goals\n\nTo provide:\n- A simple and intuitive interface to OpenCL devices\n- The full functionality and power of the OpenCL API\n- An absolute minimum of boilerplate\n- Zero or virtually zero performance overhead\n- Thread-safe and automatic management of API pointers and resources\n\n## Usage\n\nEnsure that an OpenCL library is installed for your platform and that `clinfo`\nor some other diagnostic command will run. Add the following to your project's\n`Cargo.toml`:\n\n```toml\n[dependencies]\nocl = \"0.19\"\n```\n\nAnd add the following to your crate root (lib.rs or main.rs):\n```rust\nextern crate ocl;\n```\n\n## Example\n\nFrom [`examples/trivial.rs`]:\n```rust\nextern crate ocl;\nuse ocl::ProQue;\n\nfn trivial() -\u003e ocl::Result\u003c()\u003e {\n    let src = r#\"\n        __kernel void add(__global float* buffer, float scalar) {\n            buffer[get_global_id(0)] += scalar;\n        }\n    \"#;\n\n    let pro_que = ProQue::builder()\n        .src(src)\n        .dims(1 \u003c\u003c 20)\n        .build()?;\n\n    let buffer = pro_que.create_buffer::\u003cf32\u003e()?;\n\n    let kernel = pro_que.kernel_builder(\"add\")\n        .arg(\u0026buffer)\n        .arg(10.0f32)\n        .build()?;\n\n    unsafe { kernel.enq()?; }\n\n    let mut vec = vec![0.0f32; buffer.len()];\n    buffer.read(\u0026mut vec).enq()?;\n\n    println!(\"The value at index [{}] is now '{}'!\", 200007, vec[200007]);\n    Ok(())\n}\n```\n\nSee the the remainder of [`examples/trivial.rs`] for more information about\nhow this library leverages Rust's zero-cost abstractions to provide the full\npower and performance of the C API in a simple package.\n\n## Recent Changes\n\n* 0.18.0: Creating a\n  [`Kernel`](https://docs.rs/ocl/0.18.0/ocl/struct.Kernel.html) now requires\n  the use of the new\n  [`KernelBuilder`](https://docs.rs/ocl/0.18.0/ocl/struct.KernelBuilder.html).\n  See the [change\n  log](https://github.com/cogciprocate/ocl/blob/master/RELEASES.md) for more\n  information.\n\n##### Introduction to OpenCL\n\nFor a quick but thorough primer on the basics of OpenCL, please see [Matthew\nScarpino's excellent article, 'A Gentle Introduction to OpenCL' at\ndrdobbs.com](http://www.drdobbs.com/parallel/a-gentle-introduction-to-opencl/231002854)\n(his\n[book](https://www.amazon.com/OpenCL-Action-Accelerate-Graphics-Computations/dp/1617290173/ref=sr_1_2?ie=UTF8\u0026qid=1500745843\u0026sr=8-2\u0026keywords=opencl)\nis great too).\n\n##### Diving Deeper\n\nAlready familiar with the standard OpenCL core API? See the [`ocl-core`] crate\nfor access to the complete feature set in the conventional API style with\nRust's safety and convenience.\n\n##### Version Support\n\nOpenCL versions 1.1 and above are supported. OpenCL version 1.0 is **not**\nsupported due to its inherent thread unsafety.\n\n##### Vulkan\u0026trade; and the Future\n\nThe OpenCL API already posesses all of the new attributes of the Vulkan API\nsuch as low-overhead, high performance, and unfettered hardware access. For all\npractical purposes, Vulkan is simply a graphics-focused superset of OpenCL's\nfeatures (sorta kinda). OpenCL 2.1+ and Vulkan kernels/shaders now both\ncompile into SPIR-V making the device side of things the same. I wouldn't be\nsuprised if most driver vendors implement the two host APIs identically.\n\nIn the future it's possible the two may completely merge (or that Vulkan will\nabsorb OpenCL). Whatever happens, nothing will change as far as the front end\nof this library is concerned. This library will maintain its focus on the\ncompute side of things.\n\n##### License\n\nLicensed under either of:\n\n * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)\n * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)\n\nat your option.\n\n##### Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any\nadditional terms or conditions.\n\n\u003cbr/\u003e*“OpenCL and the OpenCL logo are trademarks of Apple Inc. used by\npermission by Khronos.”* \u003cbr/\u003e*“Vulkan and the Vulkan logo are trademarks of\nthe Khronos Group Inc.”*\n\n[OpenCL libraries for your CPU]: https://software.intel.com/en-us/intel-opencl/download\n[AMD]: https://software.intel.com/en-us/intel-opencl/download\n[`ocl-core`]: https://github.com/cogciprocate/ocl/tree/master/ocl-core\n[issue]: https://github.com/cogciprocate/ocl_rust/issues\n[provide feedback]: https://github.com/cogciprocate/ocl_rust/issues\n[`examples`]: https://github.com/cogciprocate/ocl/tree/master/ocl/examples\n[`examples/trivial.rs`]: https://github.com/cogciprocate/ocl/blob/master/ocl/examples/trivial.rs\n[voodoo]: https://github.com/cogciprocate/voodoo\n[intel-win64]: https://software.intel.com/en-us/articles/opencl-drivers#win64\n[intel-linux64-redhat-suse]: https://software.intel.com/en-us/articles/opencl-drivers#lin64\n[intel-linux64-ubuntu]: https://software.intel.com/en-us/articles/opencl-drivers#ubuntu64\n[amd-app-sdk]: http://developer.amd.com/tools-and-sdks/opencl-zone/amd-accelerated-parallel-processing-app-sdk/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogciprocate%2Focl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcogciprocate%2Focl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcogciprocate%2Focl/lists"}