Feedback about A guide on good usage of non_blocking and pin_memory() in PyTorch
I maintainer di solito rispondono entro 2 giorni
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 35/100
- Tipo di issue
- Documentazione
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- python
- Ambito
- documentation
Direzione di ricerca
Inizia con la sezione del tutorial «Operazioni asincrone e sincrone con non_blocking=True (CUDA cudaMemcpyAsync)» e confronta il grafico di benchmark_with_profiler(streamed=True, pinned=True) con la funzione interna mostrata. Controlla l’ordine di sincronizzazione di t_star_cuda_h2d_event e t3_cuda_h2d_event. Il lavoro è completato quando il codice, il grafico e la spiegazione concordano, oppure quando la discrepanza è spiegata chiaramente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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
- Lingua principale
- Python
- Stelle
- 9.5k
- Fork
- 4.5k
- Merge medio
- 1g 20h
- PR unite (30g)
- 2
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pytorch/tutorials
-
module: vulkan
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
Feedback about Datasets & DataLoadersForse già presa @hippi345 l’ha presa 47 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 2 giorni
-
💡 [REQUEST] - Add model.eval() after loading the mdoelForse già presa @Justee21 l’ha presa 71 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
[BUG] Captum tutorial fails when visualize_image_attr() receives None for original_imageForse già presa @manjirisharma l’ha presa 41 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
pytorch/tutorials#3963 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
[BUG] - Incorrect ResNet18 preprocessing in Captum tutorialForse già presa @austxu l’ha presa 130 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di pytorch/tutorials
Issue simili
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
MakazhanAlpamys/Soup#3589 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
ClickHouse/clickhouse-connect#1266 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
biosustain/growthcurves_app#89 ·
I maintainer di solito rispondono entro 1 giorno
-
`LogProxyConsumer._on_relation_departed` raises `APIError` when the promtail service does not existAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
canonical/loki-k8s-operator#695 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno