Skip to content

Commit 2609381

Browse files
committed
Added acknowledgements and more description
1 parent 39f9632 commit 2609381

File tree

1 file changed

+56
-77
lines changed

1 file changed

+56
-77
lines changed

README.md

Lines changed: 56 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
11
# Arrayfire Rust Bindings
22

3-
The wrapper is currently compliant with ArrayFire 3.0 API. You can find the documentation [here](http://arrayfire.github.io/arrayfire-rust/arrayfire/index.html). If you find any bugs, please report them [here](https://github.com/arrayfire/arrayfire-rust/issues).
3+
[ArrayFire](https://github.com/arrayfire/arrayfire) is a high performance library for parallel computing with an easy-to-use API. It enables users to write scientific computing code that is portable across CUDA, OpenCL and CPU devices. This project provides Rust bindings for the ArrayFire library. The wrapper is currently compliant with ArrayFire 3.0 API. You can find the documentation [here](http://arrayfire.github.io/arrayfire-rust/arrayfire/index.html). If you find any bugs, please report them [here](https://github.com/arrayfire/arrayfire-rust/issues).
44

5-
## Building & Running
5+
## Build
66

7-
Edit [build.conf](build.conf) to modify the build flags. The structure is a simple JSON blob.
8-
Currently Rust does not allow key:value pairs to be passed from the CLI.
9-
To use an existing arrayfire installation modify the first three JSON values.
7+
Edit [build.conf](build.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 existing ArrayFire installation modify the first three JSON values. You can install ArrayFire using one of the following two ways.
108

11-
To build arrayfire:
9+
- [Download and install binaries](https://arrayfire.com/download)
10+
- [Build and install from source](https://github.com/arrayfire/arrayfire)
11+
12+
To build arrayfire submodule available in the rust wrapper, you have to do the following.
1213

1314
```bash
1415
git submodule update --init --recursive
1516
cargo build
17+
```
18+
This is recommended way to build Rust wrapper since the submodule points to the most compatible version of ArrayFire the Rust wrapper has been tested with. You can find the ArrayFire dependencies below.
19+
20+
- [Linux dependencies](http://www.arrayfire.com/docs/using_on_linux.htm)
21+
- [OSX dependencies](http://www.arrayfire.com/docs/using_on_osx.htm)
22+
23+
Operating System Support: Currently, only Linux and OSX. With Rust 1.4(MSVC binary), we soon expect to get the Windows support available.
24+
25+
## Example
26+
27+
```rust
28+
let num_rows: u64 = 5;
29+
let num_cols: u64 = 3;
30+
let dims = Dim4::new(&[num_rows, num_cols, 1, 1]);
31+
println!("Create a 5-by-3 matrix of random floats on the GPU");
32+
let a = match randu(dims, Aftype::F32) {
33+
Ok(value) => value,
34+
Err(error) => panic!("{}", error),
35+
};
36+
print(&a);
1637
```
1738

18-
To run hello world example:
39+
### Sample output
1940

2041
```bash
2142
~/p/arrayfire_rust> cargo run --example helloworld
@@ -32,76 +53,7 @@ Create a 5-by-3 matrix of random floats on the GPU
3253
0.9690 0.4702 0.3585
3354
0.9251 0.5132 0.6814
3455

35-
Element-wise arithmetic
36-
sin(a) + 1.5 =>
37-
[5 3 1 1]
38-
2.1744 1.9317 2.2006
39-
2.2962 2.1189 1.7905
40-
1.5390 1.6097 2.1549
41-
2.3243 1.9531 1.8509
42-
2.2987 1.9910 2.1299
43-
44-
sin(a) + cos(a) =>
45-
[5 3 1 1]
46-
1.4128 1.3337 1.4142
47-
1.4012 1.4044 1.2474
48-
1.0382 1.1037 1.4106
49-
1.3905 1.3446 1.2873
50-
1.4004 1.3621 1.4066
51-
52-
!a =>
53-
[5 3 1 1]
54-
1 1 1
55-
1 1 1
56-
1 1 1
57-
1 1 1
58-
1 1 1
59-
60-
a + b
61-
[5 3 1 1]
62-
2.9147 2.3780 2.9767
63-
3.2172 2.7862 2.0853
64-
1.5780 1.7196 2.8689
65-
3.2933 2.4233 2.2094
66-
3.2238 2.5042 2.8113
67-
68-
Fourier transform the result
69-
[5 3 1 1]
70-
(10.6327,0.0000) (9.6043,0.0000) (10.1267,0.0000)
71-
(0.4689,0.4640) (0.3193,0.0802) (0.1713,0.1441)
72-
(-0.3491,-0.7454) (-0.2923,-0.4018) (0.2667,0.4886)
73-
(-0.3491,0.7454) (-0.2923,0.4018) (0.2667,-0.4886)
74-
(0.4689,-0.4640) (0.3193,-0.0802) (0.1713,-0.1441)
75-
76-
Create 2-by-3 matrix from host data
77-
[2 3 1 1]
78-
1 3 5
79-
2 4 6
80-
81-
Sort A and print sorted array and corresponding indices
82-
[5 3 1 1]
83-
0.0390 0.1099 0.2948
84-
0.7402 0.4464 0.3585
85-
0.9210 0.4702 0.6814
86-
0.9251 0.5132 0.7140
87-
0.9690 0.6673 0.7762
88-
89-
[5 3 1 1]
90-
2 2 1
91-
0 0 3
92-
1 3 4
93-
4 4 2
94-
3 1 0
95-
96-
u8 constant array
97-
[5 3 1 1]
98-
1 1 1
99-
1 1 1
100-
1 1 1
101-
1 1 1
102-
1 1 1
103-
104-
Is u8_cnst array float precision type ? false
56+
...
10557
```
10658

10759
## Issues
@@ -113,3 +65,30 @@ dyld: Library not loaded: @rpath/libafopencl.3.dylib
11365
```
11466

11567
You need to add the location of libaf.{dylib, so, dll} to your LD_LIBRARY_PATH.
68+
69+
## Note
70+
71+
This is a work in progress and is not intended for production use.
72+
73+
## Acknowledgements
74+
75+
The ArrayFire library is written by developers at [ArrayFire](http://arrayfire.com) LLC
76+
with [contributions from several individuals](https://github.com/arrayfire/arrayfire_python/graphs/contributors).
77+
78+
The developers at ArrayFire LLC have received partial financial support
79+
from several grants and institutions. Those that wish to receive public
80+
acknowledgement are listed below:
81+
82+
<!--
83+
The following section contains acknowledgements for grant funding. In most
84+
circumstances, the specific phrasing of the text is mandated by the grant
85+
provider. Thus these acknowledgements must remain intact without modification.
86+
-->
87+
88+
### Grants
89+
90+
This material is based upon work supported by the DARPA SBIR Program Office
91+
under Contract Numbers W31P4Q-14-C-0012 and W31P4Q-15-C-0008.
92+
Any opinions, findings and conclusions or recommendations expressed in this
93+
material are those of the author(s) and do not necessarily reflect the views of
94+
the DARPA SBIR Program Office.

0 commit comments

Comments
 (0)