HIPAcc is a source-to-source compiler based on Clang/LLVM. To build HIPAcc from source, either the development package of Clang/LLVM and libc++ is required, or the corresponding components from the Clang/LLVM have to be installed manually:
- libc++abi (on GNU/Linux when using Clang as target compiler)
- polly (optional)
HIPAcc works only with the release version of Clang/LLVM listed in dependencies.sh, which corresponds to the current Clang/LLVM 3.8 release version.
WindowsWhile HIPAcc is mainly developed under GNU Linux and macOS, it compiles and runs under Windows as well. Use msys2 to compile HIPAcc on Windows. Make sure that development packages are installed. The source files generated by HIPAcc can then be compiled in Visual Studio.
The build system of HIPAcc uses CMake (2.8.12 or later) and requires installation to an absolute path:
cd hipacc mkdir build && cd build cmake ../ -DCMAKE_INSTALL_PREFIX=`pwd`/release make && make installNote that Xcode and the command line tools are required to build HIPAcc on macOS (use xcode-select --install to install command line tools).
A list of CMake options that are used by HIPAcc to find headers and libraries for its various back ends (CUDA, OpenCL, and Renderscript) can be found in the INSTALL file.
After building and installing HIPAcc successfully, you are ready to use HIPAcc. To verify that everything is working, generate and execute a program using HIPAcc. Go to your installation directory and call
make cuda. This translates the source file specified by the
TEST_CASE environment variable into a version that runs on the GPU using CUDA and executes it. Similarly, the same program can be translated to OpenCL for different device types (
opencl-gpu) as well as standard C++ code (
cpu). For execution on Android, Renderscript (
renderscript) and Filterscript (
filterscript) code can be generated.
cd hipacc/build/release TEST_CASE=tests/opencv_gaussian_8uc1 make cuda ./main_cuda
For execution on Android devices, the generated binary is configured to store data in
/data/local/tmp. The same directory can be used for the binary itself:
adb shell mkdir -p /data/local/tmp adb push main_renderscript /data/local/tmp adb shell /data/local/tmp/main_renderscript