Feedback about A guide on good usage of non_blocking and pin_memory() in PyTorch
Los mantenedores suelen responder en 2 días
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Documentación
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- documentation
Línea de trabajo
Comienza con la sección del tutorial «Operaciones asíncronas frente a síncronas con non_blocking=True (CUDA cudaMemcpyAsync)» y compara el gráfico de benchmark_with_profiler(streamed=True, pinned=True) con la función interna mostrada. Comprueba el orden de sincronización de t_star_cuda_h2d_event y t3_cuda_h2d_event. Se considera terminado cuando el código, el gráfico y la explicación coinciden, o cuando la discrepancia está claramente explicada.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
There is the following issue on this page: https://docs.pytorch.org/tutorials/intermediate/pinmem_nonblock.html#asynchronous-vs-synchronous-operations-with-non-blocking-true-cuda-cudamemcpyasync
In section "Asynchronous vs. Synchronous Operations with non_blocking=True (CUDA cudaMemcpyAsync)", for the plot for the command benchmark_with_profiler(streamed=True, pinned=True), if we look at the pink cudaEventSynchronize blocks, it seems like first, the event on the stream on which the tensor multiplication (t3_cuda_mul = t3_cuda * t3_cuda * t3_cuda) is happening is being synchronized, and then the event on the stream on which the transfer (t1_cuda = t1_cpu_pinned.to(device, non_blocking=True)) is happening is being synchronized.
However, in the code in the same page, the order is reverse (first t_star_cuda_h2d_event is synchronized which is the event on the stream of transfer, and then t3_cuda_h2d_event which is the event of the stream of multiplication):
# The function we want to profile
def inner(pinned: bool, streamed: bool):
with [torch.cuda.stream](https://docs.pytorch.org/docs/stable/generated/torch.cuda.stream.html#torch.cuda.stream)([s](https://docs.pytorch.org/docs/stable/generated/torch.cuda.Stream.html#torch.cuda.Stream)) if streamed else contextlib.nullcontext():
if pinned:
t1_cuda = [t1_cpu_pinned](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor).to([device](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device), non_blocking=True)
else:
t2_cuda = [t2_cpu_paged](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor).to([device](https://docs.pytorch.org/docs/stable/tensor_attributes.html#torch.device), non_blocking=True)
t_star_cuda_h2d_event = [s.record_event](https://docs.pytorch.org/docs/stable/generated/torch.cuda.Stream.html#torch.cuda.Stream.record_event)()
# This operation can be executed during the CPU to GPU copy if and only if the tensor is pinned and the copy is
# done in the other stream
[t3_cuda](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor)_mul = [t3_cuda](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor) * [t3_cuda](https://docs.pytorch.org/docs/stable/tensors.html#torch.Tensor) * t3_cuda
t3_cuda_h2d_event = [torch.cuda.current_stream](https://docs.pytorch.org/docs/stable/generated/torch.cuda.current_stream.html#torch.cuda.current_stream)().record_event()
t_star_cuda_h2d_event.synchronize()
t3_cuda_h2d_event.synchronize()
Hence, I think there might be a slight discrepancy between the code and the images (please correct me if I am misinterpreting anything here). It definitely doesn't change the conclusions any bit, but just thought it would be nice to bring to light, as I got confused for a second there.
Thanks a lot!
Best,
Shashank
- Lenguaje dominante
- Python
- Estrellas
- 9.5k
- Forks
- 4.5k
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytorch/tutorials
-
module: vulkan
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
Feedback about Datasets & DataLoadersPosiblemente ocupada @hippi345 la tomó hace 47 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 2 días
-
💡 [REQUEST] - Add model.eval() after loading the mdoelPosiblemente ocupada @Justee21 la tomó hace 71 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
Los mantenedores suelen responder en 2 días
-
[BUG] Captum tutorial fails when visualize_image_attr() receives None for original_imagePosiblemente ocupada @manjirisharma la tomó hace 41 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
pytorch/tutorials#3963 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
[BUG] - Incorrect ResNet18 preprocessing in Captum tutorialPosiblemente ocupada @austxu la tomó hace 130 días. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 2 días
Todos los issues de pytorch/tutorials
Issues similares
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount duePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 79/100
developmentseed/titiler-covjson#164 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
awslabs/visual-asset-management-system#2164 ·
Los mantenedores suelen responder en 1 día
-
needs-triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
MakazhanAlpamys/Soup#3589 ·
Los mantenedores suelen responder en 1 día
-
channels status reports the wrong Enabled value for Feishu instances and default-enabled WebSocketAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día