Files
nvsci_samples/event_sample_app/00README.txt
svcmobrel-release e42833bdf1 Updating prebuilts and/or headers
1158201e78094e9e866fa99095c9ffc2ec9f5a27 - event_sample_app/block_limiter.c
a71ed037f9d77d0944f40f54cf25db8180d007e2 - event_sample_app/block_queue.c
ced622a41d1a48dcb23e6a1a02ae9640ef9b837c - event_sample_app/util.h
a0bd135d707994a41ed3a4234b5f875a268fed4d - event_sample_app/Makefile
d7e42e2b6088ff4596abc7256eb018d757a4021e - event_sample_app/usecase1.h
f5e2aea98ba9264ee1068a700222dff8d5d5c7a4 - event_sample_app/block_c2c.c
dac99c442185b020fbdae07bfc1e7df78343eb83 - event_sample_app/block_info.h
5001f036389a4f7952cb4974dd3323908208ca30 - event_sample_app/event_loop_threads.c
8193be73ce0a488f62034cb87083cdf09f52cd5d - event_sample_app/block_pool.c
3a1013021a572887303fb6db245b5b01fe07e9a0 - event_sample_app/block_producer_uc1.c
6ff0f1c2d7ef2e2fa9ece6fdc850b58b87207526 - event_sample_app/block_returnsync.c
e0861e9fe5d160d47d758464146d7192f9c70a5f - event_sample_app/util.c
b5dd68bec3ae6f9049aad1cb5a86c3db4af02e17 - event_sample_app/block_presentsync.c
b52e34443ac441a9df48029de944aa0a50d1b101 - event_sample_app/event_loop_service.c
ef057870dade9af70656b37340e9bcad35d49380 - event_sample_app/block_multicast.c
65ffe5af6ae6bc0418f348167c473849d4697e47 - event_sample_app/block_ipc.c
44f6de348f8bdd5cb584b3e8cc4b05e9482dddd2 - event_sample_app/event_loop.h
40f949c4c37ab4aa4a84182b345f3de6fceab39b - event_sample_app/main.c
641e3634da873970b574b23a1024b2e7155b88ff - event_sample_app/block_consumer_uc1.c
d6bbd17599543f1760d87851150a12a2a842a24d - event_sample_app/block_common.c
1fbb82e2281bb2e168c87fd20903bbed898ca160 - rawstream/rawstream_cuda.c
458833ab233a725c067bf9b1fc60ef39872eee80 - rawstream/Makefile
3df4e5c00a3dc002ee9877e282bd28ffa87fa6f0 - rawstream/rawstream.h
d5ffeef3c7ad2af6f6f31385db7917b5ef9a7438 - rawstream/rawstream_ipc_linux.c
f28c1cd5fe26b6dc5930d5556b54364c9b91767c - rawstream/rawstream_main.c
2bed038ca070aa5dccd6b672a98f093340e829bb - rawstream/rawstream_producer.c
e26c09f1ad1a3a7d2c29dae1b38d3fd90c23af6e - rawstream/rawstream_consumer.c

Change-Id: Iec84f03094414392580a103d2bc94bac8ed86fbb
2024-05-02 11:24:59 -07:00

132 lines
5.5 KiB
Plaintext

