summaryrefslogtreecommitdiff
path: root/docs/source/notes
diff options
context:
space:
mode:
authorSsnL <SsnL@users.noreply.github.com>2017-11-07 17:00:38 -0500
committerSoumith Chintala <soumith@gmail.com>2017-11-07 17:00:38 -0500
commitbb1b826cdcc7b22caf267e99cba096a0b29d7b57 (patch)
tree69a89beec675548d50037cddf98f661e59a85d39 /docs/source/notes
parentf3c7bb9bc19bc9f87a118da1a9075c7fa597344a (diff)
downloadpytorch-bb1b826cdcc7b22caf267e99cba096a0b29d7b57.tar.gz
pytorch-bb1b826cdcc7b22caf267e99cba096a0b29d7b57.tar.bz2
pytorch-bb1b826cdcc7b22caf267e99cba096a0b29d7b57.zip
Exposing emptyCache from allocator (#3518)
* Add empty_cache binding * cuda.empty_cache document * update docs
Diffstat (limited to 'docs/source/notes')
-rw-r--r--docs/source/notes/cuda.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/docs/source/notes/cuda.rst b/docs/source/notes/cuda.rst
index 0831f6424d..305d6d4f75 100644
--- a/docs/source/notes/cuda.rst
+++ b/docs/source/notes/cuda.rst
@@ -42,6 +42,16 @@ Below you can find a small example showcasing this::
d = torch.randn(2).cuda(2)
# d.get_device() == 2
+Memory management
+-----------------
+
+PyTorch use a caching memory allocator to speed up memory allocations. This
+allows fast memory deallocation without device synchronizations. However, the
+unused memory managed by the allocator will still show as if used in
+`nvidia-smi`. Calling :meth:`~torch.cuda.empty_cache` can release all unused
+cached memory from PyTorch so that those can be used by other GPU applications.
+
+
Best practices
--------------
@@ -50,7 +60,7 @@ Device-agnostic code
Due to the structure of PyTorch, you may need to explicitly write
device-agnostic (CPU or GPU) code; an example may be creating a new tensor as
-the initial hidden state of a recurrent neural network.
+the initial hidden state of a recurrent neural network.
The first step is to determine whether the GPU should be used or not. A common
pattern is to use Python's ``argparse`` module to read in user arguments, and