ArrayFire Installer

To use ArrayFire-Python you require three things:

arrayfire-py package - It is the intended User Interface that provides a numpy-like layer to execute math and array operations with ArrayFire.

arrayfire-binary-python-wrapper - It is a thin wrapper that provides Python direct access to the ArrayFire functions in the C library. This package must have access to ArrayFire binaries, either through a system-wide install, or through a pre-bundled wheel that includes binaries.

ArrayFire C/C++ Libraries - They are the binaries obtained from compiling the ArrayFire C/C++ Project or more simply by downloading installers in the ArrayFire download page. Binaries can also be obtained as part of a pre-packaged arrayfire-binary-python-wrapper wheel.

Below we detail more on the ArrayFire C Libraries installation procedure. Install the latest device drivers before using ArrayFire. Drivers and runtimes should be downloaded and installed from each device vendor’s website.

Install Instructions for ArrayFire Python

arrayfire-py

You may install it through pip pip install arrayfire-python or from building arrayfire-py wheel. By installing through pip, you will automatically download the latest arrayfire-binary-python-wrapper containing the ArrayFire C Libraries.

arrayfire-binary-python-wrapper

If you wish to use some specific version of ArrayFire, you can must download a specifc version of t he arrayfire-binary-python-wrapper. You may download one and install through pip which will come with ArrayFire C Libraries: pip install arrayfire_binary_python_wrapper-0.8.0+af3.10.0 -f https://arrayfire.com/python/binaries. You may also build from source without the C Libraries and then install the ArrayFire Binaries via the ArrayFire Installers.

Install Instructions for ArrayFire C Libraries

Windows

Once the ArrayFire has been downloaded, run the installer.

The installer offers the option to automatically add ArrayFire to the path for all users. If the installer did not do this, simply append %AF_PATH%/lib to the PATH variable so that the loader can find ArrayFire DLLs.

Linux

There are two ways to install ArrayFire on Linux.

Package Manager Using the ArrayFire Linux Installer As of today, approach (1) is only supported for Ubuntu 18.04 and 20.04. Please go through the GitHub wiki page for detailed instructions.

For approach (2), once the ArrayFire installer is downloaded, execute the installer from the terminal as shown below. Set the --prefix argument to the target install directory; we recommend /opt.

./ArrayFire_*_Linux_x86_64.sh --include-subdir --prefix=/opt

Given sudo permissions, the ArrayFire libraries can be added to the path via ldconfig like so:

echo /opt/arrayfire/lib64 > /etc/ld.so.conf.d/arrayfire.conf
sudo ldconfig

Otherwise, the LD_LIBRARY_PATH environment variable can be set so that the shared library loader can find the ArrayFire libraries.

For more information on using ArrayFire on Linux, visit the following page*.

Graphics support

ArrayFire enables high-performance visualizations via the Forge library. On Linux, there are a few dependencies to install to enable graphics support:

  • FreeImage

  • Fontconfig

  • GLU (OpenGL Utility Library)

To install these dependencies on common Linux distributions:

Debian, Ubuntu (14.04 and above), and other Debian derivatives

apt install build-essential libfreeimage3 libfontconfig1 libglu1-mesa

Fedora, Redhat, CentOS

yum install freeimage fontconfig mesa-libGLU

macOS

Once the ArrayFire installer has been downloaded, execute the installer by either double-clicking on the ArrayFire pkg file or running the following command:

sudo installer -pkg Arrayfire-*_OSX.pkg -target /

For more information on using ArrayFire on macOS, visit the following page*.

NVIDIA Tegra devices

ArrayFire is capable of running TX2 devices.

Before installing ArrayFire, make sure the latest version of JetPack (v2.3 and above) or L4T (v24.2 and above) is installed.

Tegra prerequisites

The following dependencies are required for Tegra devices:

sudo apt install libopenblas-dev liblapacke-dev

Testing installation

After ArrayFire is finished installing, we recommend building and running a few of the provided examples to verify things are working as expected.

On Windows, open the CMakeLists.txt file from CMake-GUI. Once the project is configured and generated, build and run the examples from Visual Studio.

On Linux, run the following commands:

cp -r /opt/arrayfire/share/ArrayFire/examples /tmp/examples
cd /tmp/examples
mkdir build
cd build
cmake ..
make
./helloworld/helloworld_{cpu,cuda,oneapi,opencl}

Getting help