GPU in PiNN training

Suppose there’s the following code for PiNN training:

for each epoch:
x=torch.linspace(0,1,batchsize)
loss.backward()
optimize
epoch++

How to use GPU?

Hi, You can add the device='cuda' parameter in linspace. It’ll resolve your issue. You can refer to the documentation for more details. Thanks!

1 Like

thanks khushi! It seems using either takes the same time on my pc. What data size will make a difference?

thanks khushi! It seems using either takes the same time on my pc. What data size will make a difference?

Hi! Thanks for pinging me; I somehow missed the notification earlier. Answer to your question: The larger the data points, the more difference it creates. From my experience, I usually see the difference in speeds from 1000-5000 data points. You can iterate it to a larger number to see a significant difference.

PS: I haven’t found the exact number anywhere.

1 Like