Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
how_to [2024/01/24 17:14] – [Measure memory used by GPUa?] habilhow_to [2024/01/24 17:14] (current) – [Measure memory used by GPUa?] habil
Line 5: Line 5:
 ---- ----
  
-==== Measure memory used by GPUa? ====+==== Measure memory used by GPUs? ====
  
 Use ''torch.cuda.[[https://pytorch.org/blog/understanding-gpu-memory-1/?hss_channel=tw-776585502606721024|memory]]'' , e.g., to discover the effect of clearing gradients at the end of each [[https://towardsdatascience.com/epoch-vs-iterations-vs-batch-size-4dfb9c7ce9c9|iteration]]. With ignite, this can be done using an event handler that calls ''optimizer.[[https://stackoverflow.com/questions/48001598/why-do-we-need-to-call-zero-grad-in-pytorch|zero_grad]](set_to_none=True)''.'' '' Use ''torch.cuda.[[https://pytorch.org/blog/understanding-gpu-memory-1/?hss_channel=tw-776585502606721024|memory]]'' , e.g., to discover the effect of clearing gradients at the end of each [[https://towardsdatascience.com/epoch-vs-iterations-vs-batch-size-4dfb9c7ce9c9|iteration]]. With ignite, this can be done using an event handler that calls ''optimizer.[[https://stackoverflow.com/questions/48001598/why-do-we-need-to-call-zero-grad-in-pytorch|zero_grad]](set_to_none=True)''.'' ''