pytorch-hessian-eigenthings icon indicating copy to clipboard operation
pytorch-hessian-eigenthings copied to clipboard

Eigenvalue and eigenvector deviation with GPU hardware

Open AjinkyaBankar opened this issue 3 years ago • 2 comments

I have observed that the eigenvalues and eigenvectors change marginally if the underlying GPU or memory configurations are different. How to fix this issue? I am using random seed value to reproduce the results, but the hardware configuration change does not guarantee the exact eigenvalues and eigenvectors. It is affecting the accuracy of the algorithm. Can someone please help? Thank you.

AjinkyaBankar avatar Oct 12 '21 15:10 AjinkyaBankar

Only setting seed does not guarantee deterministic behaviour on GPU. Have you tried using torch.use_deterministic_algorithms or torch.backends.cudnn.deterministic. Here is an article about it just in case you haven't seen it https://pytorch.org/docs/stable/notes/randomness.html

devansh20la avatar Oct 12 '21 15:10 devansh20la

Hi devansh20la, I am already using the following: random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) torch.cuda.manual_seed_all(seed) torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False

AjinkyaBankar avatar Oct 12 '21 15:10 AjinkyaBankar