Skip to content
Merged
Show file tree
Hide file tree
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
35 changes: 0 additions & 35 deletions RenderingToolkit/GettingStarted/03_openvkl_gsg/CMakeLists.txt

This file was deleted.

63 changes: 6 additions & 57 deletions RenderingToolkit/GettingStarted/03_openvkl_gsg/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,63 +5,12 @@ high-performance volume computation kernels. Improve performance of volume
rendering applications by using performance optimized volume traversal and
sampling functionality for a variety of data formats.

| Minimum Requirements | Description
|:--- |:---
| OS | Linux* Ubuntu* 18.04 <br>CentOS 8 (or compatible) <br> Windows* 10 <br>macOS* 10.15+
| 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)
| 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*
| Libraries | Install Intel&reg; oneAPI Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel&reg; Open VKL
## Versions

| Objective | Description
|:--- |:---
| What you will learn | How to build and run a basic rendering program using the Intel&reg; Open VKL API from the Render Kit.
| Time to complete | 5 minutes

## Purpose

This sample program, `vklTutorial`, shows sampling amongst a proceedurally
generated volume the different volumetric sampling capabilities with Intel&reg;
Open VKL. Output is written to the console (stdout).

## Key Implementation Details

`vklTutorial` is written in C99 and is constructed to compile with a C++ or C99
compiler.

## Build and Run

### Windows

1. Run a new **x64 Native Tools Command Prompt for MSVS 2019**.

```
call <path-to-oneapi-folder>\setvars.bat
cd <path-to-oneAPI-samples>\RenderingToolkit\GettingStarted\03_openvkl_gsg
mkdir build
cd build
cmake ..
cmake --build . --config Release
cd Release
vklTutorial.exe
```

2. Review the terminal output (stdout).


### Linux and macOS

1. Start a new Terminal session.
```
source <path-to-oneapi-folder>/setvars.sh
cd <path-to-oneAPI-samples>/RenderingToolkit/GettingStarted/03_openvkl_gsg
mkdir build
cd build
cmake ..
cmake --build .
./vklTutorial
```

2. Review the terminal output (stdout).
1. [CPU](./cpu/) - for Intel64 (x86-64) Host
- This version of the `vklTutorialCPU` program uses a C++11 (or C99) system compiler to target the host processor.
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)
- This `vklTutorialGPU` program uses Intel&reg; oneAPI DPC/C++ Compiler and SYCL* Runtimes to target the GPU.


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

Third party program Licenses can be found here:
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
31 changes: 31 additions & 0 deletions RenderingToolkit/GettingStarted/03_openvkl_gsg/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.16)
project(OPENVKL_CPU_GSG LANGUAGES C CXX)

set(ONEAPI_ROOT "")
if(DEFINED ENV{ONEAPI_ROOT})
set(ONEAPI_ROOT "$ENV{ONEAPI_ROOT}")
message(STATUS "ONEAPI_ROOT FROM ENVIRONMENT: ${ONEAPI_ROOT}")
else()
message(FATAL_ERROR "ONEAPI_ROOT DEFAULT: ${ONEAPI_ROOT}")
endif(DEFINED ENV{ONEAPI_ROOT})

set(OPENVKL_BASE_DIR "")
if(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)
set(OPENVKL_BASE_DIR ${ONEAPI_ROOT})
else()
set(OPENVKL_BASE_DIR ${ONEAPI_ROOT}/openvkl/latest)
endif(EXISTS ${ONEAPI_ROOT}/oneapi-vars.sh OR EXISTS ${ONEAPI_ROOT}/oneapi-vars.bat)

find_package(openvkl REQUIRED PATHS ${ONEAPI_ROOT})

if(MSVC)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif(MSVC)

add_executable(vklTutorialCPU src/vklTutorialCPU.c)
target_link_libraries(vklTutorialCPU PRIVATE openvkl::openvkl openvkl::openvkl_module_cpu_device)
install(TARGETS vklTutorialCPU RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
75 changes: 75 additions & 0 deletions RenderingToolkit/GettingStarted/03_openvkl_gsg/cpu/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Getting Started Sample for Intel&reg; Rendering Toolkit (Render Kit): Intel&reg; Open Volume Kernel Library (Intel&reg; Open VKL) on CPU

Intel&reg; Open Volume Kernel Library (Intel&reg; Open VKL) is a collection of
high-performance volume computation kernels. Improve performance of volume
rendering applications by using performance optimized volume traversal and
sampling functionality for a variety of data formats.

| Minimum Requirements | Description
|:--- |:---
| OS | Linux* Ubuntu* 22.04 <br>CentOS 8 (or compatible) <br> Windows* 10 or 11<br>macOS* 10.15+
| 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)
| 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*
| Libraries | Install Intel&reg; Rendering Toolkit (Render Kit), including Intel&reg; Embree and Intel&reg; Open VKL

| Objective | Description
|:--- |:---
| What you will learn | How to build and run a basic rendering program using the Intel&reg; Open VKL API from the Render Kit.
| Time to complete | 5 minutes

## Purpose

