.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/4_GPU/plot_gpu_widgets.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note You can download :ref:`below ` the full example code and run it with 🔬 `Radis-Lab `__, .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_4_GPU_plot_gpu_widgets.py: .. _example_real_time_gpu_spectra: =============================================== Real-time GPU Accelerated Spectra (Interactive) =============================================== Example using GPU sliders and GPU calculation with :py:meth:`~radis.lbl.SpectrumFactory.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 :ref:`GPU Spectrum Calculation on RADIS ` .. note:: In some cases matplotlib immediately closes the window and returns; this is solved by running python in interactive mode as follows: ``python -i plot_gpu_widgets.py``. 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. .. GENERATED FROM PYTHON SOURCE LINES 26-49 .. image-sg:: /auto_examples/4_GPU/images/sphx_glr_plot_gpu_widgets_001.png :alt: plot gpu widgets :srcset: /auto_examples/4_GPU/images/sphx_glr_plot_gpu_widgets_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none /home/docs/checkouts/readthedocs.org/user_builds/radis/checkouts/latest/radis/db/molparam.py:252: FutureWarning: The 'delim_whitespace' keyword in pd.read_csv is deprecated and will be removed in a future version. Use ``sep='\s+'`` instead 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 /home/docs/checkouts/readthedocs.org/user_builds/radis/checkouts/latest/radis/lbl/factory.py:1107: FutureWarning: Calling float on a single element Series is deprecated and will raise a TypeError in the future. Use float(ser.iloc[0]) instead Can't find libcuda.so.1... /home/docs/checkouts/readthedocs.org/user_builds/radis/checkouts/latest/radis/gpu/gpu.py:112: 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.52s - Spectrum calculated | .. code-block:: Python from radis import SpectrumFactory from radis.tools.plot_tools import ParamRange sf = SpectrumFactory( 2150, 2450, # cm-1 molecule="CO2", isotope="1,2,3", wstep=0.002, ) sf.fetch_databank("hitemp") s = sf.eq_spectrum_gpu_interactive( var="radiance", 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", ) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 2.319 seconds) .. _sphx_glr_download_auto_examples_4_GPU_plot_gpu_widgets.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_gpu_widgets.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_gpu_widgets.py `