PyTorch Execution Times Query

chaosdoc: <p>As a new user of PyTorch, I have come to learn that it generically can be much slower in execution time on Windows versus native Linux OS (up to 10X?).  As an option, should I be considering the use of Windows Subsystem for Linux (WSL) instead to help remedy this slowdown issue?  If so, how does WSL-based execution times compare in general to native Linux-based ones?  Can I get there or should I just consider installing native Linux OS on a removable HD, for example, and start all over with the CUDA, cuDNN, and PyTorch installation saga?  And if so, what is recommended to replace Microsoft Visual Studio for the IDE platform?  Also, if there is anything else I can do with my current Windows-based installation to speed things up, please let me know…</p>

ptrblck: <aside class="quote no-group" data-username="chaosdoc" data-post="1" data-topic="173614">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/c/35a633/48.png" class="avatar"> chaosdoc:</div>
<blockquote>
<p>and start all over with the CUDA, cuDNN, and PyTorch installation saga?</p>
</blockquote>
</aside>
<p>There is no need to go on this adventure, as the PyTorch binaries ship with their own CUDA libraries since their initial release (including cuDNN, NCCL, cuBLAS etc.).<br>
You would only need to install a proper NVIDIA driver (not the full CUDA toolkit) and run <code>pip install torch</code> to install the latest stable release with CUDA 11.7.</p>
<p>If you want to build PyTorch from source or any custom CUDA extension, you would still need to install a CUDA toolkit locally.</p>

chaosdoc: <p>Thanks for the information about what PyTorch comes with natively.  Still would like to hear about improving the performance of PyTorch in Windows with the alternatives I proposed.  Which one should I try, given that the slowdown in Windows is quite significant?</p>

ptrblck: <p>I don’t know enough about Windows and would need to learn more about:</p>
<aside class="quote no-group" data-username="chaosdoc" data-post="1" data-topic="173614">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/c/35a633/48.png" class="avatar"> chaosdoc:</div>
<blockquote>
<p>I have come to learn that it generically can be much slower in execution time on Windows versus native Linux OS (up to 10X?).</p>
</blockquote>
</aside>
<p>and where this claim comes from.</p>

chaosdoc: <p>Thanks for the reply.  Should I then post my inquiry in another forum category or wait for someone to chime in here in this one?  The claim actually comes from other forums on several occasions {e.g., <a href="https://github.com/pytorch/pytorch/issues/22083" rel="noopener nofollow ugc">Example #1</a> and <a href="https://discuss.pytorch.org/t/why-the-inference-speed-differs-a-lot-between-windows-and-linux-on-pytorch-cpu/103888">Example #2</a>}.  I also already confirmed this in own case between my native hefty Windows workstation platform and a team with a much less capable laptop using native Linux for the same PyTorch program and using only the CPUs at this point.</p>

ptrblck: <p>I think the category is correct and you might need to wait for a Windows expert to chime in.<br>
Based on a quick check of the mentioned issues it might come down to some driver settings (if you are using the GPU) or some CPU libraries which might not be optimized (e.g. the last post in the first link claims to see a 10x slowdown on the CPU).<br>
I’m of course biased as I’m personally using Linux, but you might consider also trying it out and compare the speed to your Windows system.</p>