Skip to content

Commit

Permalink
Update cuda pinned memory note to include tensor.to (pytorch#20977)
Browse files Browse the repository at this point in the history
Summary:
separate bits of changes from pytorch#19228
Pull Request resolved: pytorch#20977

Differential Revision: D15511919

Pulled By: soumith

fbshipit-source-id: 5015a29cdac6d6e160388c493182c330f0da63ec
  • Loading branch information
ssnl authored and facebook-github-bot committed May 27, 2019
1 parent 1e8f129 commit bb89827
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/source/notes/cuda.rst
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ memory. CPU tensors and storages expose a :meth:`~torch.Tensor.pin_memory`
method, that returns a copy of the object, with data put in a pinned region.

Also, once you pin a tensor or storage, you can use asynchronous GPU copies.
Just pass an additional ``non_blocking=True`` argument to a :meth:`~torch.Tensor.cuda`
call. This can be used to overlap data transfers with computation.
Just pass an additional ``non_blocking=True`` argument to a
:meth:`~torch.Tensor.to` or a :meth:`~torch.Tensor.cuda` call. This can be used
to overlap data transfers with computation.

You can make the :class:`~torch.utils.data.DataLoader` return batches placed in
pinned memory by passing ``pin_memory=True`` to its constructor.
Expand Down

0 comments on commit bb89827

Please sign in to comment.