Documentation
Installation

See release notes for a list of recent changes.

# Requirements

## Windows Requirements

• Visual Studio 2008, 2010, or 2012

## Linux Requirements

• gcc/g++ versions 4.3 or higher

## Mac OSX Requirements

• gcc/g++ versions 4.3 and higher
• Mac OSX needs X11 to be running only for graphical examples

# Install

## Windows

Run the downloaded installer (an EXE file)

• The default installation directory is C:/Program Files/AccelerEyes/ArrayFire
• The installer will detect older versions of ArrayFire and remove them automatically
• You can also use Add/Remove Programs to uninstall

## Linux

Begin installation by running the *.run file that you downloaded. From a terminal shell prompt, do:

sh ArrayFire-linux-2.0.20131206.run

The default installation directory is /opt/arrayfire-2.0.

Set the AF_PATH environment variable to point to your ArrayFire installation. For example, include the following in your bashrc file:

AF_PATH=/opt/arrayfire-2.0

To uninstall a previous version of ArrayFire, simply delete its installation directory.

## Mac OSX

Unzip the file and use Manual Activation.

Set the AF_PATH environment variable to point to your ArrayFire installation. For example, include the following in your bashrc file:

AF_PATH=/opt/arrayfire-2.0

# Activate

There are two ways to activate your ArrayFire software:

ArrayFire Free licenses require activation through the installer.

## Installer Activation (recommended)

On Windows and Linux, the installer includes an activation wizard. The wizard automatically downloads an arrayfire.lic license file onto your computer. The location of this file will either be the AF_PATH directory if it is set and you have permission to write to this location, or the HOME directory otherwise. To use the wizard, follow these steps:

• Ensure you have a website account
• Click on Free or Pro (for Developer, Pro, or Enterprise licenses), explained on the pricing page
• For Pro Licenses, select the appropriate purchased license for this computer and then click Activate

For both Free and Pro Licenses, you will need to choose the Host ID to use for your license file and then click Activate

If everything worked, you'll get a success message like this!

If automatic activation fails, try website activation.

# Verify Installation with Hello World

Now that you have installed and activated ArrayFire, let's test the installation by running the helloworld example.

## Windows

Using Visual Studio 2008, 2010, or 2012, open the appropriate helloworld solution in the <AF_PATH>/examples/helloworld directory.

• Use the Solution Platforms to choose between CUDA and OpenCL.
• Use the Solution Configurations to choose between Release and Debug.
• Run the solution.

If using the consolidated solution files, AF_Examples, set helloworld as the Startup Project and then run the solution.

Successful output is shown below.

If you see an error with missing DLLs, try restarting your computer.

For other errors, try repeating the installation steps above. Support is also available, if needed.

## Linux

To run the Hello World example on Linux, do the following:

cd <AF_PATH>/examples/helloworld

Build and run the OpenCL version

make opencl
./helloworld_ocl

Build and run the CUDA version

make cuda
./helloworld_cuda

Successful output is shown below.

If unsuccessful, try repeating the installation steps above. Support is also available, if needed.

## Mac

To run the Hello World example on Mac, do the following:

cd <AF_PATH>/examples/helloworld

Build and run the CUDA version

make
./helloworld

Successful output is shown below.

If unsuccessful, try repeating the installation steps above. Support is also available, if needed.

## Successful Output

If you have successful installed and activated ArrayFire, you will see the following output of the helloworld_opencl example.

ArrayFire v2.0 (OpenCL, 64-bit Linux, build ab9a8ff)
Platform: NVIDIA CUDA, Driver: 319.32
[0]: Tesla K20c, 5119 MB, OpenCL Version: 1.1
1 : Tesla C1060, 4095 MB, OpenCL Version: 1.0
2 : Tesla C2075, 6143 MB, OpenCL Version: 1.1
Compute Device: [0]
create a 5-by-3 matrix of random floats on the GPU
A =
0.3147 0.5925 0.1464
0.0577 0.6904 0.5405
0.1838 0.6903 0.6547
0.7812 0.6750 0.6408
0.3873 0.8634 0.0239
element-wise arithmetic
B =
0.4095 0.6585 0.2459
0.1577 0.7369 0.6146
0.2828 0.7368 0.7089
0.8041 0.7249 0.6979
0.4777 0.8600 0.1239
Fourier transform the result
C =
2.1318 + 0.0000i 3.7171 + 0.0000i 2.3911 + 0.0000i
-0.2734 + 0.6108i -0.0306 + 0.1102i -0.6640 - 0.4732i
0.2313 - 0.3077i -0.1818 + 0.0837i 0.0832 - 0.2780i
0.2313 + 0.3077i -0.1818 - 0.0837i 0.0832 + 0.2780i
-0.2734 - 0.6108i -0.0306 - 0.1102i -0.6640 + 0.4732i
grab last row
c =
-0.2734 - 0.6108i -0.0306 - 0.1102i -0.6640 + 0.4732i
zero out every other column
negate the first three elements of middle column
B =
0.0000 -0.6585 0.0000
0.0000 -0.7369 0.0000
0.0000 -0.7368 0.0000
0.0000 0.7249 0.0000
0.0000 0.8600 0.0000
create 2-by-3 matrix from host data
D =
1.0000 3.0000 5.0000
2.0000 4.0000 6.0000
copy last column onto first
D =
5.0000 3.0000 5.0000
6.0000 4.0000 6.0000

Congratulations! You are now ready to use ArrayFire!

See examples for more things to try.