Skip to content
ArrayFire: a general purpose GPU library.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
CMakeModules Add CUDA runtime compilation support using nvrtc (#2437) Mar 12, 2019
LICENSES
assets @ 729c7b6 Clarified and added illustration to rotate docs (#2453) Mar 5, 2019
docs Clarified and added illustration to rotate docs (#2453) Mar 5, 2019
examples Update all source files based on clang-format rules Jan 1, 2019
extern Update forge submodule to use glm submodule Jan 1, 2019
include Fix limitation note in hamming matcher docs Feb 15, 2019
src Remove void* memAlloc instantiation. Replace with uchar Mar 18, 2019
test Suppress Windows warnings in mmio lib Mar 4, 2019
.coveralls.yml
.gitignore
.gitmodules
ACKNOWLEDGEMENTS.md
CMakeLists.txt
CONTRIBUTING.md Updated contribution guidelines with new wiki page link Apr 1, 2015
COPYRIGHT.md
CTestConfig.cmake Mark more tests as serial tests. Update CDash drop site Nov 1, 2018
LICENSE Update license to avoid line wrap issues in the OSX installer Apr 24, 2018
README.md

README.md

ArrayFire is a general-purpose library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices.

Several of ArrayFire's benefits include:

ArrayFire provides software developers with a high-level abstraction of data which resides on the accelerator, the af::array object. Developers write code which performs operations on ArrayFire arrays which, in turn, are automatically translated into near-optimal kernels that execute on the computational device.

ArrayFire is successfully used on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers. ArrayFire runs on CPUs from all major vendors (Intel, AMD, ARM), GPUs from the prominent manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux.

Installation

You can install the ArrayFire library from one of the following ways:

Official installers

Execute one of our official binary installers for Linux, OSX, and Windows platforms.

Build from source

Build from source by following instructions on our wiki.

Examples

The following examples are simplified versions of helloworld.cpp and conway_pretty.cpp, respectively. For more code examples, visit the examples/ directory.

Hello, world!

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);

Conway's Game of Life

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
}

Conway's Game of Life

Documentation

You can find our complete documentation here.

Quick links:

Language wrappers

ArrayFire has several official and third-party language wrappers.

Official wrappers

We currently support the following language wrappers for ArrayFire:

Wrappers for other languages are a work-in-progress: .NET, Fortran, Go, Java, Lua, NodeJS, R, Ruby

Third-party wrappers

The following wrappers are being maintained and supported by third parties:

Contributing

Contributions of any kind are welcome! Please refer to CONTRIBUTING.md to learn more about how you can get involved with ArrayFire.

Citations and Acknowledgements

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.

Support and Contact Info

Trademark Policy

The literal mark “ArrayFire” and ArrayFire logos are trademarks of AccelerEyes LLC DBA ArrayFire. If you wish to use either of these marks in your own project, please consult ArrayFire's Trademark Policy

You can’t perform that action at this time.