CUDA
C/C++    Fortran   

ArrayFire CUDA C/C++ Documentation

Quick Links
Release Notes
Getting Started
Quick Reference
Parallel Loops: gfor

Overview

ArrayFire is a fast and comprehensive, high-level GPU matrix library.

  • It contains the fastest implementations for hundreds of routines in areas of matrix arithmetic, signal processing, linear algebra, statistics, and image processing, all built upon thousands of lines of highly-tuned device code optimized for any CUDA-enabled GPU.
  • A simple array notation allows a few lines of ArrayFire code to accomplish what would have taken 10-100X lines in raw CUDA. The array object is also easier to use than template programming and is more flexible and faster than directive-based approaches.
  • ArrayFire performs run-time analysis of your code to increase arithmetic intensity and memory throughput, while avoiding unnecessary temporary allocations (via custom JIT compiler). It can also execute loop iterations in parallel with gfor, and supports easy multi-GPU scaling.

Simple Example

Here's a stripped down example of Monte-Carlo estimation of Pi:

    #include <stdio.h>
    #include <arrayfire.h>
    using namespace af;

    int main() {
        // create GPU arrays
        int n = 20e6; // use 20 million random samples
        array x = randu(n), y = randu(n);

        // determine how many fell inside the unit circle?
        // ... calculate on GPU, return result to CPU
        float pi = 4.0 * sum<float>(hypot(x,y) < 1) / n;

        printf("pi = %g\n", pi);
        return 0;
    }

Quick-start Links

Get ArrayFire!

System Requirements

Supported Platforms

  • Windows (32 and 64-bit) - XP, Vista, 7
  • Linux (32 and 64-bit) - Ubuntu 10+, Fedora 10+, OpenSUSE 11+, RHEL 5+, CentOS 5+, SLES 10+
  • Mac OSX (64-bit) - Snow Leopard (10.6.x), Lion (10.7.x)

Requirements

Note: This version of ArrayFire is not thread-safe but support is planned.

Product Support