DataParallel: Different performance depending on the GPU Type

mzimmer: <p>I have two nodes that have 4 GPUs each, the one having 4x Nvidia A100, the other having 4x Nvidia A40.</p>
<p>When performing exactly the same Neural Network Training on both nodes individually, the Nvidia A100 run is performing way better, despite all settings (batch size, learning rate, etc) being the same (See the graphic below.).  I am using DataParallel since DistributedDataParallel is not an option currently. I verified this using multiple different initialization seeds and the pattern is clear: runs on the A100 node clearly outperform the runs on the A40 node. For some settings, the A40 runs were not even able to significantly change the loss.</p>
<p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/e/0/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758.png" data-download-href="https://discuss.pytorch.org/uploads/default/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758" title="grafik"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/e/0/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758_2_690x237.png" alt="grafik" data-base62-sha1="w4ze9Mue8QedlrDNe1v7b5qeYvm" width="690" height="237" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/e/0/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758_2_690x237.png, https://discuss.pytorch.org/uploads/default/optimized/3X/e/0/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758_2_1035x355.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/e/0/e0c9c34bea6b2bffe4a54d4b2b86e2aaaad2e758_2_1380x474.png 2x" data-dominant-color="FEFEFD"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">grafik</span><span class="informations">1474×507 27.9 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>How is this possible that the compute infrastructure is playing such a huge role? What kind of bug am I missing here?</p>
<p>Update: When restricting the number of GPUs per run to 2 instead of 4, all runs seem to work fine. Whats the catch here? Why is Pytorch failing when using 4xA40 at the same time?</p>

ptrblck: <p>Are you seeing any other issues in your current A40 setup if all GPUs are used e.g. by running the <a href="https://github.com/NVIDIA/nccl-tests">nccl-tests</a>? I’m wondering if the communication itself fails between all 4 devices as it seems that 2 devices work fine.</p>

mzimmer: <p>Thanks for the answer. I haven’t tested nccl-tests yet and will check out if I can get it to work. Any particular test configurations that should be interesting in this case?</p>
<p>Apart from that, I was using these A40-nodes without DataParallel without problems, mostly using all 4 at once where each GPU had a single or two individual runs going (e.g. no communication between the GPUs was necessary).</p>

ptrblck: <aside class="quote no-group" data-username="mzimmer" data-post="3" data-topic="154700">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/mzimmer/48/31510_2.png" class="avatar"> mzimmer:</div>
<blockquote>
<p>Any particular test configurations that should be interesting in this case?</p>
</blockquote>
</aside>
<p>No, I would just run them all and check a) if mismatches are detected and b) if the perf. is expected.</p>