From 2cf077c41ae6b466f003c41eba84b87307832ca8 Mon Sep 17 00:00:00 2001 From: hiaselhans Date: Sun, 22 Mar 2020 15:55:33 +0100 Subject: [PATCH 1/2] [SYCL][DOC] update docs to reflect devicelib change describe the use of buildbot scripts in GetStartedGuide.md * use configure.py and compile.py * describe common flags * remove unacessible opencl-aot flags (->enabled by default) * add cross reference to buildbot configuration script * set DPCPP_HOME to ~/sycl_workspace in unix Signed-off-by: hiaselhans --- sycl/doc/GetStartedGuide.md | 84 ++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 49 deletions(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index f7de12125cc03..ede3e5bb181ac 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -36,11 +36,16 @@ Throughout this document `DPCPP_HOME` denotes the path to the local directory created as DPC++ workspace. It might be useful to create an environment variable with the same name. + **Linux** ```bash -export DPCPP_HOME=/export/home/sycl_workspace -mkdir $DPCPP_HOME +export DPCPP_HOME=~/sycl_workspace +mkdir -p $DPCPP_HOME/build +cd $DPCPP_HOME + +git clone https://github.com/intel/llvm -b sycl +cd $DPCPP_HOME/build ``` **Windows (64-bit)** @@ -55,55 +60,49 @@ Open a developer command prompt using one of two methods: ```bat set DPCPP_HOME=%USERPROFILE%\sycl_workspace mkdir %DPCPP_HOME% +cd %DPCPP_HOME% + +git clone https://github.com/intel/llvm -b sycl +mkdir %DPCPP_HOME%\build +cd %DPCPP_HOME%\build ``` # Build DPC++ toolchain -**Linux** -```bash -cd $DPCPP_HOME -git clone https://github.com/intel/llvm -b sycl -mkdir $DPCPP_HOME/build -cd $DPCPP_HOME/build +The easiest way to get started is to use the buildbot [configure](../../buildbot/configure.py) +and [compile](../../buildbot/configure.py) scripts. -cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" \ --DLLVM_EXTERNAL_PROJECTS="llvm-spirv;sycl" \ --DLLVM_ENABLE_PROJECTS="clang;llvm-spirv;sycl" \ --DLLVM_EXTERNAL_SYCL_SOURCE_DIR=$DPCPP_HOME/llvm/sycl \ --DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=$DPCPP_HOME/llvm/llvm-spirv \ -$DPCPP_HOME/llvm/llvm +In case you want to configure Cmake manually the up-to-date reference for variables is in these files. -make -j`nproc` sycl-toolchain +**Linux** + +```bash +python $DPCPP_HOME/llvm/buildbot/configure.py -s $DPCPP_HOME/llvm -o $DPCPP_HOME/build -t release +python $DPCPP_HOME/llvm/buildbot/compile.py -s $DPCPP_HOME/llvm -o $DPCPP_HOME/build ``` -**Windows (64-bit)** +**Windows** + ```bat -cd %DPCPP_HOME% -git clone https://github.com/intel/llvm -b sycl -mkdir %DPCPP_HOME%\build -cd %DPCPP_HOME%\build +python %DPCPP_HOME%\llvm\buildbot\configure.py -s %DPCPP_HOME%\llvm -o %DPCPP_HOME%\build -t release +python %DPCPP_HOME%\llvm\buildbot\compile.py -s %DPCPP_HOME%\llvm -o %DPCPP_HOME%\build +``` -cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DLLVM_TARGETS_TO_BUILD="X86" ^ --DLLVM_EXTERNAL_PROJECTS="llvm-spirv;sycl" ^ --DLLVM_ENABLE_PROJECTS="clang;llvm-spirv;sycl" ^ --DLLVM_EXTERNAL_SYCL_SOURCE_DIR="%DPCPP_HOME%\llvm\sycl" ^ --DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR="%DPCPP_HOME%\llvm\llvm-spirv" ^ --DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl ^ -"%DPCPP_HOME%\llvm\llvm" +**Options** -ninja sycl-toolchain -``` +You can use the following flags with `configure.py`: -To use ahead-of-time compilation for the Intel® processors, additionally -build opencl-aot target: + * `--no-ocl` -> Download OpenCL deps via cmake (can be useful in case of troubles) + * `--cuda` -> use the cuda backend (see [Nvidia CUDA](#build-dpc-toolchain-with-support-for-nvidia-cuda)) + * `--shared-libs` -> Build shared libraries + * `-t` -> Build type (debug or release) -1. add ```opencl-aot``` to ```-DLLVM_EXTERNAL_PROJECTS``` and -```-DLLVM_ENABLE_PROJECTS``` variables above -2. add ```opencl-aot``` to -```make``` (for Linux) or ```ninja``` (for Windows) commands above +Ahead-of-time compilation for the Intel® processors is enabled by default. For more, see [opencl-aot documentation](../../opencl-aot/README.md). +**Deployment** + TODO: add instructions how to deploy built DPC++ toolchain. ## Build DPC++ toolchain with libc++ library @@ -124,20 +123,7 @@ should be used. There is experimental support for DPC++ for CUDA devices. To enable support for CUDA devices, follow the instructions for the Linux -DPC++ toolchain, but replace the cmake command with the following one: - - -``` -cmake -DCMAKE_BUILD_TYPE=Release \ --DLLVM_EXTERNAL_PROJECTS="llvm-spirv;sycl" \ --DLLVM_EXTERNAL_SYCL_SOURCE_DIR=$DPCPP_HOME/llvm/sycl \ --DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=$DPCPP_HOME/llvm/llvm-spirv \ --DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda/ \ --DLLVM_ENABLE_PROJECTS="clang;llvm-spirv;sycl;libclc" \ --DSYCL_BUILD_PI_CUDA=ON \ --DLLVM_TARGETS_TO_BUILD="X86;NVPTX" \ --DLIBCLC_TARGETS_TO_BUILD="nvptx64--;nvptx64--nvidiacl" -``` +DPC++ toolchain, but add the `--cuda` flag to `configure.py` Enabling this flag requires an installation of [CUDA 10.1](https://developer.nvidia.com/cuda-10.1-download-archive-update2) on the system, From 55b08968a05637905883ab839df839c9c890d74e Mon Sep 17 00:00:00 2001 From: hiaselhans Date: Mon, 23 Mar 2020 16:59:39 +0100 Subject: [PATCH 2/2] fix typos Signed-off-by: hiaselhans --- sycl/doc/GetStartedGuide.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sycl/doc/GetStartedGuide.md b/sycl/doc/GetStartedGuide.md index ede3e5bb181ac..bf485dc57168d 100644 --- a/sycl/doc/GetStartedGuide.md +++ b/sycl/doc/GetStartedGuide.md @@ -36,7 +36,6 @@ Throughout this document `DPCPP_HOME` denotes the path to the local directory created as DPC++ workspace. It might be useful to create an environment variable with the same name. - **Linux** ```bash @@ -72,7 +71,7 @@ cd %DPCPP_HOME%\build The easiest way to get started is to use the buildbot [configure](../../buildbot/configure.py) and [compile](../../buildbot/configure.py) scripts. -In case you want to configure Cmake manually the up-to-date reference for variables is in these files. +In case you want to configure CMake manually the up-to-date reference for variables is in these files. **Linux**