Note
Run this example online :
GPU Accelerated Spectra¶
Example using GPU calculation with eq_spectrum_gpu()
This method requires CUDA compatible hardware to execute. For more information on how to setup your system to run GPU-accelerated methods using CUDA and Cython, check GPU Spectrum Calculation on RADIS
Note
in the example below, the GPU code runs on CPU, using the parameter emulate=True
.
In your environment, to run the GPU code with the full power of the GPU, remove this line
or set emulate=False
(default)

In ``/home/docs/.radisdb/hitemp`` keep only relevant input files:
/home/docs/.radisdb/hitemp/CO2-02_02125-02250_HITEMP2010.hdf5
/home/docs/.radisdb/hitemp/CO2-02_02250-02500_HITEMP2010.hdf5
Number of lines loaded: 1128265
Finished calculating spectrum!
1.09s - Spectrum calculated
Spectrum Name: CO2-hitemp-radisdb-1100.0K-#6816
Spectral Quantities
----------------------------------------
abscoeff [cm-1] (150,001 points)
absorbance (150,001 points)
emissivity (150,001 points)
emissivity_noslit (150,001 points)
transmittance_noslit (150,001 points)
radiance_noslit [mW/cm2/sr/cm-1] (150,001 points)
transmittance (150,001 points)
Physical Conditions
----------------------------------------
Tgas 1100.0 K
Trot 1100.0 K
Tvib 1100.0 K
isotope 1,2,3
mole_fraction 0.8
molecule CO2
overpopulation None
path_length 0.2 cm
pressure_mbar 1000.0 mbar
rot_distribution boltzmann
self_absorption True
state X
thermal_equilibrium True
vib_distribution boltzmann
wavenum_max 2450.0000 cm-1
wavenum_min 2150.0000 cm-1
Computation Parameters
----------------------------------------
NwG 3
NwL 6
Tref 296 K
add_at_used
broadening_method voigt
cutoff 0 cm-1/(#.cm-2)
dbformat hitemp-radisdb
dbpath /home/docs/.radisdb/hitemp/CO2-02_02125-02250_HITEMP2010.hdf5,/home/docs/.radisdb/hitemp/CO2-02_0225...
default_output_unit cm-1
diluent air
diluents None
emulate_gpu True
folding_thresh 1e-06
include_neighbouring_lines True
memory_mapping_engine auto
neighbour_lines 0 cm-1
optimization simple
parfuncfmt hapi
parsum_mode full summation
profiler {'spectrum_calculation': {'scaled_S0': 0.043459660000280564, 'calc_other_spectral_quan': 0.005031825...
pseudo_continuum_threshold 0
radis_version 0.14
sparse_ldm auto
spectral_points 150000.0
truncation 50 cm-1
waveunit cm-1
wstep 0.002 cm-1
zero_padding -1
Config parameters
----------------------------------------
DEFAULT_DOWNLOAD_PATH ~/.radisdb
GRIDPOINTS_PER_LINEWIDTH_ERROR_THRESHOLD 1
GRIDPOINTS_PER_LINEWIDTH_WARN_THRESHOLD 3
SPARSE_WAVERANGE auto
Information
----------------------------------------
calculation_time 1.0896017839995693 s
chunksize None
db_use_cached True
dxG 0.1375350788016573
dxL 0.20180288881201608
export_lines False
export_populations None
export_rovib_fraction False
levelsfmt radis
lines_calculated 1,128,265
load_energies False
lvl_use_cached True
parfuncpath None
total_lines 1128265
warning_broadening_threshold 0.01
warning_linestrength_cutoff 0.01
wavenum_max_calc 2450.0000 cm-1
wavenum_min_calc 2150.0000 cm-1
----------------------------------------
<matplotlib.lines.Line2D object at 0x7fcf74a9a730>
from radis import SpectrumFactory
sf = SpectrumFactory(
2150,
2450, # cm-1
molecule="CO2",
isotope="1,2,3",
wstep=0.002,
)
sf.fetch_databank("hitemp")
s = sf.eq_spectrum_gpu(
Tgas=1100.0, # K
pressure=1, # bar
mole_fraction=0.8,
path_length=0.2, # cm
emulate=True, # if True, runs CPU code on GPU. Set to False or remove to run on the GPU
)
print(s)
s.apply_slit(0.5) # cm-1
s.plot("radiance", show=True)
Total running time of the script: ( 0 minutes 2.784 seconds)