cuSignal on the AIR-T

cuSignal is a GPU accelerated version of scipy.signal that is maintained by the NVIDIA RAPIDS team. The RAPIDS software suite is an open source API that provides users GPU accelerated data science tools. Deepwave Digital is a contributor to the open source toolbox and provides functionality to enable Jetson and the AIR-T.

cuSignal: source code


Create cuSignal Conda Environment

1. Make sure Anaconda is installed on your AIR-T. Anaconda is preinstalled with AirStack, so follow the instructions provided in the tutorial: Installing Anaconda on AIR-T.

2. Currently, Deepwave provides a custom conda environment as a .yml file which defines the packages needed to use cuSignal on AirStack. To create this conda environment follow the following steps:

$ wget docs.deepwavedigital.com/Open_Source/files/cusignal_airt.yml
$ conda env create -f cusignal_airt.yml

Note: This may take up to 30 minutes or more on the AIR-T because cupy is built from source.

3. Perform the actions listed in Install AirStack Drivers in Conda Environment tutorial. This enables the AIR-T radio drivers to be callable from the new conda environment. The radio will not work inside the new environment unless these steps are followed, therefore they must be performed each time a new conda environment is created.

4. Download and install cuSignal:

$ git clone https://github.com/rapidsai/cusignal.git
$ conda activate cusignal
$ cd cusignal/python
$ python setup.py install

Now cuSignal should be installed on your AIR-T. You can test by running the code below.

Example: Polyphase Filter Using SimpleSoapy

The following Python code provides an example of how to use the SimpleSoapy interface to the radio drivers in conjunction with the resample_poly function of cuSignal. This is the source code to the above video.

1. Install SimpleSoapy by following the instructions in the Installation/SimpleSoapy in the Power Spectrum Measurement tutorial.

2. The following source code show how to execute the polyphase resampling filter on the AIR-T using SimpleSoapy.

import simplesoapy, cupy
import cusignal as signal
from matplotlib import pyplot as plt

buffer_size = 2**19  # Number of complex samples per transfer
fs = 62.5e6          # Sample rate

# Create polyphase filter
fc = 1. / max(16, 25)  # cutoff of FIR filter (rel. to Nyquist)
nc = 10 * max(16, 25)  # reasonable cutoff for our sinc-like function
win = signal.fir_filter_design.firwin(2*nc+1, fc, window=('kaiser', 0.5))
win = cupy.asarray(win, dtype=cupy.float32)

# Init buffer and polyphase filter
buff = signal.get_shared_mem(buffer_size, dtype=cupy.complex64)
s = signal.resample_poly(buff, 16, 25, window=win, use_numba=False)

#  Initialize the AIR-T receiver
sdr = simplesoapy.SoapyDevice(sample_rate=fs, channel=1, auto_gain=True)
sdr.freq = 1350e6  # Set receiver frequency
sdr.start_stream(buffer_size=buffer_size)

# Run test
sdr.read_stream_into_buffer(buff)
s = signal.resample_poly(buff, 16, 25, window=win, use_numba=False)
sdr.stop_stream()

# Plot signals
plt.figure(figsize=(7, 5))
plt.subplot(211)
plt.psd(cupy.asnumpy(buff), Fs=fs, Fc=sdr.freq, NFFT=16384)
plt.ylim((-160, -75))
plt.title('Before Filter')
plt.subplot(212)
plt.psd(cupy.asnumpy(s), Fs=fs*16/25, Fc=sdr.freq, NFFT=16384)
plt.ylim((-160, -75))
plt.title('After Filter')
plt.show()

3. To run the code, activate the conda environment, download the python source, and execute the polyphase_test.py application.

$ conda activate cusignal
$ wget docs.deepwavedigital.com/Open_Source/files/polyphase_filter.py
$ python polyphase_test.py


Last update: July 2, 2020