evanberkowitz / two-dimensional-gasses

Let's crush it
0 stars 0 forks source link

.to_h5 pickles tensors on the GPU #64

Closed evanberkowitz closed 1 year ago

evanberkowitz commented 1 year ago

I tried moving an h5 file from JURECA to my machine, but the data on JURECA had been on the GPU, and my (nVidia-free) computer complained

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

I believe the fix is to call .cpu() inside the TorchStrategy.write method. But if we do that then when we read it back presumably it will be on the cpu! So we should also modify the TorchStrategy.read to send the read data to the default device.

evanberkowitz commented 1 year ago

Close when merged into devel.