This sample program, `vklTutorialCPU`, shows sampling amongst a proceedurally
generated volume the different volumetric sampling capabilities with Intel&reg;
Open VKL. Output is written to the console (stdout).

## Key Implementation Details

`vklTutorialCPU` is written in C99 and is constructed to compile with a C++ or C99
compiler.

## Build and Run

### Windows

1. Run a new **x64 Native Tools Command Prompt for MSVS 2022**.

```
call <path-to-oneapi-folder>\setvars.bat
cd <path-to-oneAPI-samples>\RenderingToolkit\GettingStarted\03_openvkl_gsg
mkdir build
cd build
cmake ..
cmake --build . --config Release
cd Release
vklTutorialCPU.exe
```

Note: MSVS 2019 should use an **x64 Native Tools Command Prompt for MSVS 2019**

2. Review the terminal output (stdout).


### Linux and macOS

1. Start a new Terminal session.
```
source <path-to-oneapi-folder>/setvars.sh
cd <path-to-oneAPI-samples>/RenderingToolkit/GettingStarted/03_openvkl_gsg
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake --build .
./vklTutorialCPU
```

2. Review the terminal output (stdout).


## License

This code sample is licensed under the Apache 2.0 license. See
[LICENSE.txt](LICENSE.txt) for details.

Third party program Licenses can be found here:
[third-party-programs.txt](https://github.com/oneapi-src/oneAPI-samples/blob/master/third-party-programs.txt).
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Copyright 2019-2021 Intel Corporation
// Copyright 2019 Intel Corporation
// SPDX-License-Identifier: Apache-2.0

#include <openvkl/openvkl.h>
#include <openvkl/device/openvkl.h>
#include <stdio.h>

#if defined(_MSC_VER)
Expand Down Expand Up @@ -39,8 +40,8 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
// sample, gradient (first attribute)
unsigned int attributeIndex = 0;
float time = 0.f;
float sample = vklComputeSample(sampler, &coord, attributeIndex, time);
vkl_vec3f grad = vklComputeGradient(sampler, &coord, attributeIndex, time);
float sample = vklComputeSample(&sampler, &coord, attributeIndex, time);
vkl_vec3f grad = vklComputeGradient(&sampler, &coord, attributeIndex, time);
printf("\tsampling and gradient computation (first attribute)\n");
printf("\t\tsample = %f\n", sample);
printf("\t\tgrad = %f %f %f\n\n", grad.x, grad.y, grad.z);
Expand All @@ -49,7 +50,7 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
unsigned int M = 3;
unsigned int attributeIndices[] = {0, 1, 2};
float samples[3];
vklComputeSampleM(sampler, &coord, samples, M, attributeIndices, time);
vklComputeSampleM(&sampler, &coord, samples, M, attributeIndices, time);
printf("\tsampling (multiple attributes)\n");
printf("\t\tsamples = %f %f %f\n\n", samples[0], samples[1], samples[2]);

Expand Down Expand Up @@ -99,12 +100,12 @@ void demoScalarAPI(VKLDevice device, VKLVolume volume) {
#if defined(_MSC_VER)
// MSVC does not support variable length arrays, but provides a
// safer version of alloca.
char *buffer = _malloca(vklGetIntervalIteratorSize(intervalContext));
char *buffer = _malloca(vklGetIntervalIteratorSize(&intervalContext));
#else
char buffer[vklGetIntervalIteratorSize(intervalContext)];
char buffer[vklGetIntervalIteratorSize(&intervalContext)];
#endif
VKLIntervalIterator intervalIterator = vklInitIntervalIterator(
intervalContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);
&intervalContext, &rayOrigin, &rayDirection, &rayTRange, time, buffer);

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

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

Expand Down Expand Up @@ -182,8 +183,8 @@ void demoVectorAPI(VKLVolume volume) {
float time4[4] = {0.f};
float sample4[4];
vkl_vvec3f4 grad4;
vklComputeSample4(valid, sampler, &coord4, sample4, attributeIndex, time4);
vklComputeGradient4(valid, sampler, &coord4, &grad4, attributeIndex, time4);
vklComputeSample4(valid, &sampler, &coord4, sample4, attributeIndex, time4);
vklComputeGradient4(valid, &sampler, &coord4, &grad4, attributeIndex, time4);

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

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

printf("\n\tsampling (multiple attributes)\n");
Expand Down Expand Up @@ -240,8 +241,8 @@ void demoStreamAPI(VKLVolume volume) {
float time[5] = {0.f};
float sample[5];
vkl_vec3f grad[5];
vklComputeSampleN(sampler, 5, coord, sample, attributeIndex, time);
vklComputeGradientN(sampler, 5, coord, grad, attributeIndex, time);
vklComputeSampleN(&sampler, 5, coord, sample, attributeIndex, time);
vklComputeGradientN(&sampler, 5, coord, grad, attributeIndex, time);

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

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

Expand All @@ -271,7 +272,7 @@ void demoStreamAPI(VKLVolume volume) {
}

int main() {
vklLoadModule("cpu_device");
vklInit();

VKLDevice device = vklNewDevice("cpu");
vklCommitDevice(device);
Expand Down
Loading