Skip to content

Commit 4076911

Browse files
IRTK 2024.0 fixes for Tutorials/IntroToRayTracingWithEmbree (CPU and GPU) (#2008)
* IRTK 2024.0 embree IntroToRayTracing: stb and flat directory fixes Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> * IRTK 2024.0 flat dir updates for IntroToRayTracingWithEmbree GPU Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> --------- Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> Co-authored-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu>
1 parent 66a69be commit 4076911

File tree

5 files changed

+102
-43
lines changed

5 files changed

+102
-43
lines changed

RenderingToolkit/Tutorial/IntroToRayTracingWithEmbree/cpu/CMakeLists.txt

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,43 @@ if(DEFINED ENV{ONEAPI_ROOT})
66
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
77
message(STATUS "ONEAPI_ROOT FROM ENVIRONMENT: ${ONEAPI_ROOT}")
88
else()
9-
if(WIN32)
10-
set(ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI")
11-
else()
12-
set(ONEAPI_ROOT /opt/intel/oneapi)
13-
endif()
14-
message(STATUS "ONEAPI_ROOT DEFAULT: ${ONEAPI_ROOT}")
9+
message(FATAL_ERROR "ONEAPI_ROOT not set. Please use a vars script (.bat/.sh) from the oneAPI deployment directory")
1510
endif(DEFINED ENV{ONEAPI_ROOT})
1611

12+
set(EMBREE_BASE_DIR "")
13+
set(RKCOMMON_BASE_DIR "")
14+
set(TBB_BASE_DIR "")
15+
set(DEVUTILITIES_BASE_DIR "")
16+
set(COMPILERRUNTIMES_BASE_DIR "")
17+
set(PATHADDITIONS_DIRS "")
18+
if(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
19+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT})
20+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT})
21+
set(TBB_BASE_DIR ${ONEAPI_ROOT})
22+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT})
23+
#Compiler runtimes help for windows MSVS debugger DLL help only
24+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT})
25+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${ONEAPI_ROOT}/bin")
26+
else()
27+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT}/embree/latest)
28+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT}/rkcommon/latest)
29+
set(TBB_BASE_DIR ${ONEAPI_ROOT}/tbb/latest)
30+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT}/dev-utilities/latest)
31+
#Compiler runtimes help for windows MSVS debugger DLL help only
32+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT}/compiler/latest)
33+
endif(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
34+
1735
#tbb is used for tasking in this example
18-
find_package(TBB REQUIRED PATHS ${ONEAPI_ROOT})
36+
find_package(TBB REQUIRED PATHS ${TBB_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
1937

20-
find_package(embree 4.0 REQUIRED PATHS ${ONEAPI_ROOT})
38+
find_package(embree 4.0 REQUIRED PATHS ${EMBREE_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
2139

2240
#rkcommon objects for rendering are used in this example
23-
find_package(rkcommon REQUIRED CONFIG PATHS ${ONEAPI_ROOT}/rkcommon/latest/lib/cmake)
41+
find_package(rkcommon REQUIRED CONFIG PATHS ${RKCOMMON_BASE_DIR}/lib/cmake NO_DEFAULT_PATH)
42+
43+
if(PATHADDITIONS_DIRS STREQUAL "")
44+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${COMPILERRUNTIMES_BASE_DIR}/bin;${embree_DIR}/../../../bin;${rkcommon_DIR}/../../../bin;${tbb_DIR}/../../../bin;")
45+
endif(PATHADDITIONS_DIRS STREQUAL "")
2446

2547
if(MSVC)
2648
set(CMAKE_CXX_STANDARD 11)
@@ -40,15 +62,16 @@ if (NOT CMAKE_BUILD_TYPE)
4062
endif(NOT CMAKE_BUILD_TYPE)
4163
endif(NOT MSVC)
4264

43-
#stb headers are located in dev-utilities. oneAPI 2022.2 release and earlier: these header only libraries are distributed with the oneAPI Base Toolkit.
44-
include_directories(${ONEAPI_ROOT}/dev-utilities/latest/include)
65+
#stb headers are located in dev-utilities with the old oneAPI dires layout
66+
include_directories(${DEVUTILITIES_BASE_DIR}/include)
4567

4668
add_executable(rkRayTracer src/rkRayTracer.cpp)
4769
if(MSVC)
70+
message(STATUS "Using ${PATHADDITIONS_DIRS} for the MSVS Debugger env")
4871
# Set MSVS debugger environment variables so it is easier to attach the MSVS debugger after altering the application
49-
set_target_properties(rkRayTracer
50-
PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${embree_DIR}/../../../bin;${rkcommon_DIR}/../../../bin;${tbb_DIR}/../../../bin;"
51-
)
72+
set_target_properties(rkRayTracer
73+
PROPERTIES VS_DEBUGGER_ENVIRONMENT "${PATHADDITIONS_DIRS}"
74+
)
5275
endif(MSVC)
5376
target_link_libraries(rkRayTracer PRIVATE embree TBB::tbb rkcommon::rkcommon)
5477

RenderingToolkit/Tutorial/IntroToRayTracingWithEmbree/cpu/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ output](example_images/rkRayTracer.png)
2626

2727
| Minimum Requirements | Description
2828
|:--- |:---
29-
| OS | Linux* Ubuntu* 18.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 <br>macOS* 10.15+
29+
| OS | Linux* Ubuntu* 18.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 or 11<br>macOS* 10.15+
3030
| Hardware | Intel 64 Penryn or higher with SSE4.1 extensions; ARM64 with NEON extensions <br>(Optimization requirement: Intel&reg; Embree is further optimized for Intel 64 Skylake or higher with AVX512 extensions)
31-
| Compiler Toolchain | Windows* OS: MSVS 2019 or MSVS 2022 with Windows* SDK and CMake* <br>Other platforms: C++11 compiler and CMake*
32-
| Libraries | Install Intel&reg; oneAPI Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel® oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component
31+
| Compiler Toolchain | Windows* OS: MSVS 2022 or MSVS 2019 with Windows* SDK and CMake* <br>Other platforms: C++11 compiler and CMake*
32+
| Libraries | Install Intel&reg; Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel® oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component and Intel&reg; oneAPI DPC++ Compiler runtimes
3333
| Tools | .png capable image viewer
3434

3535
## Build and Run
3636

3737
### Windows*
3838

39-
Open a new x64 Native Command Prompt for VS 2019. Navigate to the source folder:
39+
Open a new x64 Native Command Prompt for VS 2022 (or 2019). Navigate to the source folder:
4040

4141
```
4242
cd <path-to-oneAPI-Samples>\RenderingToolkit\Tutorial\IntroToRayTracingWithEmbree\cpu
@@ -47,12 +47,12 @@ Build and Run the Application:
4747
call <path-to-oneAPI>\setvars.bat
4848
mkdir build
4949
cd build
50-
cmake -G"Visual Studio 16 2019" -A x64 ..
50+
cmake -G"Visual Studio 17 2022" -A x64 ..
5151
cmake --build . --config Release
5252
cd Release
5353
.\rkRayTracer.exe
5454
```
55-
**Note**: Visual Studio 2022 users should use the x64 NAtive Command Prompt for VS 2022 and `-G"Visual Studio 17 2022"`
55+
**Note**: Visual Studio 2019 users should use the x64 Native Command Prompt for VS 2019 and `-G"Visual Studio 16 2019"`
5656
generator flag.
5757

5858
Open the resulting image file: `rkRayTracer.png` with an image viewer.
@@ -643,7 +643,7 @@ features available with Intel&reg; Embree are best observed in the Intel&reg;
643643
Embree tutorial codes. These codes reside within the [Embree
644644
repository](https://github.com/embree/embree).
645645

646-
The Intel&reg; oneAPI Rendering Toolkit `rkRayTracer` sample
646+
The Intel&reg; Rendering Toolkit `rkRayTracer` sample
647647
forgoes use of the Embree common library found in the full codes. The Embree
648648
common library implements math, tasking, and system access routines that are
649649
common to rendering applications. The Intel&reg; Embree common library lives in

RenderingToolkit/Tutorial/IntroToRayTracingWithEmbree/gpu/CMakeLists.txt

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,39 @@ if(DEFINED ENV{ONEAPI_ROOT})
66
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
77
message(STATUS "ONEAPI_ROOT FROM ENVIRONMENT: ${ONEAPI_ROOT}")
88
else()
9-
if(WIN32)
10-
set(ONEAPI_ROOT "C:/Program Files (x86)/Intel/oneAPI")
11-
else()
12-
set(ONEAPI_ROOT /opt/intel/oneapi)
13-
endif()
14-
message(STATUS "ONEAPI_ROOT DEFAULT: ${ONEAPI_ROOT}")
9+
message(FATAL_ERROR "ONEAPI_ROOT not set. Please use a vars script (.bat/.sh) from the oneAPI deployment directory")
1510
endif(DEFINED ENV{ONEAPI_ROOT})
1611

12+
set(EMBREE_BASE_DIR "")
13+
set(RKCOMMON_BASE_DIR "")
14+
set(TBB_BASE_DIR "")
15+
set(DEVUTILITIES_BASE_DIR "")
16+
set(COMPILERRUNTIMES_BASE_DIR "")
17+
set(PATHADDITIONS_DIRS "")
18+
if(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
19+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT})
20+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT})
21+
set(TBB_BASE_DIR ${ONEAPI_ROOT})
22+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT})
23+
#Compiler runtimes help for windows MSVS debugger DLL help only
24+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT})
25+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${ONEAPI_ROOT}/bin")
26+
else()
27+
set(EMBREE_BASE_DIR ${ONEAPI_ROOT}/embree/latest)
28+
set(RKCOMMON_BASE_DIR ${ONEAPI_ROOT}/rkcommon/latest)
29+
set(TBB_BASE_DIR ${ONEAPI_ROOT}/tbb/latest)
30+
set(DEVUTILITIES_BASE_DIR ${ONEAPI_ROOT}/dev-utilities/latest)
31+
#Compiler runtimes help for windows MSVS debugger DLL help only
32+
set(COMPILERRUNTIMES_BASE_DIR ${ONEAPI_ROOT}/compiler/latest)
33+
endif(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
34+
1735
find_package(embree 4.0 REQUIRED PATHS ${ONEAPI_ROOT})
1836

19-
find_package(IntelDPCPP REQUIRED)
37+
find_package(IntelSYCL REQUIRED)
38+
39+
if(PATHADDITIONS_DIRS STREQUAL "")
40+
set(PATHADDITIONS_DIRS "PATH=%PATH%;${COMPILERRUNTIMES_BASE_DIR}/bin;${embree_DIR}/../../../bin;")
41+
endif(PATHADDITIONS_DIRS STREQUAL "")
2042

2143
#Required for SYCL implementation support
2244
set(CMAKE_CXX_STANDARD 17)
@@ -54,15 +76,15 @@ endif(NOT MSVC)
5476
endif(NOT MSVC)
5577

5678

57-
#stb headers are located in dev-utilities. oneAPI 2022.2 release and earlier: these header only libraries are distributed with the oneAPI Base Toolkit.
58-
include_directories(${ONEAPI_ROOT}/dev-utilities/latest/include)
79+
#stb headers are located in dev-utilities with the old oneAPI dirs layout
80+
include_directories(${DEVUTILITIES_BASE_DIR}/include)
5981
include_directories(SYSTEM "${SYCL_COMPILER_DIR}/../include/sycl" "${SYCL_COMPILER_DIR}/../include")
6082

6183
add_executable(rkRayTracerGPU src/rkRayTracerGPU.cpp)
6284
if(MSVC)
6385
# Set MSVS debugger environment variables so it is easier to attach the MSVS debugger after altering the application
6486
set_target_properties(rkRayTracerGPU
65-
PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;${embree_DIR}/../../../bin"
87+
PROPERTIES VS_DEBUGGER_ENVIRONMENT "${PATHADDITIONS_DIRS}"
6688
)
6789
endif(MSVC)
6890
target_link_libraries(rkRayTracerGPU PRIVATE embree)

RenderingToolkit/Tutorial/IntroToRayTracingWithEmbree/gpu/README.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ output](example_images/rkRayTracerGPU.png)
1919

