custos
A minimal OpenCL, CUDA and host CPU array manipulation engine / framework written in Rust. This crate provides the tools for executing custom array operations with the CPU, as well as with CUDA and OpenCL devices. This guide demonstrates how operations can be implemented for the compute devices: implement_operations.md or to see it at a larger scale, look here: custos-math
Installation
Add "custos" as a dependency:
[]
= "0.4.3"
# to disable the default features (cuda, opencl) and use an own set of features:
#custos = {version = "0.4.3", default-features=false, features=["opencl"]}
Available features:
- "opencl" ... adds OpenCL features, where the CLDevice (feature) is the most important one.
- "cuda" ... adds CUDA features. (CudaDevice)
- "realloc" ... disables caching for CPU.
- using no features at all ... CPU with BLAS
Examples
These examples show how to use the implemented operations. custos only implements three buffer operations. These would be the write, read, and clear operations. On the other hand, custos-math implements a lot more operations, including Matrix operations for a custom Matrix struct. If you want to implement your own operations for all compute devices, look here: implement_operations.md
Using the host CPU as the compute device:
use ;
Using an OpenCL device as the compute device:
use ;
Using a CUDA device as the compute device:
use ;
A lot more examples can be found in the 'tests' and 'examples' folder.