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 "<a href="http://sandbox.arrayfire.com/tag/learning-arrayfire-from-scratch/">Learning ArrayFire from scratch</a>" 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.

<!--more-->

Installing ArrayFire couldn't be easier. We ship installers for Windows, OSX, and Linux. Although you could <a href="https://github.com/arrayfire/arrayfire">build ArrayFire from source</a>, 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:
<ol type="1">
	<li>Install prerequisites</li>
	<li><a href="http://sandbox.arrayfire.com/download/">Download</a> the ArrayFire installer for your operating system</li>
	<li>Install ArrayFire</li>
	<li>Test the installation</li>
	<li><a href="#GettingHelp">Where to go for help?</a></li>
</ol>
Below you will find instructions for
<ul>
	<li><a href="#Windows">Windows</a></li>
	<li>Linux including
<ul>
	<li><a href="#Debian">Debian 8</a></li>
	<li><a href="#Ubuntu">Ubuntu 14.10 and later</a></li>
	<li><a href="#Fedora">Fedora 21</a></li>
</ul>
</li>
	<li><a href="#OSX">Mac OSX (.sh and brew)</a></li>
</ul>
<h3><a id="Windows" class="anchor"></a>Windows</h3>
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 <a href="http://sandbox.arrayfire.com/download/">download</a> and run the ArrayFire installer.
After it has completed, you need to add ArrayFire to the path for all users.
<ol>
	<li>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"</li>
	<li>In Advanced System Settings window, click on Advanced tab</li>
	<li>Click on Environment Variables, then under System Variables, find PATH, and click on it.</li>
	<li>In edit mode, append <span class="lang:default decode:true  crayon-inline ">%AF_PATH%/lib</span> . NOTE: Ensure that there is a semi-colon separating <span class="lang:default decode:true  crayon-inline ">%AF_PATH%/lib</span>  from any existing content (e.g. <span class="lang:default decode:true  crayon-inline ">EXISTING_PATHS;%AF_PATH%/lib;</span> ) otherwise other software may not function correctly.</li>
</ol>
Finally, verify that the path addition worked correctly. You can do this by running any of the HelloWorld examples located in <span class="lang:default decode:true  crayon-inline ">AF_PATH/examples/helloworld/</span>
<h3>Linux</h3>
<h4><a id="Debian" class="anchor"></a>Debian 8</h4>
First install the prerequisite packages:
<pre class="fragment"># 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
</pre>
If you wish to use CUDA, please <a href="https://developer.nvidia.com/cuda-zone">download the latest version of CUDA</a> and install it on your system.

Next <a href="http://sandbox.arrayfire.com/download/">download</a> ArrayFire. After you have the file, run the installer.
<pre class="fragment">./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local
</pre>
<h4><a id="Fedora" class="anchor"></a>Fedora 21</h4>
First install the prerequisite packages:
<pre class="fragment "># Install prerequiste packages
yum install freeimage atlas fftw libGLEW libGLEWmx glfw cmake
</pre>
If you wish to use CUDA, please <a href="https://developer.nvidia.com/cuda-downloads">download the latest version of CUDA</a> and install it on your system.

Next <a href="http://sandbox.arrayfire.com/download/">download</a> ArrayFire. After you have the file, run the installer.
<pre class="fragment">./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local
</pre>
<h4><a id="Ubuntu" class="anchor"></a>Ubuntu 14.10 and later</h4>
First install the prerequisite packages:
<pre class="fragment"># Prerequisite packages:
sudo apt-get install libfreeimage-dev libatlas3gf-base libfftw3-dev libglew-dev libglewmx-dev libglfw3-dev cmake
</pre>
If you are using ArrayFire on the Tegra-K1 also install these packages:
<pre class="fragment">sudo apt-get install libatlas3gf-base libatlas-dev libfftw3-dev liblapacke-dev
</pre>
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 <a href="https://developer.nvidia.com/cuda-downloads">NVIDIA CUDA download page</a> 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.
<pre class="fragment"># Enable GPU support (OpenCL):
apt-get install ocl-icd-libopencl1
</pre>
Finally, <a href="http://sandbox.arrayfire.com/download/">download</a> ArrayFire. After you have the file, run the installer using:
<pre class="fragment">./arrayfire_*_Linux_x86_64.sh --exclude-subdir --prefix=/usr/local
</pre>
<h3><a id="OSX" class="anchor"></a>Mac OSX</h3>
On OSX there are several dependencies that are not integrated into the operating system. The ArrayFire installer automatically satisfies these dependencies using <a href="http://brew.sh/">Homebrew</a>. If you don't have Homebrew installed on your system, the ArrayFire installer will ask you do to so.

Simply <a href="http://sandbox.arrayfire.com/download">download</a> the ArrayFire installer and double-click it to carry out the installation.

ArrayFire can also be installed through Homebrew directly using <span class="lang:default decode:true  crayon-inline ">brew install arrayfire</span> ; however, it will not include MKL acceleration of linear algebra functions.
<h3><a id="Testing" class="anchor"></a>Testing the installation</h3>
After ArrayFire is installed, you can build the example programs as follows:
<pre class="fragment">cp -r /usr/local/share/doc/arrayfire/examples .
cd examples
mkdir build
cd build
cmake ..
make
</pre>
<h3><a id="GettingHelp" class="anchor"></a>Getting help</h3>
<ul>
	<li>Google Groups: <a href="https://groups.google.com/forum/#!forum/arrayfire-users">https://groups.google.com/forum/#!forum/arrayfire-users</a></li>
	<li>ArrayFire Services: <a href="http://sandbox.arrayfire.com/consulting/">Consulting</a> | <a href="http://sandbox.arrayfire.com/support/">Support</a> | <a href="http://sandbox.arrayfire.com/training/">Training</a></li>
	<li>ArrayFire Blogs: <a href="http://sandbox.arrayfire.com/blog/">http://sandbox.arrayfire.com/blog/</a></li>
	<li>Email: <a href="#">technical@arrayfire.com</a></li>
</ul>
&nbsp;