2020
| Minimum Requirements | Description
2121
|:--- |:---
22-
| OS | Linux* Ubuntu* 22.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 <br>macOS* 10.15+
22+
| OS | Linux* Ubuntu* 22.04 <br>CentOS* 8 (or compatible) <br>Windows* 10 or 11<br>macOS* 10.15+
2323
| Hardware | Intel&reg; Arc Graphics (Xe-HPG architecture, DG2-128, DG2-512) or higher
24-
| Libraries | Install Intel&reg; oneAPI Rendering Toolkit (Render Kit) including Intel&reg; oneAPI DPC++ Compiler, Intel&reg; Embree, and Intel® oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component
25-
| SYCL Compiler | oneAPI DPC++ 2023.0.0 compiler or higher
26-
| Compiler Toolchain | Windows* OS: MSVS 2019 or MSVS 2022 with Windows* SDK and CMake* <br>Other platforms: C++17 compiler and CMake*
24+
| Libraries | Install Intel&reg; Rendering Toolkit (Render Kit) including Intel&reg; Embree, and Intel® oneAPI Threading Building Blocks (oneTBB) <br>Install Intel&reg; oneAPI Base Toolkit for the `dev-utilities` default component and Intel&reg; oneAPI DPC++ Compiler
25+
| SYCL Compiler | oneAPI DPC++ 2024.0.0 compiler or higher
26+
| Compiler Toolchain | Windows* OS: MSVS 2022 or MSVS 2019 with Windows* SDK and CMake* <br>Other platforms: C++17 compiler and CMake*
2727
| Tools | .png capable image viewer
2828
| Knowledge | First, build and run the IntroToRayTracingWithEmbree `rkRayTracer` [CPU](../cpu) sample program
2929

