- Notifications
You must be signed in to change notification settings - Fork59
arrayfire/arrayfire-rust
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
ArrayFire is a high performance library for parallel computing with an easy-to-use API. Itenables users to write scientific computing code that is portable across CUDA, OpenCL and CPUdevices. This project provides Rust bindings for the ArrayFire library. Given below table showsthe rust bindings compatability with ArrayFire. If you find any bugs, please report themhere.
arrayfire-rust | ArrayFire |
---|---|
M.m.p1 | M.m.p2 |
Only, Major(M) & Minor(m) version numbers need to match.p1 andp2 are patch/fix updates forarrayfire-rust
&ArrayFire
respectively, and they don't need to match.
Linux, Windows and OSX. Rust 1.31 or newer is required.
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. Depending on themethod of your installation for Linux, steps (2) & (3) may not be required. If that is the case,proceed to step (4) directly.
- 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/lib
- On Windows: Add
%AF_PATH%\lib
to your PATH environment variable.
- On Linux: do
- Add
arrayfire = "3.8"
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. If you find anybugs, please report themhere.
Editbuild.conf to modify the build flags. The structure is a simple JSON blob.Currently Rust does not allow key:value pairs to be passed from the CLI. To use an existingArrayFire installation modify the first three JSON values. You can install ArrayFire usingone of the following two ways.
To build arrayfire submodule available in the rust wrapper repository, you have to do the following.
git submodule update --init --recursivecargo build // use --all to build all cratesin the workspace
This is recommended way to build Rust wrapper since the submodule points to the most compatibleversion of ArrayFire the Rust wrapper has been tested with. You can find the ArrayFire dependencies below.
let num_rows:u64 =5;let num_cols:u64 =3;let dims =Dim4::new(&[num_rows, num_cols,1,1]);let a =randu::<f32>(dims);af_print!("Create a 5-by-3 matrix of random floats on the GPU", a);
~/p/arrayfire_rust> cargo run --example helloworld...Create a 5-by-3 matrix of random floats on the GPU[5 3 1 1] 0.7402 0.4464 0.7762 0.9210 0.6673 0.2948 0.0390 0.1099 0.7140 0.9690 0.4702 0.3585 0.9251 0.5132 0.6814...
If the build command fails with undefined references errors even after taking care of environmentvariables, we recommend doing acargo clean
and re-runningcargo build
orcargo test
.
You can also use some environment variables mentioned in ourbook, such asAF_PRINT_ERRORS
to print more elaborate error messages to console.
The ArrayFire library is written by developers atArrayFire LLC withcontributionsfrom several individuals. The developers at ArrayFire LLC have received partial financial supportfrom several grants and institutions. Those that wish to receive public acknowledgement are listedbelow:
This material is based upon work supported by the DARPA SBIR Program Office under Contract NumbersW31P4Q-14-C-0012 and W31P4Q-15-C-0008. Any opinions, findings and conclusions or recommendationsexpressed in this material are those of the author(s) and do not necessarily reflect the views ofthe DARPA SBIR Program Office.
About
Rust wrapper for ArrayFire
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.