Skip to content

Latest commit

 

History

History
149 lines (120 loc) · 4.94 KB

INSTALL.md

File metadata and controls

149 lines (120 loc) · 4.94 KB

Installation

Binary packages can be found here.

On Ubuntu

Download the Debian package and run sudo dpkg -i hipacc_<version>_amd64.deb.

On Windows

Download and run the installer Hipacc-<version>-win64.exe.

Run Samples

On Ubuntu

Open a terminal and run:

cp -r /usr/local/hipacc/samples .
cd samples/1_Local_Operators/Box_Blur
# Compile and run
make
# Compile and run for CUDA
make cuda

On Windows

With Visual Studio 2015 and 2017

Navigate to sample directory %HIPACC_PATH%\samples\1_Local_Operators\Box_Blur, open the project sample.vcxproj, and run build.

With Visual C++ Build Tools 2015

To run the samples without Visual Studio, install the latest Windows SDK and VC++ 2015 toolset provided by Build Tools for Visual Studio 2017. Open PowerShell and run:

cp -r "$Env:HIPACC_PATH\samples" .
cd .\samples\1_Local_Operators\Box_Blur
# Compile and run
.\make.bat
# Compile and run for CUDA
.\make.bat cuda

Build from Source

To build Hipacc from source, either the development packages of Clang/LLVM and libc++ are required, or the corresponding components from Clang/LLVM have to be manually installed.

Get the Sources

The revision to checkout <rev> can be found in dependencies.sh. In the following, all sources are cloned to directory <SRC>:

cd <SRC>

# Get Hipacc
git clone --recursive https://github.com/hipacc/hipacc.git

# Get libc++
git clone --branch <rev> https://llvm.org/git/libcxx.git

# Get LLVM
git clone --branch <rev> https://llvm.org/git/llvm.git

# Get Clang
cd <SRC>/llvm/tools
git clone --branch <rev> https://llvm.org/git/clang.git

Compile the Sources

The build system of Hipacc uses CMake (3.4.3 or later), Git (2.7 or later), and requires installation to an absolute path. To configure Hipacc, call cmake in the root directory. A working installation of Clang/LLVM (and Polly) is required. The llvm-config tool will be used to determine the configuration for Hipacc and must be present in the environment.

The following variables can be set to configure the Hipacc installation:

Variable Meaning
CMAKE_BUILD_TYPE Build type (Debug or Release)
CMAKE_INSTALL_PREFIX Installation prefix (this must be an absolute path)

For OpenCL, the installation location can be specified:

Variable Meaning
OpenCL_INCLUDE_DIR OpenCL include path (e.g. /usr/local/cuda/include)
OpenCL_LIBRARY OpenCL library path (e.g. /usr/lib64/libOpenCL.so)

The following options can be enabled or disabled:

Variable Meaning
USE_JIT_ESTIMATE Use JIT compilation to get resource estimates (unavailable for macOS)

In the following, all binaries will be installed to <DST>.

On GNU/Linux and macOS

Note that Xcode and the command line tools are required to build Hipacc on macOS (use xcode-select --install to install command line tools). When configuring LLVM on macOS, the default sysroot (DEFAULT_SYSROOT) path must be set to `xcrun --sdk macosx --show-sdk-path`.

# Compile Clang/LLVM on GNU/Linux
mkdir <SRC>/llvm/build && cd <SRC>/llvm/build
cmake .. -DCMAKE_INSTALL_PREFIX=<DST>
make install

# Compile Clang/LLVM on macOS
mkdir <SRC>/llvm/build && cd <SRC>/llvm/build
cmake .. -DCMAKE_INSTALL_PREFIX=<DST> -DDEFAULT_SYSROOT=`xcrun --sdk macosx --show-sdk-path`
make install

# Compile libc++
mkdir <SRC>/libcxx/build && cd <SRC>/libcxx/build
cmake .. -DCMAKE_INSTALL_PREFIX=<DST>
make install

# Make sure previously built 'llvm-config' is present in PATH
export PATH=<DST>/bin:$PATH

# Compile Hipacc
mkdir <SRC>/hipacc/build && cd <SRC>/hipacc/build
cmake .. -DCMAKE_INSTALL_PREFIX=<DST>
make install

On Windows

Compiling on Windows requires Visual Studio 2015. Furthermore, download Python and install it to <PYTHON_DIR>.

# Compile Clang/LLVM
mkdir <SRC>\llvm\build; cd <SRC>\llvm\build
cmake.exe .. -G "Visual Studio 14 2015 Win64" -Thost=x64 -DCMAKE_INSTALL_PREFIX="<DST>" -DPYTHON_EXECUTABLE="<PYTHON_DIR>\python.exe"
cmake.exe --build . --target INSTALL

# Install LLVM-vs2014 platform toolset
<DST>\tools\msbuild\install.bat
reg.exe add HKLM\SOFTWARE\WOW6432Node\LLVM\LLVM /t REG_SZ /d "<DST>"

# Compile libc++
mkdir <SRC>\libcxx\build; cd <SRC>\libcxx\build
cmake.exe .. -G "Visual Studio 14 2015 Win64" -T "LLVM-vs2014" -DCMAKE_INSTALL_PREFIX="<DST>" -DLIBCXX_ENABLE_SHARED=YES -DLIBCXX_ENABLE_STATIC=NO -DLIBCXX_ENABLE_EXPERIMENTAL_LIBRARY=NO
cmake.exe --build . --target INSTALL

# Compile Hipacc
mkdir <SRC>\hipacc\build; cd <SRC>\hipacc\build
cmake.exe .. -G "Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX="<DST>"
cmake.exe --build . --target INSTALL