Skip to content

If the SVD algorithm gesdd fails, try gesvd instead.#386

Merged
mtfishman merged 2 commits intoITensor:v3from
chuffa:v3
Mar 19, 2021
Merged

If the SVD algorithm gesdd fails, try gesvd instead.#386
mtfishman merged 2 commits intoITensor:v3from
chuffa:v3

Conversation

@chuffa
Copy link
Copy Markdown
Contributor

@chuffa chuffa commented Mar 18, 2021

hopefully a simple fix for some larger computations.

@mtfishman
Copy link
Copy Markdown
Member

Great, thanks! Did you check that this fixes issues that you were seeing?

@chuffa
Copy link
Copy Markdown
Contributor Author

chuffa commented Mar 18, 2021

No unfortunately I would have to start a calculation on the cluster, I think sophie might try it, because she has set up everything with the exact parameters that caused the problem.

@mtfishman
Copy link
Copy Markdown
Member

Ok, do you want to wait to confirm that this fixes the problems you were seeing before merging? I still think it's useful, but maybe there is something else going on in the case you were seeing as well.

@titaschanda
Copy link
Copy Markdown

Hi, I have been using gesdd and gesvd for ITensors for a long time (using a custom svd implementation based on Armadillo's wrapper of LAPACK, where I have implemented similar fallback). I want to add that gesdd fails pretty often and the parameters for which it happens entirely depends on underlying LAPACK implementation as well as the CPU running it, older CPU without AVX512 fails more often for Intel MKL. However, the above technique of falling back to gesvd always works.

@mtfishman
Copy link
Copy Markdown
Member

That's helpful, thanks!

…first and if this fails uses gesvd instead.
@chuffa
Copy link
Copy Markdown
Contributor Author

chuffa commented Mar 19, 2021

Hi,

As we discussed, I added a default SVDMethod flag called "automatic". An SVD called with this flag first uses gesdd and if that fails it tries gesvd.
Using any other flag, ITensor tries the specified algorithm, and if it fails it fails.

I also found a problem in my original commit: gesdd destroys the data and if it fails the data needs to be reinitialized.

I tested that all flags work as expected using print statements
I also tested that if gesvd is called after gesdd failed the result is correct (I simply modified the info variable to mimic a failure of gesdd).

For our workflow it would be simplest to put this change into ITensor since I am not runing the calculation that previously failed.

Cheers Daniel

@mtfishman
Copy link
Copy Markdown
Member

Thanks Daniel! Looks good, I'll merge. I'll need to add the same feature to the Julia version.

@mtfishman mtfishman merged commit 1ce0d0a into ITensor:v3 Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants