PyTorch Developer Podcast
PyTorch Developer Podcast
Edward Yang, Team PyTorch
Jul 27, 2021 · 15 min

Asynchronous versus synchronous execution

MP3

CUDA is asynchronous, CPU is synchronous. Making them play well together can be one of the more thorny and easy to get wrong aspects of the PyTorch API. I talk about why non_blocking is difficult to use correctly, a hypothetical "asynchronous CPU" device which would help smooth over some of the API problems and also why it used to be difficult to implement async CPU (but it's not hard anymore!) At the end, I also briefly talk about how async/sync impedance can also show up in unusual places, namely the CUDA caching allocator.

Further reading.

This podcast uses Simplecast for stats and dynamic audio. What this means Episodes play from the podcast's own servers, unmodified. Not affiliated with Podbay.