Skip to content

[SYCL][DOC] Update docs to reflect devicelib change #1368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 34 additions & 49 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,12 @@ 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)**
Expand All @@ -55,55 +59,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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we really want to do this. But shallow clone would dramatically decrease download times for those who just want's to build the latest version (instead of working on new features/bugfixes).

Suggested change
git clone https://github.com/intel/llvm -b sycl
git clone --depth 1 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.

In case you want to configure CMake manually the up-to-date reference for variables is in these files.

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
**Linux**

make -j`nproc` sycl-toolchain
```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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need a particular python version? Does it work with python3?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i never tried on windows, but in my linux python3 is default and works.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ruyk @hiaselhans I don't see anything version-specific in those scripts. I believe both versions are supported. And they definitely work with Python 3, as it's part of CI pipeline.

```

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
Expand All @@ -124,20 +122,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,
Expand Down