GNU Radio Companion Integration
Relevant source files
The following files were used as context for generating this wiki page:
The GNU Radio Companion (GRC) integration in gr-cuda provides a graphical interface for building GPU-accelerated signal processing pipelines. It abstracts the complexities of CUDA memory management, allowing users to drag and drop CUDA-enabled blocks alongside standard GNU Radio blocks. Data movement between the CPU (Host) and GPU (Device) is handled automatically by the underlying cuda_buffer architecture, ensuring that blocks receive device pointers directly in their execution context without requiring manual memory copies in the flowgraph design.
Sources: README.md:3-6, README.md:10-12
Architecture and Component Structure
The integration relies on YAML-based block definitions that GNU Radio Companion parses to render the graphical blocks and generate the corresponding Python flowgraph code. These definitions bridge the gap between the C++/CUDA implementation and the GRC user interface.
GRC Block Definitions
The project includes a dedicated grc directory containing YAML files for every supported GPU-accelerated block. These files define the block's parameters, inputs, outputs, and the Python code templates used for code generation.
Sources: grc/CMakeLists.txt:11-34
Domain and Buffer Management
A specific CUDA domain is defined to handle the unique requirements of GPU buffers. This domain facilitates the "Zero-copy GPU pipeline" where cuda_buffer manages CUDA-event synchronization and host-device transfers. This allows GPU kernels to run back-to-back without returning data to the CPU unless a standard CPU-based block is encountered in the flowgraph.
Sources: README.md:10-11, grc/CMakeLists.txt:13
Integration Workflow
The following diagram illustrates how gr-cuda components interact within the GNU Radio framework to enable GRC support:
The workflow ensures that high-level graphical designs are translated into efficient CUDA executions.
Sources: README.md:10-15, CMakeLists.txt:148-154
Implementation Details
Build System Integration
The GRC components are conditionally included in the build process based on the ENABLE_PYTHON flag. If Python support is enabled, the build system automatically processes the grc subdirectory and installs the required YAML files to the standard GNU Radio GRC block path.
Sources: CMakeLists.txt:148-154, grc/CMakeLists.txt:11-35
Installation Paths
All GRC-related files are installed to a specific destination within the GNU Radio data directory to ensure they are discovered by the GRC application:
- Destination:
share/gnuradio/grc/blocks
Sources: grc/CMakeLists.txt:35
Supported GRC Blocks
The repository provides a wide array of blocks available for use within the GRC interface, categorized by their implementation (C++ vs. Python/CuPy).
| Block Category | GRC YAML Files | Implementation Type |
|---|---|---|
| Math Operations | cuda_add.block.yml, cuda_add_cupy.block.yml, cuda_multiply_const_xx.block.yml | Mixed (C++ & CuPy) |
| Transforms | cuda_fft.block.yml, cuda_fft_cupy.block.yml | Mixed (C++ & CuPy) |
| Data Conversion | cuda_complex_to_mag_cupy.block.yml, cuda_nlog10_cupy.block.yml | CuPy |
| Stream Management | cuda_stream_to_vector.block.yml, cuda_vector_to_stream.block.yml | C++ |
| Sources/Sinks | cuda_null_source.block.yml, cuda_null_sink.block.yml | C++ |
| Utilities | cuda_nop.block.yml, cuda_probe_rate.block.yml, cuda_throttle.block.yml | C++ |
Sources: grc/CMakeLists.txt:13-34, python/cuda/CMakeLists.txt:24-32, lib/CMakeLists.txt:20-43
Data Flow in GRC Flowgraphs
When a user connects blocks in GRC, the cuda_buffer system automatically manages the transition between CPU and GPU execution domains.
As shown, transfers only occur at the boundaries where the pipeline switches between CPU-based blocks and GPU-accelerated blocks. Within the GPU domain, data remains on the device.
Sources: README.md:3-6, README.md:10-12
Summary
The GRC integration of gr-cuda leverages standard GNU Radio YAML definitions to expose high-performance CUDA and CuPy kernels to a graphical design environment. By automating buffer synchronization and memory transfers, it enables rapid prototyping of GPU-accelerated SDR applications while maintaining performance parity with hand-written CUDA implementations.