Closed mohamad-amin closed 2 years ago
How large are you talking? And does it need to be the full cholesky factorization (rather than just a pivoted version).
If under ~50k x 50k, just use torch.linalg.cholesky
or our helper gpytorch.utils.psd_safe_cholesky
.
Above that, you're probably going to run into memory issues just storing the matrix in memory so you can't really do a great job forming the cholesky and a pivoted cholesky is going to be your only option.
It's at most 90k x 90k. My RAM is 192GB so it fits A and it's cholesky, but np.cho_factor throws segmentation fault (probably because the memory cost is more than n^2? idk), and I'm working with 4 * V100s each having 32GB. What do you think is my best shot?
You could try it in float instead of double? but otherwise a really high rank pivoted cholesky might be okay as well.
So there's no way that I can use gpytorch.utils.psd_safe_cholesk
on this (double precision)?
Feel free to try but it might run out of memory.
Is there any implementation for the "really high rank pivoted cholesky" in GPytorch?
Ugh, it got wiped out from the docs recently. But it should be accessible from this command:
gpytorch.functions.pivoted_cholesky(mat, rank=5000)
Sorry, one more question. If I go with the float32 option, can I use torch.linalg.cholesky
? I mean, the matrix doesn't fit in one GPU but I have four of them and it will fit in four of them, but not sure if I can torch.linalg.cholesky
on a matrix that is stored in multiple GPUs (actually I'm not even sure how I can store a tensor on multiple GPUs, sorry I haven't worked with PyTorch much).
Also, I just pip install gpytorch
d and gpytorch.utils.psd_safe_cholesky
doesn't exist.
I can't comment on using torch.linalg.cholesky across multiple gpus.
Oops, should be gpytorch.utils.cholesky.psd_safe_cholesky
I believe.
Closing for now as I think this is out of scope, hopefully the pivoted cholesky factorization produced something reasonable for you.
I was not able to store a matrix of that size even on a reasonably large GPU.
I guess the title is saying everything.