Skip to content

Commit 497d8a8

Browse files
2024.0 IRTK VKL Updates for GPU (Open VKL 2.x) (#2015)
* Initial vkl 2.0.0 sample commit for linux Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> * Windows updates for cpu and gpu. TODO: finalize compiler details, README Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> * IRTK 2024.0 vkl gsg README and tested gpu on linux Signed-off-by: Carroll, Michael R <michael.r.carroll@intel.com> * 2024.0 IRTK vkl updates: sample val fix and test win + slim CMakeLists Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> * IRTK 2024.0 Change IRTK gsg sample to CPP per Jimmy guidance Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> * IRTK 2024.0 vkl source formatting. Concerns about reordering of headers swapped back Signed-off-by: MichaelRoyceCarroll <michael.carroll@alumni.usc.edu> * IRTO 2024.0 VKL sample gpu OS fix 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 681af76 commit 497d8a8

File tree

9 files changed

+684
-114
lines changed

9 files changed

+684
-114
lines changed

RenderingToolkit/GettingStarted/03_openvkl_gsg/CMakeLists.txt

Lines changed: 0 additions & 35 deletions
This file was deleted.

RenderingToolkit/GettingStarted/03_openvkl_gsg/README.md

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,12 @@ high-performance volume computation kernels. Improve performance of volume
55
rendering applications by using performance optimized volume traversal and
66
sampling functionality for a variety of data formats.
77

8-
| Minimum Requirements | Description
9-
|:--- |:---
10-
| OS | Linux* Ubuntu* 18.04 <br>CentOS 8 (or compatible) <br> Windows* 10 <br>macOS* 10.15+
11-
| Hardware | Intel 64 Penryn or newer with SSE4.1 extensions, ARM64 with NEON extensions <br>(Optimized requirements: Intel 64 Skylake or newer with AVX512 extentions, ARM64 with NEON extensions)
12-
| Compiler Toolchain | Windows OS: MSVS 2019 installed with Windows* SDK and CMake*; Other platforms: C++11 compiler, a C99 compiler (for example. gcc/c++/clang), and CMake*
13-
| Libraries | Install Intel&reg; oneAPI Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel&reg; Open VKL
8+
## Versions
149

15-
| Objective | Description
16-
|:--- |:---
17-
| What you will learn | How to build and run a basic rendering program using the Intel&reg; Open VKL API from the Render Kit.
18-
| Time to complete | 5 minutes
19-
20-
## Purpose
21-
22-
This sample program, `vklTutorial`, shows sampling amongst a proceedurally
23-
generated volume the different volumetric sampling capabilities with Intel&reg;
24-
Open VKL. Output is written to the console (stdout).
25-
26-
## Key Implementation Details
27-
28-
`vklTutorial` is written in C99 and is constructed to compile with a C++ or C99
29-
compiler.
30-
31-
## Build and Run
32-
33-
### Windows
34-
35-
1. Run a new **x64 Native Tools Command Prompt for MSVS 2019**.
36-
37-
```
38-
call <path-to-oneapi-folder>\setvars.bat
39-
cd <path-to-oneAPI-samples>\RenderingToolkit\GettingStarted\03_openvkl_gsg
40-
mkdir build
41-
cd build
42-
cmake ..
43-
cmake --build . --config Release
44-
cd Release
45-
vklTutorial.exe
46-
```
47-
48-
2. Review the terminal output (stdout).
49-
50-
51-
### Linux and macOS
52-
53-
1. Start a new Terminal session.
54-
```
55-
source <path-to-oneapi-folder>/setvars.sh
56-
cd <path-to-oneAPI-samples>/RenderingToolkit/GettingStarted/03_openvkl_gsg
57-
mkdir build
58-
cd build
59-
cmake ..
60-
cmake --build .
61-
./vklTutorial
62-
```
63-
64-
2. Review the terminal output (stdout).
10+
1. [CPU](./cpu/) - for Intel64 (x86-64) Host
11+
- This version of the `vklTutorialCPU` program uses a C++11 (or C99) system compiler to target the host processor.
12+
2. [GPU](./gpu/) - for Intel&reg; Arc&trade; Graphics, Intel&reg; Data Center Flex Series, or Intel&reg; Data Center Max Series or higher (Xe-HPG, DG2-128, DG2-512 or higher)
13+
- This `vklTutorialGPU` program uses Intel&reg; oneAPI DPC/C++ Compiler and SYCL* Runtimes to target the GPU.
6514

6615

6716
## License
@@ -70,4 +19,4 @@ This code sample is licensed under the Apache 2.0 license. See
7019
[LICENSE.txt](LICENSE.txt) for details.
7120

7221
Third party program Licenses can be found here:
73-
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
22+
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
project(OPENVKL_CPU_GSG LANGUAGES C CXX)
3+
4+
set(ONEAPI_ROOT "")
5+
if(DEFINED ENV{ONEAPI_ROOT})
6+
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
7+
message(STATUS "ONEAPI_ROOT FROM ENVIRONMENT: ${ONEAPI_ROOT}")
8+
else()
9+
message(FATAL_ERROR "ONEAPI_ROOT DEFAULT: ${ONEAPI_ROOT}")
10+
endif(DEFINED ENV{ONEAPI_ROOT})
11+
12+
set(OPENVKL_BASE_DIR "")
13+
if(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
14+
set(OPENVKL_BASE_DIR ${ONEAPI_ROOT})
15+
else()
16+
set(OPENVKL_BASE_DIR ${ONEAPI_ROOT}/openvkl/latest)
17+
endif(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
18+
19+
find_package(openvkl REQUIRED PATHS ${ONEAPI_ROOT})
20+
21+
if(MSVC)
22+
set(CMAKE_CXX_STANDARD 11)
23+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
24+
set(CMAKE_CXX_EXTENSIONS OFF)
25+
else()
26+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
27+
endif(MSVC)
28+
29+
add_executable(vklTutorialCPU src/vklTutorialCPU.c)
30+
target_link_libraries(vklTutorialCPU PRIVATE openvkl::openvkl openvkl::openvkl_module_cpu_device)
31+
install(TARGETS vklTutorialCPU RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Getting Started Sample for Intel&reg; Rendering Toolkit (Render Kit): Intel&reg; Open Volume Kernel Library (Intel&reg; Open VKL) on CPU
2+
3+
Intel&reg; Open Volume Kernel Library (Intel&reg; Open VKL) is a collection of
4+
high-performance volume computation kernels. Improve performance of volume
5+
rendering applications by using performance optimized volume traversal and
6+
sampling functionality for a variety of data formats.
7+
8+
| Minimum Requirements | Description
9+
|:--- |:---
10+
| OS | Linux* Ubuntu* 22.04 <br>CentOS 8 (or compatible) <br> Windows* 10 or 11<br>macOS* 10.15+
11+
| Hardware | Intel 64 Penryn or newer with SSE4.1 extensions, ARM64 with NEON extensions <br>(Optimized requirements: Intel 64 Skylake or newer with AVX512 extentions, ARM64 with NEON extensions)
12+
| Compiler Toolchain | Windows OS: MSVS 2022 (or 2019) installed with Windows* SDK and CMake*; Other platforms: C++11 compiler, a C99 compiler (for example. gcc/c++/clang), and CMake*
13+
| Libraries | Install Intel&reg; Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel&reg; Open VKL
14+
15+
| Objective | Description
16+
|:--- |:---
17+
| What you will learn | How to build and run a basic rendering program using the Intel&reg; Open VKL API from the Render Kit.
18+
| Time to complete | 5 minutes
19+
20+
## Purpose
21+
22+
This sample program, `vklTutorialCPU`, shows sampling amongst a proceedurally
23+
generated volume the different volumetric sampling capabilities with Intel&reg;
24+
Open VKL. Output is written to the console (stdout).
25+
26+
## Key Implementation Details
27+
28+
`vklTutorialCPU` is written in C99 and is constructed to compile with a C++ or C99
29+
compiler.
30+
31+
## Build and Run
32+
33+
### Windows
34+
35+
1. Run a new **x64 Native Tools Command Prompt for MSVS 2022**.
36+
37+
```
38+
call <path-to-oneapi-folder>\setvars.bat
39+
cd <path-to-oneAPI-samples>\RenderingToolkit\GettingStarted\03_openvkl_gsg
40+
mkdir build
41+
cd build
42+
cmake ..
43+
cmake --build . --config Release
44+
cd Release
45+
vklTutorialCPU.exe
46+
```
47+
48+
Note: MSVS 2019 should use an **x64 Native Tools Command Prompt for MSVS 2019**
49+
50+
2. Review the terminal output (stdout).
51+
52+
53+
### Linux and macOS
54+
55+
1. Start a new Terminal session.
56+
```
57+
source <path-to-oneapi-folder>/setvars.sh
58+
cd <path-to-oneAPI-samples>/RenderingToolkit/GettingStarted/03_openvkl_gsg
59+
mkdir build
60+
cd build
61+
cmake -DCMAKE_BUILD_TYPE=Release ..
62+
cmake --build .
63+
./vklTutorialCPU
64+
```
65+
66+
2. Review the terminal output (stdout).
67+
68+
69+
## License
70+
71+
This code sample is licensed under the Apache 2.0 license. See
72+
[LICENSE.txt](LICENSE.txt) for details.
73+
74+
Third party program Licenses can be found here:
75+
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).

RenderingToolkit/GettingStarted/03_openvkl_gsg/src/vklTutorial.c renamed to RenderingToolkit/GettingStarted/03_openvkl_gsg/cpu/src/vklTutorialCPU.c

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
// Copyright 2019-2021 Intel Corporation
1+
// Copyright 2019 Intel Corporation
22
// SPDX-License-Identifier: Apache-2.0
33

44
#include <openvkl/openvkl.h>
5+
#include <openvkl/device/openvkl.h>
56
#include <stdio.h>
67

78
#if defined(_MSC_VER)
@@ -39,8 +40,8 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
3940
// sample, gradient (first attribute)
4041
unsigned int attributeIndex = 0;
4142
float time = 0.f;
42-
float sample = vklComputeSample(sampler, &coord, attributeIndex, time);
43-
vkl_vec3f grad = vklComputeGradient(sampler, &coord, attributeIndex, time);
43+
float sample = vklComputeSample(&sampler, &coord, attributeIndex, time);
44+
vkl_vec3f grad = vklComputeGradient(&sampler, &coord, attributeIndex, time);
4445
printf("\tsampling and gradient computation (first attribute)\n");
4546
printf("\t\tsample = %f\n", sample);
4647
printf("\t\tgrad = %f %f %f\n\n", grad.x, grad.y, grad.z);
@@ -49,7 +50,7 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
4950
unsigned int M = 3;
5051
unsigned int attributeIndices[] = {0, 1, 2};
5152
float samples[3];
52-
vklComputeSampleM(sampler, &coord, samples, M, attributeIndices, time);
53+
vklComputeSampleM(&sampler, &coord, samples, M, attributeIndices, time);
5354
printf("\tsampling (multiple attributes)\n");
5455
printf("\t\tsamples = %f %f %f\n\n", samples[0], samples[1], samples[2]);
5556

@@ -99,12 +100,12 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
99100
#if defined(_MSC_VER)
100101
// MSVC does not support variable length arrays, but provides a
101102
// safer version of alloca.
102-
char *buffer = _malloca(vklGetIntervalIteratorSize(intervalContext));
103+
char *buffer = _malloca(vklGetIntervalIteratorSize(&intervalContext));
103104
#else
104-
char buffer[vklGetIntervalIteratorSize(intervalContext)];
105+
char buffer[vklGetIntervalIteratorSize(&intervalContext)];
105106
#endif
106107
VKLIntervalIterator intervalIterator = vklInitIntervalIterator(
107-
intervalContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);
108+
&intervalContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);
108109

109110
printf("\n\tinterval iterator for value ranges {%f %f} {%f %f}\n",
110111
ranges[0].lower, ranges[0].upper, ranges[1].lower, ranges[1].upper);
@@ -130,12 +131,12 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
130131
#if defined(_MSC_VER)
131132
// MSVC does not support variable length arrays, but provides a
132133
// safer version of alloca.
133-
char *buffer = _malloca(vklGetHitIteratorSize(hitContext));
134+
char *buffer = _malloca(vklGetHitIteratorSize(&hitContext));
134135
#else
135-
char buffer[vklGetHitIteratorSize(hitContext)];
136+
char buffer[vklGetHitIteratorSize(&hitContext)];
136137
#endif
137138
VKLHitIterator hitIterator = vklInitHitIterator(
138-
hitContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);
139+
&hitContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);
139140

140141
printf("\thit iterator for values %f %f\n", values[0], values[1]);
141142

@@ -182,8 +183,8 @@ void demoVectorAPI(VKLVolume volume) {
182183
float time4[4] = {0.f};
183184
float sample4[4];
184185
vkl_vvec3f4 grad4;
185-
vklComputeSample4(valid, sampler, &coord4, sample4, attributeIndex, time4);
186-
vklComputeGradient4(valid, sampler, &coord4, &grad4, attributeIndex, time4);
186+
vklComputeSample4(valid, &sampler, &coord4, sample4, attributeIndex, time4);
187+
vklComputeGradient4(valid, &sampler, &coord4, &grad4, attributeIndex, time4);
187188

188189
printf("\n\tsampling and gradient computation (first attribute)\n");
189190

@@ -197,7 +198,7 @@ void demoVectorAPI(VKLVolume volume) {
197198
unsigned int M = 3;
198199
unsigned int attributeIndices[] = {0, 1, 2};
199200
float samples[3 * 4];
200-
vklComputeSampleM4(valid, sampler, &coord4, samples, M, attributeIndices,
201+
vklComputeSampleM4(valid, &sampler, &coord4, samples, M, attributeIndices,
201202
time4);
202203

203204
printf("\n\tsampling (multiple attributes)\n");
@@ -240,8 +241,8 @@ void demoStreamAPI(VKLVolume volume) {
240241
float time[5] = {0.f};
241242
float sample[5];
242243
vkl_vec3f grad[5];
243-
vklComputeSampleN(sampler, 5, coord, sample, attributeIndex, time);
244-
vklComputeGradientN(sampler, 5, coord, grad, attributeIndex, time);
244+
vklComputeSampleN(&sampler, 5, coord, sample, attributeIndex, time);
245+
vklComputeGradientN(&sampler, 5, coord, grad, attributeIndex, time);
245246

246247
for (int i = 0; i < 5; i++) {
247248
printf("\t\tsample[%d] = %f\n", i, sample[i]);
@@ -252,7 +253,7 @@ void demoStreamAPI(VKLVolume volume) {
252253
unsigned int M = 3;
253254
unsigned int attributeIndices[] = {0, 1, 2};
254255
float samples[3 * 5];
255-
vklComputeSampleMN(sampler, 5, coord, samples, M, attributeIndices, time);
256+
vklComputeSampleMN(&sampler, 5, coord, samples, M, attributeIndices, time);
256257

257258
printf("\n\tsampling (multiple attributes)\n");
258259

@@ -271,7 +272,7 @@ void demoStreamAPI(VKLVolume volume) {
271272
}
272273

273274
int main() {
274-
vklLoadModule("cpu_device");
275+
vklInit();
275276

276277
VKLDevice device = vklNewDevice("cpu");
277278
vklCommitDevice(device);

0 commit comments

Comments
 (0)