Build and Run Sample Projects Using the Command Line
Prerequisite: Configure your system.
To build and run a sample:
- Locate a sample project using the Code Sample Browser for Intel® oneAPI Toolkits.
NOTE:Alternatively, advanced users can acquire the source code with Git* from the oneAPI-samples repository:
- Build and run a sample project using CMake*.
Build and Run an Intel® OSPRay Sample using CMake*
- Navigate to the folder where you downloaded the 01_ospray_gsg sample.
- Run the following commands to build the sample:
- Run the application.
- Review the output images with an image viewer application for PPM file type. For example, with Preview:
open firstFrameCpp.ppm
open accumulatedFrameCpp.ppm
You should see the output images:
- Single-accumulation render firstFrameCpp:
- Ten-accumulation render accumulatedFrameCpp:
- Single-accumulation render firstFrameCpp:
Build and Run an Intel® Embree Sample using CMake*
- Navigate to the folder where you downloaded the 02_embree_gsg sample.
- Run the following commands to build the sample:
- Run the application.
The sample application performs two ray-to-triangle intersect tests with the Intel Embree API. One test is successful, while the other test is a miss. Output is written to the terminal:
0.000000, 0.000000, -1.000000: Found intersection on geometry 0, primitive 0 at tfar=1.000000 1.000000, 1.000000, -1.000000: Did not find any intersection.
Build and Run an Intel® Open Volume Kernel Library Sample using CMake*
- Navigate to the folder where you downloaded the 03_openvkl_gsg sample.
- Run the following commands to build the sample:
- Run the application.
The sample application shows sampling within a procedurally generated volume and outputs. Sampling, gradient computation, and multi-attribute sampling. Output is written to the terminal.
Build and Run an Intel® Open Image Denoise Sample using CMake*
- Navigate to the folder where you downloaded the 04_oidn_gsg sample.
- Run the following commands to build the sample:
- Convert the accumulatedFrameCpp.ppm image to PFM format with LSB data ordering. For example, with the ImageMagick* convert tool:
<path-to-ImageMagick>/convert <path-to-sample>/01_ospray_gsg/build/accumulatedFrameCpp.ppm -endian LSB PFM:accumulatedFrameCpp.pfm
NOTE:If you installed ImageMagick with Homebrew*, the <path-to-ImageMagick> is typically /usr/local/Cellar/imagemagick/<version>/bin.NOTE:‘accumulatedFrameCpp.pfm’ is also already converted and available in the 04_oidn_gsg directory if you wish to skip this conversion. - Run the application to denoise the image.
- Review the output image with an image viewer application for PPM file type. For example, with Preview:
- Original ten-accumulation render accumulatedFrameCpp:
- Denoised result denoised.pfm:
- Original ten-accumulation render accumulatedFrameCpp:
Build and Run an Intel® Implicit SPMD Program Compiler Sample using CMake*
- Navigate to the folder where you downloaded the 05_ispc_gsg sample.
- Run the following commands to build the sample:
- Run a single-target sample application:
- Run a multi-target sample application:
The application executes a floating-point array arithmetic operation. The result is printed to stdout. Both applications emit the same results:
0: simple(0.000000) = 0.000000 1: simple(1.000000) = 1.000000 2: simple(2.000000) = 4.000000 3: simple(3.000000) = 1.732051 4: simple(4.000000) = 2.000000 5: simple(5.000000) = 2.236068 6: simple(6.000000) = 2.449490 7: simple(7.000000) = 2.645751 8: simple(8.000000) = 2.828427 9: simple(9.000000) = 3.000000 10: simple(10.000000) = 3.162278 11: simple(11.000000) = 3.316625 12: simple(12.000000) = 3.464102 13: simple(13.000000) = 3.605551 14: simple(14.000000) = 3.741657 15: simple(15.000000) = 3.872983
Build and Run an Intel® Open PGL Sample using CMake*
- Navigate to any new writable and empty folder:
- Create a new file, openpgl_check.cpp, using a raw text editor (TextEdit, etc.). Save the below contents into the file:
- Create a new file, CMakeLists.txt, using a raw text editor (TextEdit, etc.). Save the below contents into the file:
- Run the following commands to build the sample:
- Run the check application:
- If you see the below output without error, you have successfully built and runtime linked to the Intel® Open PGL library:
Next Steps
All samples have detailed README.md instructions for further review. Next, try running pre-compiled sample applications included with the toolkit OR explore additional resources in Next Steps.