Build Instructions for OSX
These are the build steps to compile ArrayFire from source on OSX. We use Homebrew to install dependencies.
Before you proceed with the build, make sure the submodules are up to date by running the following commands from the root of ArrayFire directory.
git submodule init
git submodule update
Overview:
- Required: cmake
- Recommended: FreeImage
- OSX 10.9 or later
$ brew install cmake freeimage
- Required: fftw
$ brew install fftw
- Required: >=CUDA 9.0, Boost (shared_ptr component)
- Recommended: Latest version of CUDA (CUDA 10.0 at the time of writing)
$ brew install boost
Refer to NVIDIA's website to install CUDA.
In addition to the OpenCL library (installed by default on OSX), the OpenCL backend requires
boost
. You can install it using brew:
$ brew install boost
The graphics backend uses GLFW which can be installed via. brew:
$ brew tap homebrew/versions
$ brew install glfw
Configure CMake options via ccmake .
Options | Description | Default |
---|---|---|
AF_BUILD_CPU | Enable CPU Build | ON |
AF_BUILD_CUDA | Enable CUDA Build | OFF |
AF_BUILD_OPENCL | Enable OpenCL Build | OFF |
AF_BUILD_FORGE | Build Forge Graphics Library | OFF |
AF_BUILD_EXAMPLES | Builds Examples | ON |
BUILD_TESTING | Builds Tests | ON |
CMAKE_BUILD_TYPE | Build type | Debug |
Note that Forge
graphics library doesn't need to be built to enable graphics support in ArrayFire. However, if do want to use graphics during development, please build forge too.
Commands:
$ cd /path/to/dir/arrayfire
$ mkdir build && cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release -DAF_BUILD_CUDA=ON -DAF_BUILD_OPENCL=ON # Enables building all 3 backends
$ make -j8 # or number of threads of your choosing
The default installation prefix is /usr/local
. Thus, includes are installed to /usr/local/include
, libs are installed to /usr/local/lib
, tests and examples are installed to /usr/local/arrayfire
.
To change the install prefix, use
$ cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install/dir
Then run make install
(sudo is installing to system directories).
Run tests:
$ cd /path/to/dir/arrayfire/build
$ # Choose you preferred command
$ make test # runs all test
$ ctest # runs all test
$ ctest -R substring # runs all tests that match the substring
$ CTEST_OUTPUT_ON_FAILURE ctest # runs tests while printing output only if a test fails
$ ./test/testname_backend # runs single test with output
Run examples:
$ cd /path/to/dir/arrayfire/build
$ ./examples/example_backend
- The ArrayFire Community
-
Getting ArrayFire
- Installers
- Installing via Package Managers
- Source
- Using ArrayFire on
- Building from Source
- Linux
- OSX
- Windows
- Building Dependencies
- Known Issues
- Contributing Code to ArrayFire
- Development Guidelines
- Recognition