Toying around with / getting to know arrayfire-rust. Don't expect anything crazy here. 🙌
-
conway.rs: GPU-enabled Conway's Game of Life through kernel convolutions, taken from the
arrayfire-rust
examples and spiced up for readability and understandability. Uses ArrayFire's graphics module to provide a window. See The Game of Life vs. Convolutions for a post on it.cargo run cargo run --bin conway
-
trivial.rs: The simple example from the
arrayfire-rust
README:cargo run --bin trivial
-
white_noise.rs: Just white noise in a window.
cargo run --bin white-noise
-
half_precision.rs: FP16 example using half::f16. Doesn't work on my GTX 980 Ti (Compute 5.2) with CUDA 10 / driver 450, so the CPU back-end is used instead.
cargo run --bin half-precision
-
adaptive_threshold.rs: Implements three adaptive thresholding techniques (mean, median and min-max average) as described in Image editing using ArrayFire: Part 3. Note that the path to the image is hard-coded, so it needs to be run from the repository root.
cargo run --bin adaptive-threshold
-
histogram.rs: Implements RGB histogram calculation as described in Image editing using ArrayFire: Part 3. Makes use of
slice()
and/orindex()
to obtain individual channels from anArray<T>
. Note that the path to the image is hard-coded, so it needs to be run from the repository root.cargo run --bin histogram
From the arrayfire-rust instructions:
To use the rust bindings for ArrayFire from crates.io, the following requirements are to be met first.
- Download and install ArrayFire binaries based on your operating system.
- Set the evironment variable
AF_PATH
to point to ArrayFire installation root folder.- Make sure to add the path to lib files to your path environment variables.
- On Linux: do
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$AF_PATH/lib64
- On OSX: do
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$AF_PATH/lib64
- On Windows: Add
%AF_PATH%\lib
to your PATH environment variable.- Add
arrayfire = "3.7"
to the dependencies section of your project's Cargo.toml file. Make sure to change the version to latest available.Once step (4) is over, you should be able to use ArrayFire in your Rust project.
- The State of GPGPU in Rust (as of August 2018)
- ArrayFire Examples (Part 4 of 8) - Image Processing
- ArrayFire Examples (Part 5 of 8) - Machine Learning
- ArrayFire Examples (Part 7 of 8) - Partial Differential Equations
- arrayfire/arrayfire: Machine Learning examples
- ArrayFire and arrayfire-rust are licensed under a BSD 3-Clause License.