Skip to content

Add scipy.linalg.svd for faster SVD calculations

Shio Sakon requested to merge svd-swap into master

This MR arises from here.

Added

        try:
                U, s, Vh = scipy_svd(template_bank.T)
        except numpy.linalg.LinAlgError as e:
	        U, s, Vh = spawaveform.svd(template_bank.T,mod=True,inplace=True)
                print ("Falling back on spawaveform", e, file=sys.stderr)

to cbc_template_fir.py instead of U, s, Vh = spawaveform.svd(template_bank.T,mod=True,inplace=True).

This enables SVD calculation to be done with scipy rather than using spawaveform, making the calculation faster.

scipy method of calcuating SVDs sometimes fails, so when it does fail, the SVD calculation falls back to the spawaveform version of SVD calculation and leaves a message indicating that the SVD calculation used the spawaveform method.

When a single SVD job is run on headnode, it takes about 15 min for jobs run with scipy, while it takes overnight for jobs run with spawaveform. When SVD jobs are run as a dag, since about half of the jobs fall back on spawaveform, it takes about 12 hours to finish when running with scipy and it takes about 65 hours to finish when running with spawaveform.

Some rows in orthogonal_template_bank (=here) and mix_matrix (=here) have different +/- signs when comparing the output of the version run with scipy and spawaveform. The row numbers where the +/- signs differ are the same for orthogonal_template_bank and mix_matrix. It has been confirmed that the reconstructed matrix is the same when running SVD banks with scipy and spawaveform.

Edited by Shio Sakon

Merge request reports

Loading