ArrayFire Python Wrapper

Introduction

ArrayFire is a high performance scientific computing library with an easy to use API.

>>> # Monte Carlo estimation of pi
>>> def calc_pi_device(samples):
        # Simple, array based API
        # Generate uniformly distributed random numers
        x = af.randu(samples)
        y = af.randu(samples)
        # Supports Just In Time Compilation
        # The following line generates a single kernel
        within_unit_circle = (x * x + y * y) < 1
        # Intuitive function names
        return 4 * af.count(within_unit_circle) / samples

Programs written using ArrayFire are portable across CUDA, OpenCL and CPU devices.

The default backend is chosen in the following order of preference based on the available libraries:

  1. CUDA

  2. OpenCL

  3. CPU

The backend can be chosen at the beginning of the program by using the following function

>>> af.set_backend(name)

where name is one of ‘cuda’, ‘opencl’ or ‘cpu’.

The functionality provided by ArrayFire spans the following domains:

  1. Vector Algorithms

  2. Image Processing

  3. Signal Processing

  4. Computer Vision

  5. Linear Algebra

  6. Statistics

Submodules

arrayfire.algorithm

Vector algorithms (sum, min, sort, etc).

arrayfire.arith

Math functions (sin, sqrt, exp, etc).

arrayfire.array

Array class and helper functions.

arrayfire.base

Implementation of BaseArray class.

arrayfire.bcast

Function to perform broadcasting operations.

arrayfire.blas

BLAS functions (matmul, dot, etc)

arrayfire.cuda

Functions specific to CUDA backend.

arrayfire.data

Functions to create and manipulate arrays.

arrayfire.device

Functions to handle the available devices in the backend.

arrayfire.features

Features class used for Computer Vision algorithms.

arrayfire.graphics

Graphics functions (plot, image, etc).

arrayfire.image

Image processing functions.

arrayfire.index

Index and Seq classes used in indexing operations.

arrayfire.interop

Interop with other python packages.

arrayfire.lapack

Dense Linear Algebra functions (solve, inverse, etc).

arrayfire.library

Module containing enums and other constants.

arrayfire.opencl

Functions specific to OpenCL backend.

arrayfire.random

Random engine class and functions to generate random numbers.

arrayfire.sparse

Functions to create and manipulate sparse matrices.

arrayfire.signal

Signal processing functions (fft, convolve, etc).

arrayfire.statistics

Statistical algorithms (mean, var, stdev, etc).

arrayfire.timer

Functions to time arrayfire.

arrayfire.util

Utility functions to help with Array metadata.

arrayfire.vision

Computer vision functions (FAST, ORB, etc)