Real-time GPU Accelerated Spectra (Interactive)

Example using GPU sliders and GPU calculation with eq_spectrum_gpu_intereactive()

This method requires a GPU - Currently, only Nvidia GPU’s are supported. For more information on how to setup your system to run GPU-accelerated methods using CUDA, check GPU Spectrum Calculation on RADIS


In some cases matplotlib immediately closes the window and returns; this is solved by running python in interactive mode as follows: python -i

in the example below, the code runs on the GPU by default. In case no Nvidia GPU is detected, the code will instead be ran on CPU. This can be toggled manually by setting the backend keyword either to 'gpu-cuda' or 'cpu-cuda'. The run time reported below is for CPU.

plot gpu widgets
In ``/home/docs/.radisdb/hitemp`` keep only relevant input files:
Can't find
/home/docs/checkouts/ NoGPUWarning:

Failed to load CUDA context, this happened either becauseCUDA is not installed properly, or you have no NVIDIA GPU. Continuing with emulated GPU on CPU...This means *NO* GPU acceleration!

Number of lines loaded: 1128265

mode: CPU
Finished calculating spectrum!
0.59s - Spectrum calculated

from radis import SpectrumFactory
from import ParamRange

sf = SpectrumFactory(
    2450,  # cm-1


s = sf.eq_spectrum_gpu_interactive(
    Tgas=ParamRange(300.0, 2500.0, 1500.0),  # K
    pressure=ParamRange(0.1, 2, 1),  # bar
    mole_fraction=ParamRange(0, 1, 0.8),
    path_length=ParamRange(0, 1, 0.2),  # cm
    slit_function=ParamRange(0, 1.5, 0.5),  # cm-1
    plotkwargs={"wunit": "nm"},  # "nfig": "same",

Total running time of the script: (0 minutes 3.126 seconds)