Skip to content

Commit

Permalink
Update README and CMake scripts
Browse files Browse the repository at this point in the history
- Add VPI library introduction to README
- Add information about allowlist to README
- Update minimum Holoscan version to 2.1.0
- Update CMake scripts to download precompiled libraries in build time

Signed-off-by: Mehmet Umut Demircin <mdemircin@nvidia.com>
  • Loading branch information
mdemircin committed Aug 2, 2024
1 parent 17b7977 commit ad5f57a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions applications/precompiled_pva/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ PVA is a highly power-efficient VLIW processor integrated into NVIDIA Tegra plat
## Content

- `main.cpp`: This file contains a C++ Holoscan application that demonstrates the use of an operator for loading and executing a precompiled PVA library dedicated to performing the unsharp masking algorithm on images. CUPVA SDK and license are not required to run this Holohub application.
- `pva_unsharp_mask/`: This directory houses the `pva_unsharp_mask.hpp` header file, which declares the `PvaUnsharpMask` class. The `PvaUnsharpMask` class includes an `init` API, invoked for the initial tensor, and a `process` API, used for processing input tensors. Precompiled algorithm library file, `libpva_unsharp_mask.a`, and the corresponding allow list file, `cupva_allowlist_pva_unsharp_mask`, are automatically downloaded by the CMake scripts.

- `pva_unsharp_mask/`: This directory houses the `pva_unsharp_mask.hpp` header file, which declares the `PvaUnsharpMask` class. The `PvaUnsharpMask` class includes an `init` API, invoked for the initial tensor, and a `process` API, used for processing input tensors. Precompiled algorithm library file, `libpva_unsharp_mask.a`, and the corresponding allowlist file, `cupva_allowlist_pva_unsharp_mask`, are automatically downloaded by the CMake scripts.
Please note that only PVA executables with signatures included in a secure allowlist database are permitted to execute on the PVA. This ensures that only verified and trusted executables are run, enhancing the security and integrity of the system.

## Algorithm Overview

Expand All @@ -25,7 +25,7 @@ The PreCompiledPVAExecutor operator performs an image sharpening operation in th
2. Apply a 5x5 unsharp mask filter on the luminance color plane.
3. Convert the enhanced image back to the RGB format.

The [VPI library](https://developer.nvidia.com/embedded/vpi) offers numerous algorithm examples that leverage the PVA as the backend.
Numerous algorithm examples leveraging the PVA can be found in the [Vision Programming Interface (VPI) library](https://developer.nvidia.com/embedded/vpi). VPI enables computer vision software developers to utilize multiple compute engines simultaneously&mdash;including CPU, GPU, PVA, VIC, NVENC, and OFA&mdash;through a unified interface. For comprehensive details, please refer to the [VPI Documentation](https://docs.nvidia.com/vpi/index.html).

## Compiling the application

Expand All @@ -52,7 +52,7 @@ $ ./run build precompiled_pva
The application takes an endoscopy video stream as input, applies the unsharp mask filter, and shows it in
HoloViz window.

Before running the application, deploy VPU application signature allow-list on target in your host (outside a container):
Before running the application, deploy VPU application signature allowlist on target in your host (outside a container):
```bash
sudo cp <HOLOHUB_BUILD_DIR>/applications/precompiled_pva/cpp/pva_unsharp_mask/cupva_allowlist_pva_unsharp_mask /etc/pva/allow.d/cupva_allowlist_pva_unsharp_mask
sudo pva_allow
Expand Down
16 changes: 12 additions & 4 deletions applications/precompiled_pva/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# license agreement from NVIDIA Corporation is strictly prohibited.
#

find_package(holoscan 1.0.3 REQUIRED CONFIG
find_package(holoscan 2.1.0 REQUIRED CONFIG
PATHS "/opt/nvidia/holoscan" "/workspace/holoscan-sdk/install")

add_executable(precompiled_pva
Expand All @@ -35,16 +35,24 @@ set(PVA_UNSHARP_MASK_URL "https://edge.urm.nvidia.com/artifactory/sw-holoscan-th
# Define the URL for downloading cupva_allowlist_pva_unsharp_mask
set(CUPVA_ALLOWLIST_URL "https://edge.urm.nvidia.com/artifactory/sw-holoscan-thirdparty-generic-local/pva/cupva_allowlist_pva_unsharp_mask")

# Define a custom target for preparing libpva_unsharp_mask.a and cupva_allowlist_pva_unsharp_mask
add_custom_target(prepare_pva_dependencies
# Define a custom command for preparing libpva_unsharp_mask.a and cupva_allowlist_pva_unsharp_mask
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pva_unsharp_mask/prepared.stamp"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan "Preparing PVA dependencies..."
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CURRENT_BINARY_DIR}/pva_unsharp_mask"
COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --green "Directory ensured at ${CMAKE_CURRENT_BINARY_DIR}/pva_unsharp_mask"
COMMAND ${CMAKE_COMMAND} -D PVA_UNSHARP_MASK_LIB_DEST="${PVA_UNSHARP_MASK_LIB_DEST}" -D PVA_UNSHARP_MASK_URL="${PVA_UNSHARP_MASK_URL}" -D CUPVA_ALLOWLIST_URL="${CUPVA_ALLOWLIST_URL}" -D CUPVA_ALLOWLIST_DEST="${CUPVA_ALLOWLIST_DEST}" -P "${CMAKE_CURRENT_LIST_DIR}/PreparePVADependencies.cmake"
COMMAND ${CMAKE_COMMAND} -E touch "${CMAKE_CURRENT_BINARY_DIR}/pva_unsharp_mask/prepared.stamp"
COMMENT "Preparing libpva_unsharp_mask.a and cupva_allowlist_pva_unsharp_mask"
)

add_dependencies(pva_unsharp_mask prepare_pva_dependencies)
# Define a custom target that depends on the custom command
add_custom_target(prepare_pva_dependencies ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pva_unsharp_mask/prepared.stamp"
)

# Ensure the custom target is built before the main target
add_dependencies(precompiled_pva prepare_pva_dependencies)

# Update the IMPORTED_LOCATION to the new path in the build directory
set_target_properties(pva_unsharp_mask PROPERTIES IMPORTED_LOCATION ${PVA_UNSHARP_MASK_LIB_DEST})
Expand Down

0 comments on commit ad5f57a

Please sign in to comment.