From d01e9482ae6878865ae8a2781e6a121b0f845a8a Mon Sep 17 00:00:00 2001 From: Maneesh Gupta Date: Tue, 24 May 2016 12:37:18 +0530 Subject: [PATCH] Move hipify-clang info to its own README Squashed commit of the following: commit bc44bcee461e46b0cf5cb9fe09213dca450b081a Author: Daniil Fukalov Date: Mon May 16 20:50:05 2016 +0300 added note about errors without CUDA sdk installed commit 5fd73ba90c0940bdc977737894362a99f4232b56 Author: Daniil Fukalov Date: Mon May 16 20:31:47 2016 +0300 move clang-hipify info to its own README commit 21d81a6d5acd3f093d77ac4d584e6f5bbe48f8cc Author: Daniil Fukalov Date: Mon May 16 20:30:00 2016 +0300 initial version Change-Id: I157294699a7be3d0bb38b2ee4a137a94280529c9 [ROCm/clr commit: be0d44bd741d8009fe964040af150bc7f44d3b21] --- projects/clr/hipamd/INSTALL.md | 43 -------------------- projects/clr/hipamd/clang-hipify/README.md | 46 ++++++++++++++++++++++ 2 files changed, 46 insertions(+), 43 deletions(-) create mode 100644 projects/clr/hipamd/clang-hipify/README.md diff --git a/projects/clr/hipamd/INSTALL.md b/projects/clr/hipamd/INSTALL.md index dccbee2995..0b05a11f6b 100644 --- a/projects/clr/hipamd/INSTALL.md +++ b/projects/clr/hipamd/INSTALL.md @@ -11,9 +11,6 @@ - [HCC Options](#hcc-options) - [Using HIP with the AMD Native-GCN compiler.](#using-hip-with-the-amd-native-gcn-compiler) - [Compiling CodeXL markers for HIP Functions](#compiling-codexl-markers-for-hip-functions) - - [Using clang-hipify](#using-clang-hipify) - - [Building](#building) - - [Running and using clang-hipify](#running-and-using-clang-hipify) @@ -147,43 +144,3 @@ HIP_TRACE_API=1 HIP_DB=0x2 ./myHipApp ``` Note this trace mode uses colors. "less -r" can handle raw control characters and will display the debug output in proper colors. - - -### Using clang-hipify - -Clang-hipify is a clang-based tool which can automate the translation of CUDA source code into portable HIP C++. -The clang-hipify tool can automatically add extra HIP arguments (notably the "hipLaunchParm" required at the -beginning of every HIP kernel call). Clang-hipify has some additional dependencies explained below and -can be built as a separate make step. - - -#### Building - -1. Download and unpack clang+llvm 3.8 binary package preqrequisite: -``` -wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz -``` - -2. Enable build of clang-hipify and specify path to LLVM: -Note LLVM_DIR must be a full absolute path (not relative) to the location extracted above. Here's an example assuming we -extract the clang 3.8 package into ~/HIP-privatestaging/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/. -``` -cd HIP-privatestaging -mkdir build.clang-hipify -cd build.clang-hipify -cmake -DBUILD_CLANG_HIPIFY=1 -DLLVM_DIR=~/HIP-privatestaging/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ -DCMAKE_BUILD_TYPE=Release .. -make -make install -``` - -#### Running and using clang-hipify -clang-hipify performs an initial compile of the CUDA source code into a "symbol tree", and thus needs access to the appropriate header files: - 1. Download "deb(network)" variant of target installer from https://developer.nvidia.com/cuda-downloads. The commands below show how to download and install a recent version from the http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb. - -``` -wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb -sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb -sudo apt-get update && sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5 -``` - diff --git a/projects/clr/hipamd/clang-hipify/README.md b/projects/clr/hipamd/clang-hipify/README.md new file mode 100644 index 0000000000..6ea9e4a7a7 --- /dev/null +++ b/projects/clr/hipamd/clang-hipify/README.md @@ -0,0 +1,46 @@ +## Using hipify-clang + +`hipify-clang` is a clang-based tool which can automate the translation of CUDA source code into portable HIP C++. +The tool can automatically add extra HIP arguments (notably the "hipLaunchParm" required at the beginning of every HIP kernel call). +`hipify-clang` has some additional dependencies explained below and can be built as a separate make step. The instructions below are specifically for **Ubuntu 14.04** + +### Build and install + +- Download and unpack clang+llvm 3.8 binary package preqrequisite. +```shell +wget http://llvm.org/releases/3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +tar xvfJ clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz +``` + +- Enable build of hipify-clang and specify path to LLVM. + +Note LLVM_DIR must be a full absolute path to the location extracted above. Here's an example assuming we extract the clang 3.8 package into ~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ +```shell +cd HIP +mkdir build +cd build +cmake -DBUILD_CLANG_HIPIFY=1 -DLLVM_DIR=~/HIP/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-14.04/ -DCMAKE_BUILD_TYPE=Release .. +make +make install +``` + +### Running and using hipify-clang + +`hipify-clang` performs an initial compile of the CUDA source code into a "symbol tree", and thus needs access to the appropriate header files. + +In the case when `hipify-clang` doesn't find cuda headers, it reports various errors about unknown keywords (e.g. '\__global\__'), API function names (e.g. 'cudaMalloc'), syntax (e.g. 'foo<<<1,n>>>(...)'), etc. + +To install CUDA headers, download the "deb(network)" variant of the target installer from https://developer.nvidia.com/cuda-downloads. The commands below show how to download and install a recent version from http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb. +```shell +wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1404/x86_64/cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo dpkg -i cuda-repo-ubuntu1404_7.5-18_amd64.deb +sudo apt-get update && sudo apt-get install cuda-minimal-build-7-5 cuda-curand-dev-7-5 +``` + +#### Disclaimer + +The information contained herein is for informational purposes only, and is subject to change without notice. While every precaution has been taken in the preparation of this document, it may contain technical inaccuracies, omissions and typographical errors, and AMD is under no obligation to update or otherwise correct this information. Advanced Micro Devices, Inc. makes no representations or warranties with respect to the accuracy or completeness of the contents of this document, and assumes no liability of any kind, including the implied warranties of noninfringement, merchantability or fitness for particular purposes, with respect to the operation or use of AMD hardware, software or other products described herein. No license, including implied or arising by estoppel, to any intellectual property rights is granted by this document. Terms and limitations applicable to the purchase or use of AMD's products are as set forth in a signed agreement between the parties or in AMD's Standard Terms and Conditions of Sale. + +AMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc. Other product names used in this publication are for identification purposes only and may be trademarks of their respective companies. + +Copyright (c) 2014-2016 Advanced Micro Devices, Inc. All rights reserved. \ No newline at end of file