arrayfire 3.8.0

ArrayFire is a high performance software library for parallel computing with an easy-to-use API. Its array based function set makes parallel programming simple. ArrayFire's multiple backends (CUDA, OpenCL and native CPU) make it platform independent and highly portable. A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs. This crate provides Rust bindings for ArrayFire library.
Documentation
use arrayfire::*;

#[cfg(op_assign)]
fn helper(dims: Dim4) {
    let mut a = randu::<f32>(dims);
    let b = randu::<f32>(dims);
    print(&a);
    print(&b);
    a += b;
    print(&a);
}

#[cfg(not(op_assign))]
fn helper(dims: Dim4) {
    let b = randu::<f32>(dims);
    print(&b);
}

#[allow(unused_must_use)]
fn test_backend() {
    info();

    println!("Create a 10-by-10 matrix of random floats on the compute device");
    let num_rows: u64 = 10;
    let num_cols: u64 = 10;
    let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);

    helper(dims)
}

#[allow(unused_must_use)]
fn main() {
    println!("There are {:?} available backends", get_backend_count());
    let available = get_available_backends();

    if available.contains(&Backend::CPU) {
        println!("Evaluating CPU Backend...");
        set_backend(Backend::CPU);
        println!("There are {} CPU compute devices", device_count());
        test_backend();
    }

    if available.contains(&Backend::CUDA) {
        println!("Evaluating CUDA Backend...");
        set_backend(Backend::CUDA);
        println!("There are {} CUDA compute devices", device_count());
        test_backend();
    }

    if available.contains(&Backend::OPENCL) {
        println!("Evaluating OpenCL Backend...");
        set_backend(Backend::OPENCL);
        println!("There are {} OpenCL compute devices", device_count());
        test_backend();
    }
}