• Stars
    star
    4,408
  • Rank 9,251 (Top 0.2 %)
  • Language
    C++
  • License
    BSD 3-Clause "New...
  • Created over 9 years ago
  • Updated 28 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

ArrayFire: a general purpose GPU library.

ArrayFire is a general-purpose tensor library that simplifies the software development process for the parallel architectures found in CPUs, GPUs, and other hardware acceleration devices. The library serves users in every technical computing market.

Several of ArrayFire's benefits include:

  • Hundreds of accelerated tensor computing functions, in the following areas:
    • Array handling
    • Computer vision
    • Image processing
    • Linear algebra
    • Machine learning
    • Standard math
    • Signal Processing
    • Statistics
    • Vector algorithms
  • Easy to use, stable, well-documented API
  • Rigorous benchmarks and tests ensuring top performance and numerical accuracy
  • Cross-platform compatibility with support for CUDA, oneAPI, OpenCL, and native CPU on Windows, Mac, and Linux
  • Built-in visualization functions through Forge
  • Commercially friendly open-source licensing
  • Enterprise support from ArrayFire

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

ArrayFire runs 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 (AMD, Intel, NVIDIA, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux.

Getting ArrayFire

Instructions to install or to build ArrayFire from source can be found on the wiki.

Conway's Game of Life Using ArrayFire

Visit the Wikipedia page for a description of Conway's Game of Life.

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); // Init 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
}

The complete source code can be found here.

Perceptron

Perceptron

array predict(const array &X, const array &W) {
    return sigmoid(matmul(X, W));
}

array train(const array &X, const array &Y,
        double alpha = 0.1, double maxerr = 0.05,
        int maxiter = 1000, bool verbose = false) {
    array Weights = constant(0, X.dims(1), Y.dims(1));

    for (int i = 0; i < maxiter; i++) {
        array P   = predict(X, Weights);
        array err = Y - P;
        if (mean<float>(abs(err) < maxerr) break;
        Weights += alpha * matmulTN(X, err);
    }
    return Weights;
}
...

array Weights = train(train_feats, train_targets);
array test_outputs  = predict(test_feats, Weights);
display_results<true>(test_images, test_outputs,
                      test_targets, 20);

The complete source code can be found here.

For more code examples, visit the examples/ directory.

Documentation

You can find the complete documentation here.

Quick links:

Language support

ArrayFire has several official and community maintained language API's:

C++ Python Rust Julia† Nim†

†  Community maintained wrappers

In-Progress Wrappers

.NET Fortran Go Java Lua NodeJS R Ruby

Contributing

The community of ArrayFire developers invites you to build with us if you are interested and able to write top-performing tensor functions. Together we can fulfill The ArrayFire Mission for fast scientific computing for all.

Contributions of any kind are welcome! Please refer to the wiki and our Code of Conduct to learn more about how you can get involved with the ArrayFire Community through Sponsorship, Developer Commits, or Governance.

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 AccelerEyes LLC and several third parties, please see the list of acknowledgements for an expression of our gratitude.

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

More Repositories

1

arrayfire-rust

Rust wrapper for ArrayFire
Rust
804
star
2

arrayfire-python

Python bindings for ArrayFire: A general purpose GPU library.
Python
413
star
3

forge

High Performance Visualization
C++
219
star
4

arrayfire-js

ArrayFire.js - ArrayFire for Node.js
C++
119
star
5

arrayfire-ml

ArrayFire's Machine Learning Library.
C++
102
star
6

arrayfire-dotnet

.NET wrapper for ArrayFire
C#
79
star
7

androidcl

Sample app that runs OpenCL kernels to process camera feed on Android devices
C++
76
star
8

arrayfire-haskell

Haskell bindings to ArrayFire
Haskell
59
star
9

arrayfire-rb

Ruby wrapper for ArrayFire
C
37
star
10

arrayfire-java

Java wrapper for ArrayFire
Java
35
star
11

xilinx_demos

OpenCL Demos for Xilinx FPGAs
C++
31
star
12

arrayfire-fortran

Fortran wrapper for ArrayFire
Fortran
24
star
13

arrayfire-r

R wrapper for ArrayFire
R
22
star
14

arrayfire-go

Go bindings for arrayfire
Go
16
star
15

cuda_deployment_tutorial

Scripts to Deploy GPU Enabled Containers
Shell
13
star
16

arrayfire_opengl_interop

Code sample to show interoperability between ArrayFire and OpenGL.
C++
12
star
17

arrayfire-windows-scripts

Batch Scripts for Building ArrayFire on Windows
Batchfile
11
star
18

arrayfire-lua

Lua wrapper for ArrayFire
Lua
10
star
19

valhalla

Benchmarks for Open Source Libraries with Parallel Vector algorithms.
CMake
8
star
20

arrayfire-project-templates

Template Projects for ArrayFire
CMake
7
star
21

arrayfire-docker

Dockerfile for Building and Using ArrayFire https://github.com/arrayfire/arrayfire.git
Dockerfile
6
star
22

arrayfire-api-cheat-sheet

A quick reference of arrayfire library API; equivalent API in it's language wrappers and other math libraries.
6
star
23

ml_lab

Machine Learning Lab
C++
6
star
24

arrayfire-data

ArrayFire Test Data
5
star
25

ITK-ArrayFire-Bridge-Tutorial

Hands-on tutorial on how to combine ITK with ArrayFire http://www.itk.org
C++
5
star
26

arrayfire-benchmark

Benchmark software for ArrayFire
C++
5
star
27

arrayfire-d

D-lang bindings for arrayfire
D
4
star
28

afQuantumSim

ArrayFire Quantum Simulator
C++
4
star
29

threads

C++
4
star
30

d3m-arrayfire-primitives

DARPA D3M TA1 Accelerated Primitives
Python
3
star
31

arrayfire-lisp

Lisp bindings for ArrayFire
2
star
32

assets

Assets for the ArrayFire documentation
2
star
33

arrayfire-extras

Add-on functionality for the ArrayFire library
2
star
34

arrayfire-binary-python-wrapper

A python thin wrapper for ArrayFire library
Python
2
star
35

freetype2

C
1
star
36

arrayfire-torch

Torch wrapper for ArrayFire
1
star
37

af-sklearn-monkeypatch

Monkey-patch for scikit-learn with accelerated ArrayFire components.
Python
1
star
38

arrayfire.github.io

ArrayFire documentation
HTML
1
star