NvSciStream Event Loop Driven Sample App - README
Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
property and proprietary rights in and to this material, related
documentation and any modifications thereto. Any use, reproduction,
disclosure or distribution of this material and related documentation
without an express license agreement from NVIDIA CORPORATION or
its affiliates is strictly prohibited.
---
# nvscistream_event_sample - NvSciStream Sample App
## Description
This directory contains an NvSciStream sample application that
supports a variety of use cases, using an event-loop driven model.
Once the stream is fully connected, all further setup and streaming
operations are triggered by events, processed either by a single
NvSciEvent-driven thread or separate threads which wait for events
on each block. The former is the preferred approach for implementing
NvSciStream applications. In addition to those events which NvSci
itself generates, any other event which can be bound to an NvSciEvent
can be added to the event loop. This allows for robust applications
which can handle events regardless of the order in which they occur.
To use this sample for writing your own applications:
* See main.c for examples of how to do top level application setup and
how to select the blocks needed for your use case and connect them
all together.
* See the descriptions in the usecase*.h files to determine which use cases
involve the producer and consumer engines that you are interested in.
* See the appropriate block_*.c files for examples of creating the
necessary blocks and handling the events that they encounter.
See the block_producer_*.c and block_consumer_*.c files for examples of how
to map the relevant engines to and from NvSci.
* See the appropriate event_loop_*.c file for your chosen event handling
method.
## Build the application
The NvSciStream sample includes source code and a Makefile.
Navigate to the sample application directory to build the application:
make clean
make
## Examples of how to run the sample application:
* NOTE:
* Inter-process and inter-chip test cases must be run with sudo.
* NvMedia/CUDA stream (use case 2) of the sample application is not supported
on x86 and Jetson Linux devices.
* Inter-chip use cases are not supported on Jetson Linux devices.
Single-process, single-consumer CUDA/CUDA stream that uses the default event
service:
./nvscistream_event_sample
Single-process, single-consumer stream that uses the threaded event handling:
./nvscistream_event_sample -e t
Single-process NvMedia/CUDA stream with yuv format:
./nvscistream_event_sample -u 2 -s y
Single-process NvMedia/CUDA stream with three consumers, and the second uses
the mailbox mode:
./nvscistream_event_sample -u 2 -m 3 -q 1 m
Multi-process CUDA/CUDA stream with three consumers, one in the same
process as the producer, and the other two in separate processes. The
first and the third consumers use the mailbox mode:
./nvscistream_event_sample -m 3 -p -c 0 -q 0 m &
./nvscistream_event_sample -c 1 -c 2 -q 2 m
Multi-process CUDA/CUDA stream with three consumers, one in the same
process as the producer, and the other two in separate processes.
To simulate the case with a less trusted consumer, one of the consumer
processes is set with lower priority. A limiter block is used to restrict
this consumer to hold at most one packet. The total number of packets is
increased to five.
Linux example:
./nvscistream_event_sample -m 3 -f 5 -p -c 0 -l 2 1 &
./nvscistream_event_sample -c 1 &
nice -n 19 ./nvscistream_event_sample -c 2 &
# Makes the third process as nice as possible.
QNX example:
./nvscistream_event_sample -m 3 -f 5 -p -c 0 -l 2 1 &
./nvscistream_event_sample -c 1 &
nice -n 1 ./nvscistream_event_sample -c 2 &
# Reduces the priority level of the third process by 1.
Multi-process CUDA/CUDA stream with two consumers, one in the same
process as the producer, and the other in a separate processe. Both
processes enable the endpoint information option:
./nvscistream_event_sample -m 2 -p -c 0 -i &
./nvscistream_event_sample -c 1 -i
Multi-process CUDA/CUDA stream with one consumer on another SoC.
The consumer has the FIFO queue attached to the C2C IpcSrc block, and
a three-packet pool attached to the C2C IpcDst block. It uses IPC channel
nvscic2c_pcie_s0_c5_1 <-> nvscic2c_pcie_s0_c6_1 for C2C communication.
./nvscistream_event_sample -P 0 nvscic2c_pcie_s0_c5_1 -Q 0 f
# Run below command on another OS running on peer SOC.
./nvscistream_event_sample -C 0 nvscic2c_pcie_s0_c6_1 -F 0 3
Multi-process CUDA/CUDA stream with four consumers, one in the same
process as the producer, one in another process but in the same OS as the
producer, and two in another process on another OS running in a peer SoC.
The third and fourth consumers have a mailbox queue attached to the C2C
IpcSrc block, and a five-packet pool attached to the C2C IpcDst block.
The third consumer uses nvscic2c_pcie_s0_c5_1 <-> nvscic2c_pcie_s0_c6_1 for
C2C communication. The 4th consumer uses nvscic2c_pcie_s0_c5_2 <->
nvscic2c_pcie_s0_c6_2 for C2C communication.
./nvscistream_event_sample -m 4 -c 0 -q 0 m -Q 2 m -Q 3 m -P 2 nvscic2c_pcie_s0_c5_1 -P 3 nvscic2c_pcie_s0_c5_2 &
./nvscistream_event_sample -c 1 -q 1 m
# Run below command on another OS running on peer SOC.
./nvscistream_event_sample -C 2 nvscic2c_pcie_s0_c6_1 -q 2 f -F 2 5 -C 3 nvscic2c_pcie_s0_c6_2 -q 3 m -F 3 5