@@ -41,19 +41,22 @@ Open a new x64 Native Tools Command Prompt for VS 2022. Navigate to the source f
4141
cd <path-to-oneAPI-Samples>\RenderingToolkit\Tutorial\IntroToRayTracingWithEmbree\cpu
4242
```
4343

44-
Run the MSVS build script to generate the sample program and MSVS .sln files for source code review:
44+
If you prefer command line builds only, use an nmake script:
4545
```
46-
build-win-vs-dpcpp-toolchain.bat
46+
build-win-nmake-icx-cl.bat
4747
```
4848

49-
If you prefer command line builds only, use an nmake script:
49+
Run the MSVS build script to generate the sample program and MSVS .sln files for source code review. Note this method is deprecated but some may prefer it:
5050
```
51-
build-win-nmake-icx-cl.bat
51+
build-win-vs-dpcpp-toolchain.bat
5252
```
5353

54+
Set environment variables:
5455
```
5556
call <path-to-oneAPI>\setvars.bat
5657
```
58+
59+
Run the program
5760
```
5861
cd bin
5962
.\rkRayTracerGPU.exe
@@ -76,12 +79,23 @@ Run oneAPI setvars.bat:
7679
call <path-to-oneAPI>\setvars.bat
7780
7881
```
79-
Build and run the application:
8082

83+
Configure the build (Option 1):
8184
```
8285
mkdir build
8386
cd build
84-
cmake -G"Visual Studio 17 2022" -A x64 -T"Intel(R) oneAPI DPC++ Compiler 2023" ..
87+
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=icx-cl -DCMAKE_INSTALL_PREFIX=.. ..
88+
```
89+
90+
Configure the build (Option 2 Deprecated but generates .sln files for code review):
91+
```
92+
mkdir build
93+
cd build
94+
cmake -G"Visual Studio 17 2022" -A x64 -T"Intel(R) oneAPI DPC++ Compiler 2024" ..
95+
```
96+
97+
Build and run the application:
98+
```
8599
cmake --build . --config Release
86100
cmake --install . --config Release
87101
cd ..\bin
@@ -174,7 +188,7 @@ rendering API at a higher layer, perhaps at an _engine_ layer. Such developers
174188
should consider examining the Intel&reg; OSPRay API and library, which implements
175189
rendering facilities on top of Embree.
176190

177-
You can find more information by visiting [Intel&reg; oneAPI Rendering
191+
You can find more information by visiting [Intel&reg; Rendering
178192
Toolkit](https://software.intel.com/content/www/us/en/develop/tools/oneapi/rendering-toolkit.html).
179193

180194
## License

RenderingToolkit/Tutorial/IntroToRayTracingWithEmbree/gpu/build-win-vs-dpcpp-toolchain.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ call "C:\Program Files (x86)\Intel\oneapi\setvars.bat"
33

44
set CXX_COMPILER=icx-cl
55

6-
set "BUILD_COMMAND=cmake -G \"Visual Studio 17 2022\" -A x64 -T\"Intel(R) oneAPI DPC++ Compiler 2023\" -DCMAKE_INSTALL_PREFIX=.. .."
6+
set "BUILD_COMMAND=cmake -G \"Visual Studio 17 2022\" -A x64 -T\"Intel(R) oneAPI DPC++ Compiler 2024\" -DCMAKE_INSTALL_PREFIX=.. .."
77
echo %BUILD_COMMAND:\=% > build-command.txt
88
echo "CXX_COMPILER:" >> build-command.txt
99
%CXX_COMPILER% --version >> build-command.txt

0 commit comments

Comments
 (0)