refactor: allow to specify cudaStream in builder function and constructor #25
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Type
Related Links
Description
This pull request adds support for passing and managing CUDA streams in the image compression and rectification pipeline. The changes allow users to specify a CUDA stream for asynchronous operations, improving flexibility and integration with other GPU workloads. If no stream is provided, the code will create and manage its own non-blocking stream internally.
CUDA Stream Integration and Management
cudaStream_t streamparameter (defaulting tonullptr) to factory and builder functions for compressors (create_compressor,make_nvjpeg_compressor,make_jetsonjpeg_compressor) and rectifiers (create_rectifier,make_npp_rectifier). This enables users to specify a CUDA stream for asynchronous processing. [1] [2] [3] [4]create_compressorandcreate_rectifierto accept and forward the CUDA stream parameter, allowing postprocess callbacks to also leverage the specified stream. [1] [2] [3]Internal Stream Ownership and Cleanup
JetsonJPEGCompressor,NvJPEGCompressor) and rectifier (NppRectifier) implementations to track whether the stream is owned internally (own_stream_). If no stream is provided, a new non-blocking stream is created and destroyed by the object; otherwise, the provided stream is used without taking ownership. [1] [2] [3] [4] [5] [6] [7] [8] [9]Header and Implementation Consistency
<cuda_runtime.h>and ensure function signatures and factory functions are consistent with the new stream parameter. [1] [2] [3] [4] [5]These changes make the image processing pipeline more flexible and efficient for GPU-accelerated applications that require precise control over CUDA stream usage.
Review Procedure
Remarks
Pre-Review Checklist for the PR Author
PR Author should check the checkboxes below when creating the PR.
Checklist for the PR Reviewer
Reviewers should check the checkboxes below before approval.
Post-Review Checklist for the PR Author
PR Author should check the checkboxes below before merging.
CI Checks