sweverett / Balrog-GalSim

Modules for GalSim that will be useful for DES images in conjunction with Balrog.
MIT License
5 stars 5 forks source link

Speedups! #30

Open sweverett opened 6 years ago

sweverett commented 6 years ago

This will be open for a while - we will identify slow parts of the code that we can use to speed up injection. The latest run has injection taking nearly as long as runing SOF which is far too slow!

First up is handling large objects. I profiled the injection code and roughly half of the runtime is in _drawKImage(). Messing with max_T and min_T shows that a few very large objects (cm_T>10) can slow down a chip injection by well over 100% the mean time. This appears to be a bigger issue with the new combined catalog y3_balrog_test_input_mof as it has a larger cm_T tail.

We need to find a way to either:

  1. Make reasonable cuts combining cm_T and cm_T_err to reduce the size of the large T tail, or
  2. Make more aggressive cuts on max_T (possible selection issues), or
  3. Make a change to GalSim to allow error handling for the case of insufficient max_fft_size and explore its effect on selection.
  4. Some combination of all 3!

The other approach is to solve #6 which will certainly help speed up runtime, but it will have diminishing returns as 1% of objects can take ~90% of runtime in the worst cases.

sweverett commented 6 years ago

Erin suggested that we make a check in bal_config that will allow GalSim to use photon shooting for low surface brightness - large cm_T objects. This will make the configs a bit messy but could give large speedups for this class of objects.