Skip to content

Commit 0d6cba7

Browse files
author
Vincent Moens
committed
amend
1 parent ea53204 commit 0d6cba7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

intermediate_source/pinmem_nonblock.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,10 +338,12 @@ def timer(cmd):
338338
# executing the transfer. This makes sense, since we're actually asking python to execute an operation that CUDA will
339339
# perform anyway before copying the data from host to device.
340340
#
341-
# .. note:: Here too, the observation may vary depending on the available hardware.
342-
# The pytorch implementation of
341+
# .. note:: The pytorch implementation of
343342
# `pin_memory <https://github.com/pytorch/pytorch/blob/5298acb5c76855bc5a99ae10016efc86b27949bd/aten/src/ATen/native/Memory.cpp#L58>`_
344-
# could be, in rare cases, faster than the corresponding CUDA version.
343+
# which relies on creating a brand new storage in pinned memory through `cudaHostAlloc <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html#group__CUDART__MEMORY_1gb65da58f444e7230d3322b6126bb4902>`
344+
# could be, in rare cases, faster than transitioning data in chunks as ``cudaMemcpy`` does.
345+
# Here too, the observation may vary depending on the available hardware, the size of the tensors being sent or
346+
# the amount of available RAM.
345347
#
346348
# ``non_blocking=True``
347349
# ~~~~~~~~~~~~~~~~~~~~~
@@ -738,5 +740,6 @@ def pin_copy_to_device_nonblocking(*tensors):
738740
#
739741
# - `CUDA toolkit memory management doc <https://docs.nvidia.com/cuda/cuda-runtime-api/group__CUDART__MEMORY.html>`_
740742
# - `CUDA pin-memory note <https://forums.developer.nvidia.com/t/pinned-memory/268474>`_
743+
# - `How to Optimize Data Transfers in CUDA C/C++ <https://developer.nvidia.com/blog/how-optimize-data-transfers-cuda-cc/>`_
741744
# - tensordict :meth:`~tensordict.TensorDict.to` method;
742745
#

0 commit comments

Comments
 (0)