Vulkan SC Samples¶
Vulkan SC samples are included in Jetson Linux. This topic provides detailed steps to build and run these samples on the target.
Building the Samples¶
Prerequisites¶
The
cmake
with version 3.18 or laterThe
build-essential
Linux packageNvSci
headers. The headers are packaged inpublic_sources.tbz2
that can be downloaded from NVIDIA Developer Center.To extract them, on host run:
tar -I lbzip2 -xvf public_sources.tbz2 -C ./ cd ./Linux_for_Tegra/source/public mkdir nvsci_headers tar -xvf nvsci_headers.tbz2 -C ./nvsci_headers
Copy all the headers files under
nvsci_headers
to/usr/include
on target.
Build on the Target¶
The sample source files are available in the /usr/src/nvidia/vulkan-sc/vulkan-sc-ecosystem/vulkan-sc-sample/
directory.
The currently provided samples are:
vksc_01tri
vk_01tri
vksc_computeparticles
vk_computeparticles
vulkanscinfo
The samples can only be built on target. To build the samples, run the following commands:
export VKSC_SAMPLES=/usr/src/nvidia/vulkan-sc/vulkan-sc-ecosystem/vulkan-sc-sample
cd $VKSC_SAMPLES
mkdir build
cd build
cmake ../
make
After the samples have been built, the sample binaries are generated in the build/bin
directory
Running Vulkan SC Samples¶
Running the vulkanscinfo Command¶
The vulkanscinfo
command summarizes the core features of the Vulkan SC API and saves the output to the text/JSON/HTML file.
To display a list of all available options for the
vulkanscinfo
command, specify the–help
option:cd $VKSC_SAMPLES/build/bin ./vulkanscinfo —help
To save the output to an HTML file, specify the –html option:
cd $VKSC_SAMPLES/build/bin ./vulkanscinfo --html
Note: By default you will not have write permission for the
/usr/src
folder, the output HTML could not be able to save. To fix the issue, run the following command:chmod u+w $VKSC_SAMPLES/build/bin
or to run it under your your
HOME
folder:cd $HOME $VKSC_SAMPLES/build/bin/vulkanscinfo --html
Running the vksc_01tri Sample¶
The vksc_01tri
sample already contains the pipeline cache generated for gv11b
and ga10b
GPUs, and the cache binary in hex
format is embedded in the pipeline_cache.hpp
file that is built with the vksc_01tri
binary. Therefore, you can run the sample directly by
following these steps:
Save the offscreen rendering result to an image file.
cd $VKSC_SAMPLES/build/bin ./vksc_01tri -o
Display the rendering result by using OpenWFD.
cd $VKSC_SAMPLES/build/bin ./vksc_01tri -w
You can generate JSON file by using the JSON layer library as follows:
cd $VKSC_SAMPLES/build/bin export VK_LAYER_PATH=/etc/vulkansc/icd.d export VK_JSON_FILE_PATH=$PWD/data/pipeline/vksc_01tri/ ./vk_01tri
- The following files will be generated in
VK_JSON_FILE_PATH
: vk_01tri_pipeline_0.json
vk_01tri_pipeline_0.vert.spv
vk_01tri_pipeline_0.frag.spv
- The following files will be generated in
Generate the pipeline cache by running the PCC tool.
cd $VKSC_SAMPLES/build/bin/data/pipeline/vksc_01tri pcc -chip [gv11b|ga10b] -path ./ -out pipeline_cache.bin
Rerun the
vksc_01tri
sample with the pipeline cache generated in step 4.cd $VKSC_SAMPLES/build/bin ./vksc_01tri -c -o
Note: By specifying the
-c
option, the application will look for the pipeline_cache.bin files in the./data/pipeline/vksc_01tri
directory.
Running the vksc_computeparticles Sample¶
The vksc_computeparticles
sample already contains the pipeline cache generated for gv11b
and ga10b
GPUs, and the cache binary in hex format is
embedded in the pipeline_cache.hpp
file that is built with the vksc_computeparticles
binary. Therefore, you can run the sample directly. To read the
texture data, the vksc_computeparticles
sample uses the libktx.so
external library that is located in the $VKSC_SAMPLES/external/ktx
directory.
As a result, the library path must be specified before you run the samples as follows:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$VKSC_SAMPLES/external/ktx
To run the vksc_computeparticles
sample,
- Save the offscreen rendering result to an image file.
cd $VKSC_SAMPLES/build/bin ./vksc_computeparticles -o
- Display the rendering result by using OpenWFD.
cd $VKSC_SAMPLES/build/bin ./vksc_computeparticles -w
- You can generate JSON file by using the JSON layer library as follows:
cd $VKSC_SAMPLES/build/bin export VK_LAYER_PATH=/etc/vulkansc/icd.d export VK_JSON_FILE_PATH=$PWD/data/pipeline/computeparticles/ ./vk_computeparticles
The following files are generated in
VK_JSON_FILE_PATH
:vk_computeparticles_pipeline_0.json
vk_computeparticles_pipeline_1.json
vk_computeparticles_pipeline_0.frag.spv
vk_computeparticles_pipeline_0.vert.spv
This sample uses two different pipelines, graphics pipeline and compute pipeline; therefore, two JSON files are generated
- Generate the pipeline cache by using the PCC tool.
cd $VKSC_SAMPLES/build/bin/data/pipeline/computeparticles pcc -chip [gv11b|ga10b] -path ./ -out pipeline_cache.bin
- Rerun the vksc_computeparticles sample with the pipeline cache generated in step 4.
cd $VKSC_SAMPLES/build/bin ./vksc_computeparticles -c -o
Note: By specifying the
-c
option, the application will look for thepipeline_cache.bin
file in the./data/pipeline/vksc_computeparticles
directory.