- passing DPC++ include path is not required for -fsycl compilations
- cleanups to minimal tutorial CMakeList.txt
This commit is contained in:
@@ -90,10 +90,6 @@ To properly compile your SYCL application you have to add additional
|
||||
SYCL compile flags for each C++ file that contains SYCL device side
|
||||
code or kernels.
|
||||
|
||||
For the oneAPI DPC++ compiler to properly find SYCL headers, you need
|
||||
to add these compile options:
|
||||
|
||||
-isystem path_to_dpcpp_compiler/include -isystem path_to_dpcpp_compiler/include/sycl
|
||||
|
||||
### JIT Compilation
|
||||
|
||||
|
||||
+12
-13
@@ -5,11 +5,11 @@ This folder contains sources of the Embree tutorials for illustration
|
||||
purposes of the API. Follow the next sections to compile the
|
||||
tutorials.
|
||||
|
||||
Compilation under Windows using DPC++
|
||||
Compilation under Windows using SYCL
|
||||
-------------------------------------
|
||||
|
||||
Install one of the DPC++ compilers supported by Embree, see section
|
||||
[Compiling Embree / with DPC++ under Windows] of the Embree
|
||||
Install one of the SYCL compilers supported by Embree, see section
|
||||
[Compiling Embree / Windows SYCL Compilation] of the Embree
|
||||
documentation.
|
||||
|
||||
Then open some "x64 Native Tools Command Prompt" of Visual Studio and
|
||||
@@ -26,7 +26,7 @@ use the DPC++ compiler:
|
||||
Now download and unpack some recent TBB version for Windows, e.g. oneTBB 2021.2.0:
|
||||
|
||||
https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-win.zip
|
||||
|
||||
|
||||
To compile tutorials contained in this folder first create and enter a
|
||||
build folder inside the tutorial you want to compile. E.g. for the
|
||||
minimal tutorial execute:
|
||||
@@ -41,11 +41,9 @@ the Embree and TBB installation on your system.
|
||||
cmake -G Ninja
|
||||
-D CMAKE_CXX_COMPILER=clang++
|
||||
-D CMAKE_C_COMPILER=clang
|
||||
-D CMAKE_CXX_FLAGS=-fuse-ld=link
|
||||
-D CMAKE_C_FLAGS=-fuse-ld=link
|
||||
-D CMAKE_BUILD_TYPE=Release
|
||||
-D embree_DIR=%cd%\..\..\..\lib\cmake\embree-@EMBREE_VERSION@\
|
||||
-D TBB_DIR=path_to_tbb\lib\cmake\tbb ..
|
||||
-D TBB_DIR=path_to_tbb\oneapi-tbb-2021.2.0\lib\cmake\tbb ..
|
||||
|
||||
Now you can build the tutorial:
|
||||
|
||||
@@ -62,21 +60,22 @@ Now you can run the tutorial:
|
||||
.\minimal_sycl.exe
|
||||
|
||||
|
||||
Compilation under Linux using DPC++
|
||||
Compilation under Linux using SYCL
|
||||
-----------------------------------
|
||||
|
||||
Install one of the DPC++ compilers supported by Embree, see section
|
||||
[Compiling Embree / with DPC++ under Linux] of the Embree
|
||||
Install one of the SYCL compilers supported by Embree, see section
|
||||
[Compiling Embree / Linux SYCL Compilation] of the Embree
|
||||
documentation.
|
||||
|
||||
To properly configure your environment, you have to source the
|
||||
`startup.sh` of the unpacked DPC++ compiler:
|
||||
|
||||
source dpcpp_dir/startup.sh
|
||||
source dpcpp_compiler/startup.sh
|
||||
|
||||
Now download and unpack some recent TBB version for Linux, e.g. oneTBB 2021.2.0:
|
||||
|
||||
https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-lin.tgz
|
||||
wget https://github.com/oneapi-src/oneTBB/releases/download/v2021.2.0/oneapi-tbb-2021.2.0-lin.tgz
|
||||
tar xzf oneapi-tbb-2021.2.0-lin.tgz
|
||||
|
||||
To compile tutorials contained in this folder first create and enter a
|
||||
build folder inside the tutorial you want to compile. E.g. for the
|
||||
@@ -93,7 +92,7 @@ the Embree and TBB installation on your system.
|
||||
-D CMAKE_CXX_COMPILER=clang++ \
|
||||
-D CMAKE_C_COMPILER=clang \
|
||||
-D embree_DIR=`pwd`/../../../lib/cmake/embree-@EMBREE_VERSION@/ \
|
||||
-D TBB_DIR=path_to_tbb_install ..
|
||||
-D TBB_DIR=path_to_tbb/oneapi-tbb-2021.2.0/lib/cmake/tbb/ ..
|
||||
|
||||
Now you can build the tutorial:
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ ENDIF()
|
||||
|
||||
ADD_EXECUTABLE(minimal minimal.cpp)
|
||||
TARGET_LINK_LIBRARIES(minimal embree)
|
||||
|
||||
SET_PROPERTY(TARGET minimal PROPERTY FOLDER tutorials/single)
|
||||
INSTALL(TARGETS minimal DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT examples)
|
||||
INSTALL(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" DESTINATION "src" COMPONENT examples)
|
||||
@@ -23,38 +24,15 @@ ENDIF()
|
||||
|
||||
IF (EMBREE_SYCL_SUPPORT)
|
||||
|
||||
# with current public drivers, JIT works under Windows and AOT under Linux
|
||||
IF (NOT DEFINED EMBREE_SYCL_AOT_DEVICES)
|
||||
IF (WIN32)
|
||||
SET(EMBREE_SYCL_AOT_DEVICES "none")
|
||||
ELSE()
|
||||
SET(EMBREE_SYCL_AOT_DEVICES "dg2")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# JIT mode compile flags
|
||||
IF(EMBREE_SYCL_AOT_DEVICES STREQUAL "none")
|
||||
SET(SYCL_COMPILE_FLAGS "-fsycl -Xclang -fsycl-allow-func-ptr -fsycl-targets=spir64")
|
||||
SET(SYCL_LINK_FLAGS "-lsycl -fsycl -fsycl-targets=spir64 -Xsycl-target-backend=spir64 \" -options \\\"-cl-intel-force-global-mem-allocation -cl-intel-no-local-to-generic\\\" \"")
|
||||
|
||||
# AOT mode compile flags
|
||||
ELSE()
|
||||
SET(SYCL_COMPILE_FLAGS "-fsycl -Xclang -fsycl-allow-func-ptr -fsycl-targets=spir64_gen")
|
||||
SET(SYCL_LINK_FLAGS "-lsycl -fsycl -fsycl-targets=spir64_gen -Xsycl-target-backend=spir64_gen \"-device ${EMBREE_SYCL_AOT_DEVICES} -revision_id 4 -options \\\"-cl-intel-force-global-mem-allocation -cl-intel-no-local-to-generic\\\" \"")
|
||||
ENDIF()
|
||||
|
||||
GET_FILENAME_COMPONENT(SYCL_COMPILER_DIR ${CMAKE_CXX_COMPILER} PATH)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -isystem ${SYCL_COMPILER_DIR}/../include/sycl -isystem ${SYCL_COMPILER_DIR}/../include/")
|
||||
|
||||
ADD_EXECUTABLE(minimal_sycl minimal_sycl.cpp)
|
||||
TARGET_LINK_LIBRARIES(minimal_sycl embree)
|
||||
SET_PROPERTY(TARGET minimal_sycl APPEND PROPERTY COMPILE_FLAGS ${SYCL_COMPILE_FLAGS})
|
||||
SET_PROPERTY(TARGET minimal_sycl APPEND PROPERTY LINK_FLAGS ${SYCL_LINK_FLAGS})
|
||||
TARGET_COMPILE_DEFINITIONS(minimal_sycl PUBLIC EMBREE_SYCL_TUTORIAL)
|
||||
SET_PROPERTY(TARGET minimal_sycl APPEND PROPERTY COMPILE_FLAGS "-fsycl -Xclang -fsycl-allow-func-ptr -fsycl-targets=spir64")
|
||||
SET_PROPERTY(TARGET minimal_sycl APPEND PROPERTY LINK_FLAGS "-lsycl -fsycl -fsycl-targets=spir64")
|
||||
|
||||
SET_PROPERTY(TARGET minimal_sycl PROPERTY FOLDER tutorials/sycl)
|
||||
INSTALL(TARGETS minimal_sycl DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT examples)
|
||||
IF (COMMAND SIGN_TARGET)
|
||||
SIGN_TARGET(minimal_sycl)
|
||||
ENDIF()
|
||||
|
||||
ENDIF()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user