-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Draft] Add Multigrid support #606
base: develop
Are you sure you want to change the base?
Conversation
@@ -1920,6 +2227,13 @@ def _apply_lineshape_LDM( | |||
if ``"min-RMS"`` weights optimized by analytical minimization of the RMS-error. | |||
Otherwise, weights equal to their relative position in the grid. | |||
|
|||
Other Parameters | |||
---------------- | |||
wavenumber_group: (int, int), or ``None`` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add mention of "all"
abscoeff_common.append(abscoeff_grid) | ||
|
||
# HACK STOP POINT For RADIS Community paper. Plot different abscoeff for all grids: | ||
if False: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete after paper
For my understanding, is this basically what SPEARS does? if not, how is it different? |
It is different from SPEARS. SPEARS basically builds one grid per line, and combines them ; therefore the grid is irregular which is not compatible with the DIT/DCS method where we need a regular grid to apply the convolution. Quoting our paper draft :
|
save some memory on very large ranges / low pressures (different from DIT Sparse 2021 algorithm where we apply masks on the grid of spectra after the DIT step. Here the sparse operation happens before DIT. ) next : multi grids
implement multigrid by adding the corresponding lineshapes add tests for overlapping-ranges, fix the function (wip) 1st version of multi-grid boundary effects corrections (when gluing multiple grids) Add fast interpolation of grids (which was the new limiting factor) Results : 2* faster than normal on an optimization=None example
(runs and returns a spectrum, but not all grids are aggregated yet)
(accuracy ~ok, still some interpolation problems) , speed is increased up to x10 in Sparse LDM mode (for cases with low number of lines where LDM_Distribute_lines is not the limiting factor), and slower with pure LDM
β¦/ wstep too large fix adaptative grid in non-eq calculations
β¦ion, make a numba version, make a Cython version numba version is the new default : ~ 10x faster
β¦computation of all spectral arrays after a SpectrumFactory calculation
β¦ization=None version without adaptative grid)
bc59427
to
e5be046
Compare
@dcmvdbekerom I updated the test conditions in the main PR tests ; so far I see mostly an improvement over a regular grid ; and no penalty in the worse conditions (i.e. dense spectra like our favorite 4.2 Β΅m CO2 band). |
Multigrid support in RADIS
tl;dr
optimisation=None
) & regular grid output : 4x speed-up in CO HITRAN exampleoptimization=simple
)self._multisparsegrid
and other hidden variables)(wstep, truncation)
parameters of each grid (and the number of grids. Maybe 2 are enough)optimization=None
)This will be particularly useful for "isolated-lines" spectra, i.e. :
π Combined with DIT (for "dense spectra") and sparse-DIT (for "dense-by-part spectra") it should make RADIS the ultimate, fastest code for every kind of spectra.
Other changes:
get_overlapping_ranges
Full-range calculations, low number of lines
With Optimization=None (no LDM) : x4
CO-HITRAN, 500 - 10,000 cm-1
Code : see at the bottom
Here are the performance details :
We see a x25 speed-up in the Voigt broadening part, and an overall x4 speedup in the full Lineshape broadening step (including aggregation of lines & interpolation of grids).
(Fig.1 13/08/23):
Grids are automatically refined around the line centers . Each grid is regular (i.e. constant wstep) which (will) allow the use of the DIT Algorithm. (Fig 2.)
Same, zoomed-out to see the multiple (3) and discontinued (multi-groups) grids (Fig 3.)
Code:
With Sparse LDM : x4
@dcmvdbekerom same calculations with LDM now : x6 speed-up ; and x10 if looking only at the line broadening part (Fig 5.)
Code : same as above, with the following changes:
Note : the example above was ran with CO HITRAN, with limited number of lines. For CO HITEMP below we see that the multigrid accelerates the LDM_convolve step, but does not change the LDM_Distribute_lines step (obviously)
With (non-sparse) LDM : x4
CO HITEMP version (same as above)
Acceleration by a factor of 5 (but non-sparse LDM is still very slow for such a large range)
Appendix - Adaptative grid in worse conditions
(non-sparse) LDM in dense regions : x1
Adaptative grid is developed for isolated-lines spectra. Below we deal with a very dense spectral region, i.E. the 4.2 Β΅m (2300 cm-1) band of CO2
Adaptative grid doesn't accelerate the calculations, but it doesn't slow it down neither