Learning ArrayFire from scratch: Installation

Brian KloppenborgArrayFire 9 Comments

Recently one of our interns completed his project ahead of schedule and asked if he could spend some time writing a particle filtering demo in ArrayFire for use at our upcoming trade shows. While learning the ins and outs of ArrayFire he posed several excellent questions which prompted us to start a series of blog posts entitled “Learning ArrayFire from scratch” that are geared to first-time users of our library.

In today’s post I will cover the installation process on Windows, Mac, and Linux. Our next post will discuss the basics of setting up your first ArrayFire project.

Installing ArrayFire couldn’t be easier. We ship installers for Windows, OSX, and Linux. Although you could build ArrayFire from source, we suggest using our pre-compiled binaries as they include the Intel Math Kernel Library to accelerate linear algebra functions.

Please note that although our download page requires a valid login, registration is free and downloading ArrayFire is also free. We request your contact information so that we may notify you of software updates and occasionally collect user feedback about our library.

In general, the installation process for ArrayFire looks like this:

  1. Install prerequisites
  2. Download the ArrayFire installer for your operating system
  3. Install ArrayFire
  4. Test the installation
  5. Where to go for help?

Below you will find instructions for

Windows

If you wish to use CUDA or OpenCL please ensure that you have also installed
support for these technologies from your video card vendor’s website.

Next download and run the ArrayFire installer.
After it has completed, you need to add ArrayFire to the path for all users.

  1. Open Advanced System Settings:
    * Windows 8: Move the Mouse pointer to the bottom right corner of the screen, Right click, choose System. Then click “Advanced System Settings”
    * Windows 7: Open the Start Menu and Right Click on “Computer”. Then choose Properties and click “Advanced System Settings”
  2. In Advanced System Settings window, click on Advanced tab
  3. Click on Environment Variables, then under System Variables, find PATH, and click on it.
  4. In edit mode, append %AF_PATH%/lib . NOTE: Ensure that there is a semi-colon separating %AF_PATH%/lib  from any existing content (e.g. EXISTING_PATHS;%AF_PATH%/lib; ) otherwise other software may not function correctly.

Finally, verify that the path addition worked correctly. You can do this by running any of the HelloWorld examples located in AF_PATH/examples/helloworld/

Linux

Debian 8

First install the prerequisite packages:

# Prerequisite packages:
apt-get install libfreeimage-dev libatlas3gf-base libfftw3-dev libglew-dev libglewmx-dev libglfw3-dev cmake

# Enable GPU support (OpenCL):
apt-get install ocl-icd-libopencl1

If you wish to use CUDA, please download the latest version of CUDA and install it on your system.

Next download ArrayFire. After you have the file, run the installer.

./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local

Fedora 21

First install the prerequisite packages:

# Install prerequiste packages
yum install freeimage atlas fftw libGLEW libGLEWmx glfw cmake

If you wish to use CUDA, please download the latest version of CUDA and install it on your system.

Next download ArrayFire. After you have the file, run the installer.

./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local

Ubuntu 14.04 and later

First install the prerequisite packages:

# Prerequisite packages:
sudo apt-get install libfreeimage-dev libatlas3gf-base libfftw3-dev libglew-dev libglewmx-dev libglfw3-dev cmake

Ubuntu 14.04 will not have the libglfw3-dev package in its repositories. You can either build the library from source (following the instructions listed) or install the library from a PPA as follows:

sudo apt-add repository ppa:keithw/glfw3
sudo apt-get update
sudo apt-get install glfw3

After this point, the installation should proceed identically to Ubuntu 14.10 or newer.

If you are using ArrayFire on the Tegra-K1 also install these packages:

sudo apt-get install libatlas3gf-base libatlas-dev libfftw3-dev liblapacke-dev

If your system has a CUDA GPU, we suggest downloading the latest drivers from NVIDIA in the form of a Debian package and installing using the package manager. At present, CUDA downloads can be found on the NVIDIA CUDA download page Follow NVIDIA’s instructions for getting CUDA set up.

If you wish to use OpenCL, simply install the OpenCL ICD loader along with any drivers required for your hardware.

# Enable GPU support (OpenCL):
apt-get install ocl-icd-libopencl1

Finally, download ArrayFire. After you have the file, run the installer using:

./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local

Mac OSX

On OSX there are several dependencies that are not integrated into the operating system. The ArrayFire installer automatically satisfies these dependencies using Homebrew. If you don’t have Homebrew installed on your system, the ArrayFire installer will ask you do to so.

Simply download the ArrayFire installer and double-click it to carry out the installation.

ArrayFire can also be installed through Homebrew directly using brew install arrayfire ; however, it will not include MKL acceleration of linear algebra functions.

Testing the installation

After ArrayFire is installed, you can build the example programs as follows:

cp -r /usr/local/share/doc/arrayfire/examples .
cd examples
mkdir build
cd build
cmake ..
make

Getting help

 

Comments 9

  1. It would be great to have ArrayFire available through conda so I could install it with:

    conda install arrayfire

    1. Indeed, it would be nice to have ArrayFire fully install via. `conda` or `pip`. At the moment, ArrayFire from within Python is implemented as a wrapper to the system library. Thus you must install ArrayFire as mentioned above. After that, you can install the python wrapper using `pip install arrayfire` from a regular Python shell or `conda install pip` followed by `pip install arrayfire` from within anaconda.

          1. So, in this case you must create suitable PPA repo for Ubuntu 14.04 with deb packages. Once again, Ubuntu 14.04 is one of most popular Linux distro (including every forks, like Linux Mint, etc.). You have to definitely keep installation on this distro as simple as possible!!!

Leave a Reply

Your email address will not be published. Required fields are marked *