evanberkowitz / two-dimensional-gasses

Let's crush it
0 stars 0 forks source link

Fix/h5 on gpus #66

Closed evanberkowitz closed 1 year ago

evanberkowitz commented 1 year ago

Closes #64

evanberkowitz commented 1 year ago

This works. In terms of writing data rather than pickling. However, it raises additional issues. First, insanely, torch's .__version__ differs depending on the presence or absence of cuda. On my machine it is 1.13.0 but on jureca it is 1.13.0+cu117.

One work around is to use torch.__version__.split('+')[0] instead of torch.__version__. However, I thought that just passing strict=False to from_h5 would succeed. That was mistaken. The issue is that the strict flag does not get passed down.

evanberkowitz commented 1 year ago

Even after forwarding strictness I could not get free from the CUDA device complaint. One issue was that Potential.spheres is a list, and there was no ListStrategy. I added one in 35f7b2234a559f74dd684a28e0008da3a3408d2a. But that only overcame the first obstacle.

Action.quenched is a nasty thing of type torch.distributions.multivariate_normal.MultivariateNormal, and that thing has device sensitivity in it. Torch has torch.{save,load} for saving all sorts of things (models, etc.). It works on the torch distributions! So I implemented a TorchObject strategy for saving torch things other than tensors that we might want to save.