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. ArrayFire provides visualization capabilities using our OpenGL-based, high performance visualization library.
A few lines of code in ArrayFire can replace dozens of lines of parallel computing code, saving you valuable time and lowering development costs.
Linux x86_64 | Linux armv7l | Linux aarch64 | Windows | OSX | |
---|---|---|---|---|---|
Build | |||||
Test |
You can install the ArrayFire library from one of the following ways:
Execute one of our official binary installers for Linux, OSX, and Windows platforms.
Build from source by following instructions on our wiki.
The following examples are simplified versions of
helloworld.cpp
and
conway_pretty.cpp
,
respectively. For more code examples, visit the
examples/
directory.
array A = randu(5, 3, f32); // Create 5x3 matrix of random floats on the GPU
array B = sin(A) + 1.5; // Element-wise arithmetic
array C = fft(B); // Fourier transform the result
float d[] = { 1, 2, 3, 4, 5, 6 };
array D(2, 3, d, afHost); // Create 2x3 matrix from host data
D.col(0) = D.col(end); // Copy last column onto first
array vals, inds;
sort(vals, inds, A); // Sort A and print sorted array and corresponding indices
af_print(vals);
af_print(inds);
Visit the Wikipedia page for a description of Conway's Game of Life.
static const float h_kernel[] = {1, 1, 1, 1, 0, 1, 1, 1, 1};
static const array kernel(3, 3, h_kernel, afHost);
array state = (randu(128, 128, f32) > 0.5).as(f32); // Generate starting state
Window myWindow(256, 256);
while(!myWindow.close()) {
array nHood = convolve(state, kernel); // Obtain neighbors
array C0 = (nHood == 2); // Generate conditions for life
array C1 = (nHood == 3);
state = state * C0 + C1; // Update state
myWindow.image(state); // Display
}
You can find our complete documentation here.
Quick links:
We currently support the following language wrappers for ArrayFire:
Wrappers for other languages are a work in progress:
arrayfire-dotnet
, arrayfire-fortran
, arrayfire-go
, arrayfire-java
, arrayfire-lua
, arrayfire-nodejs
, arrayfire-r
Contributions of any kind are welcome! Please refer to CONTRIBUTING.md to learn more about how you can get involved with ArrayFire.
If you redistribute ArrayFire, please follow the terms established in the license. If you wish to cite ArrayFire in an academic publication, please use the following citation document.
ArrayFire development is funded by ArrayFire LLC and several third parties, please see the list of acknowledgements for further details.
- Google Groups
- ArrayFire Services: Consulting | Support | Training