jacopo-chevallard / BEAGLE-general

Basic information to get started with the galaxy spectral modelling tool Beagle
https://www.iap.fr/beagle/
9 stars 0 forks source link

rebinning speed in v0.14.6 #52

Open alex-delavega opened 7 years ago

alex-delavega commented 7 years ago

Hi Jacopo,

Sorry I wasn't clear in #51 - I tried again, and using REBIN TEMPLATES = 10 in both v0.11.3 and v0.14.6 takes the same amount of time.

However, I played around with REBIN TEMPLATES in v0.14.6 and found the same issue I encountered before - namely that rebinning to 50 A (as opposed to 10 A) roughly doubled the fitting time. I also tried rebinning to 20 A, with the fit taking nearly as long as for 10 A. The .param files differ only by the value for REBIN TEMPLATES and the results directory.

In the Google Drive folder below is a .zip with my BEAGLE results, and a screenshot for each directory showing the times the output files were last modified, in case downloading from the Drive folder doesn't preserve timestamps. https://drive.google.com/drive/folders/0By93HuHE0CWlMTRTVVdZUU42OXM?usp=sharing

Any help would be wonderful! Thank you!

jacopo-chevallard commented 7 years ago

Hi alex, testing the actual speed I find that rebinning to 50 A allows Beagle to produce models faster, you can check this yourself by pulling v0.14.7 and run Beagle adding the "--test-speed/-ts" flag. This flag will run Beagle to test the speed of a single likelihood evaluation, I would be curious to see what you find for the rebin 10 A and 50 A cases.

It could be that rebinning to 50 A produces a more irregular likelihood surface, and so the algorithm takes longer to converge, even though a single likelihood evaluation is faster.

alex-delavega commented 7 years ago

Hi Jacopo,

I tried the above and found that with REBIN TEMPLATES = 10, a single likelihood evaluation takes 7.93e-02 seconds, while for REBIN TEMPLATES = 50, a single likelihood evaluation takes 0.12 seconds.

jacopo-chevallard commented 7 years ago

I tested the Beagle "native" (compiled) vs Docker (Docker version 17.03.1-ce, build c6d412e) performance on my MacBook (Mid-2014, OS X 10.11.6, 2.5 GHz Core i7, 16GB DDR3), finding the following

So, as you can see, I cannot reproduce your loss of performance when going from rebin 10 to rebin 50. Which machine/Docker version are you using?

alex-delavega commented 7 years ago

Hi Jacopo,

I'm using a MacBook (Mid 2015, OS X 10.11.6, 2.8 GHz Core i7, 16 GB DDR3) and Docker v17.06.0-ce-rc5-mac16, build 6cc0236e3b (this is the Docker Edge channel).

jacopo-chevallard commented 7 years ago

that's even stranger then, we have very similar settings, it should run even faster on your (newer) machine... I don't have many ideas at this point...

alex-delavega commented 7 years ago

Yeah, this is odd... what data are you using to test the performance? I could try on my machine, if you think that might be worthwhile.

alex-delavega commented 7 years ago

Hi Jacopo,

I was at last able to rebin the templates! It seems that I had kept EMISSION LINES CONFIGURATION commented out while using the nebular emission templates. Could uncommenting this explain the behavior I mentioned earlier?

For REBIN TEMPLATES = 10, a single likelihood evaluation takes 3.22E-2 sec, and for REBIN TEMPLATES = 25, 2.77E-2 sec.

Thank you so much!

Alex

jacopo-chevallard commented 7 years ago

That's great news! :) if you use the nebular emission templates you also need the EMISSION LINES CONFIGURATION keyword, ideally we should raise an error if not present...