Commit f470c4c4 authored by Médéric Boquien's avatar Médéric Boquien

Use np.take() rather than fancy indexing on large arrays. This accelerates the...

Use np.take() rather than fancy indexing on large arrays. This accelerates the computation of the models by 10%.
parent 20909a00
......@@ -21,6 +21,7 @@
- By default the MKL library created many threads for each for the parallel processes. Not only was this not necessary as a high-level parallelisation already exists, but it generated a strong oversubscription on the CPU and on the RAM. The slowdown was over a factor of ~2 in some cases. Now we mandate KML to use only 1 thread fo each process. (Médéric Boquien & Yannick Roehlly)
- The generic numpy interpolation function was used. As we are in a well-controlled environment, this generated unnecessary verifications on the type and shape of the arrays. The compiled numpy interpolation function is now used, bypassing those checks. This generates a gain of 5-10% in computing speed for the generation of the models. (Médéric Boquien)
- The interpolation of the spectra of the different physical components on a new wavelength grid was not optimal as the interpolation was done separately for each component. Now a specific function has been implemented caching repetitive computations and vectorising the interpolation to compute it for all the components in a single step. This generates a gain of 10% in computing speed for the generation of the models. (Médéric Boquien)
- An optimisation in the sorting of a 2D array led to a gain of 10% in computing speed for the generation of the models. (Médéric Boquien)
## 0.10.0 (2016-09-15)
### Added
......
......@@ -364,7 +364,7 @@ def interpolate_lumin(wl, lumin, wl_new, lumin_new):
wl_best = np.concatenate((wl, wl_unique))
s = argsort_wl(wl_best)
wl_best = wl_best[s]
lumin_out = lumin_out[:, s]
lumin_out = np.take(lumin_out, s, axis=-1)
else:
wl_best = wl
lumin_out[:-1, :] = lumin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment