BIPS/Examples/C++: Difference between revisions

From RidgeRun Developer Wiki
No edit summary
No edit summary
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
<noinclude>
<noinclude>
{{BIPS/Head|previous=|next=}}
{{BIPS/Head|previous=Examples|next=Examples/Python}}
</noinclude>
</noinclude>
<seo title="BIPS/BIPS - C++ Examples | RidgeRun" titlemode="replace" metakeywords="GStreamer, NVIDIA, Jetson, TX1, TX2, Jetson AGX Xavier, Xavier, AI, Deep Learning, Machine Learning, Jetson TX1, Jetson TX2, Jetson Xavier, NVIDIA Jetson Xavier, NVIDIA Jetson Orin, Jetson Orin, Orin, NVIDIA Orin, NVIDIA Jetson AGX Orin, Jetson AGX Orin, Assembly Line, Assembly Line Activity, activity recognition, machine learning activity recognition, Exploratory Data Analysis, EDA" description="This RidgeRun wiki page provides more information on the RidgeRun Buffer Interprocess Sharing (BIPS) process with C++ examples."></seo>


== Introduction ==
== Introduction ==
Line 62: Line 65:
You can use the defaults.
You can use the defaults.


'''Note''': It is recommended to match the configurations in both executables except in the logfile.
{{Ambox
|type=notice
|small=left
|issue='''Note''': It is recommended to match the configurations in both executables except in the logfile.
|style=width:unset;
}}


== Running the examples ==
== Running the examples ==
Line 68: Line 76:
=== One-to-one example ===
=== One-to-one example ===


1. Open two different terminals: one for producer and another for consumer.
1. Open two different terminals: one for the producer and another for the consumer.


2. In terminal 1, execute the producer:
2. In terminal 1, execute the producer:
Line 84: Line 92:
=== One-to-many example ===
=== One-to-many example ===


1. Open two different terminals: one for producer and another for consumer.
1. Open two different terminals: one for the producer and another for the consumer.


2. In terminal 1, execute the producer:
2. In terminal 1, execute the producer:
Line 101: Line 109:


<noinclude>
<noinclude>
{{BIPS/Foot||}}
{{BIPS/Foot|Examples|Examples/Python}}
</noinclude>
</noinclude>

Latest revision as of 21:02, 27 August 2024



Previous: Examples Index Next: Examples/Python






Introduction

The C++ examples take into account two possible cases:

  • One-to-one communication
  • One-to-many in broadcast communication

The example binaries are compiled after building. If the build directory is build:

├── src
    └── examples
        └── one-to-one
            ├── consumer
            └── producer

Executable options

Both executables have the same CLI options. Please, take them into account:

Usage:
	 consumer/producer [OPTION]...
Optional arguments:
	 -h, --help: Display this message and exit
	 --backend BACKEND: Use the specified inter-process shared memory
	                    backend; BACKEND can be 'shm' or 'nvsci'. Default: 'shm'
	 --channel CHANNEL: Connect to the specified shared memory channel.
	                    CHANNEL preferably starts with a '/' character
	                    followed by up to 255 characters, none of which
	                    are slashes. Default: channel
	 --num-buffers NUM_BUFFERS: Indicate how many shared memory buffers
	                            to create; NUM_BUFFERS can be a positive
	                            integer. Default: 10
	 --buffer-size BUFFER_SIZE: Indicate the size in bytes of a shared
	                            memory buffer; BUFFER_SIZE can be a
	                            positive integer. Default 33 MB
	 --exec-order ORDER: Follow execution order for buffer processing
	                     specified in ORDER; ORDER can be 'in-order' or
	                     'out-of-order'. Default 'in-order'
	 --process-size PROCESS_SIZE: Indicate the size in bytes of data to
	                              write to/read from shared memory
	                              during execution; PROCESS_SIZE can be
	                              a integer smaller than BUFFER_SIZE. Default:
                                      same as BUFFER_SIZE
	 --timeout TIMEOUT: Indicate how long to wait for available buffers
	                    before throwing a timeout error; TIMEOUT is
	                    measured in seconds and can be a positive
	                    integer. Default: 15 secs
	 --num-iterations NUM-ITERATIONS: Indicate how long many buffer
	                    processing iterations to run before exiting;
	                    NUM-ITERATIONS can be a positive integer. Default: 100
	 --logfile LOGFILE: Indicate name of file to log to. Default: consumer.log
                            or producer.log

You can use the defaults.

Running the examples

One-to-one example

1. Open two different terminals: one for the producer and another for the consumer.

2. In terminal 1, execute the producer:

./producer

3. In terminal 2, execute the consumer:

./consumer

One-to-many example

1. Open two different terminals: one for the producer and another for the consumer.

2. In terminal 1, execute the producer:

./producer

3. In terminal 2, execute two consumers:

./consumer --logfile consumer1.log & ./consumer --logfile consumer2.log

You can execute these two consumers in two different consoles as well.



Previous: Examples Index Next: Examples/Python