Skip to content

Refactor loading autocorrelation matrix from xml

@manoj.kovalam and I recently tried to understand the function cuda_postcoh_autocorr_from_xml. The style is old, and it was generally hard to follow.

The function loads the autocorrelation matrix from each template, and writes it to GPU.

Changes

I've tried a refactor, mostly some rearranging to group each step more consistently and rename variables a bit more clearly (and hopefully not too verbosely).

A few points of interest:

  1. The 'fname' read in is actually a string of the form "<ifoname>:<bank filepath>,<ifoname2>:<bank filepath2>,<etc.>". I've tried calling it ifo_banknames.
  2. ifo_banknames is parsed a little differently now. It now checks whether a recognized IFO name is used, but looks a Little more opaque and technical. I think it's in a self contained block so it should be ok.
  3. The full process of reading & writing to GPU is done one IFO at a time. The result is a single long function rather than a few clear steps. The only reason to do it that way is to save on CPU memory, reducing the total by a factor of the number of IFOs. As it is, the function uses sizeof(COMPLEX_F) * num_templates * autochisq_len, which is 8 * 1000 * 351 = 2.8MB. It's large enough that I think it's not worth refactoring at least.
  4. I added an explicit check that all IFOs have the same number of templates and autochisq length.

Testing

I've tested on an 8000s injection test, and get the exact same results.

Edited by Timothy Davies

Merge request reports