Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Build Instructions for Linux

John Melonakos edited this pageNov 6, 2023 ·55 revisions

The instructions are based on Ubuntu 14.04. Change the packages and package manager to the distro of your choice.

Overview:

Installing Dependencies

General Dependencies

  • Required: gcc (>=7.x), g++, git (>=1.8), make, cmake, boost(>=1.65, >=1.70 recommended)
  • Recommended: FreeImage (version 3), cmake-curses-gui
  • The following packages are required for the graphics to be enabled:
    • GLFW >= 3.1 (build instructions availablehere.3rd party maintainedpackages are also available).
    • ArrayFire also requiresForge but this is a submodule and will be checkout during submodule initilization stage.AF_BUILD_FORGE cmake option has to be turned on to build graphics support.
sudo apt-get install -y build-essential git cmake libfreeimage-devsudo apt-get install -y cmake-curses-guiwget<boostsource url>tar xf boost_1_70_0.tar.gzcp -r boost_1_70_0/boost /usr/local/include

Please fetch the boost download URL fromhttps://www.boost.org/users/download/ and replace<boost source url> with that in the above wget command.

CPU backend dependencies

  • Required: BLAS and LAPACK C++ libraries (e.g. openblas, atlas or cblas with lapacke)
  • Required: libfftw3
# Using OpenBLASsudo apt-get install libopenblas-dev libfftw3-dev liblapacke-dev# Using ATLASsudo apt-get install libatlas3gf-base libatlas-dev libfftw3-dev liblapacke-dev

Note: There is aknown issue on Ubuntu 16.04, atlas and lapacke combination causes undefined reference errors as the version of lapacke that comes with package manager is broken. We recommend using OpenBLAS on ubuntu 16.04.

CUDA backend dependencies

  • Required: CUDA 9.0 or later
  • Recommended: Latest version of CUDA (v9.1 at the time of writing)

Installing CUDA

Download the latestCUDA toolkit.You want to download the network installer deb file for your particular Ubuntu version. Install CUDA using

$ sudo dpkg -i cuda-repo-*amd64.deb$ sudo apt-get update$ sudo apt-get install cuda

oneAPI backend dependencies

Required: Install the oneAPIBase Toolkit with compiler and libraries.

Once the toolkit is installed, enable necessary paths to all compilers and libraries by running the setvars.sh script. For example:

source /opt/intel/oneapi/setvars.sh

OpenCL backend dependencies

Required:

On 64-bit installs, AMDAPPSDK-3.0 installs with abroken symbolic link which can be fixed by going to$AMDAPPSDKROOT/lib/x86_64/and executing:

sudo ln -sf sdk/libOpenCL.so.1 libOpenCL.so

For all the above, ensure that you install the common opencl-headers package prior to building the OpenCL back-end:

sudo apt-get install opencl-headers

Install boost:

sudo apt-get install libboost-all-dev

Install the OpenCL ICD Loader:

sudo apt-get install ocl-icd-opencl-dev

Please note that ArrayFire also requiresclBLAS,clFFT andBoost.Computebut these will automatically be checked out during the compilation stage.

ArrayFire graphics library

Required:

  • libglfw-dev (>=3.1.4)
  • libfontconfig1-dev
sudo apt-get install libglfw3-dev libfontconfig1-dev

NOTE: If your system does not havelibglfw3, on Debian / Ubuntu based systems you can install it to a system directory or use the followingppa

sudo apt-add-repository ppa:keithw/glfw3sudo apt-get updatesudo apt-get install libglfw3

For other distributions / OS you canbuild it from source.

Getting ArrayFire

To build ArrayFire, first clone the repository with the--recursive flag in order to grab the necessary submodules for the project:

git clone --recursive https://github.com/arrayfire/arrayfire.git

In order to build ArrayFire, you must first check out the ArrayFire source and ensure that the submodules are up to date. You can do these steps using the following commands:

Building ArrayFire

CMake Options:

OptionsDescritionDefault
AF_BUILD_CPUEnable CPU backendON
AF_BUILD_CUDAEnable CUDA backendON1
AF_BUILD_OPENCLEnable OpenCL backendON2
AF_BUILD_ONEAPIEnable OneAPI backendOFF
AF_BUILD_EXAMPLESBuild examplesON
BUILD_TESTINGBuild testsON
CMAKE_BUILD_TYPESet build type
AF_COMPUTE_LIBRARYSet BLAS backendIntel-MKL

AF_COMPUTE_LIBRARY can take one of the following strings:

  • Intel-MKL

  • FFTW/LAPACK/BLASPlease ensure to have corresponding dependencies installed as mentioned earlier. Intel MKL can be installed using the oneAPI toolkit installation executables.

  • 1 If CUDA toolkit is found.

  • 2 If OpenCL libraries are found.

Commands:

cd /path/to/dir/arrayfiremkdir build&&cd buildcmake .. -DCMAKE_BUILD_TYPE=Releasemake -j8# or number of threads of your choosing

Installing ArrayFire

The default installation prefix is/usr/local. That is, 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

Make sure your compiler is compatible with the CUDA toolkit you are going to target. If your default compiler is not compatible with nvcc, you can set the CUDA_HOST_COMPILER CMake variable to target a different compiler on the system.

For example on Arch Linux, you can install gcc7 and configure CMake with the following command:

cmake -DCMAKE_HOST_COMPILER=/usr/bin/gcc-7 ..

Then runmake install (sudo is installing to system directories).

Running Tests and Examples

Run tests:

cd /path/to/dir/arrayfire/build# Choose you preferred commandmaketest# runs all testctest# runs all testctest -R substring# runs all tests that match the substringCTEST_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/directory/example_backend

Packaging

The ArrayFire source code also includes support for CPack, an automatic packagescript from CMake. On Linux, CPack will build a self-extracting.sh installers.You can call:

For a DEB file, run the following command

cpack -G DEB

For a RPM, run the following command

cpack -G RPM

Note: For RPM, therpm package is required.

Clone this wiki locally

[8]ページ先頭

©2009-2025 Movatter.jp