Training not stopping until interrupted on RTX 3060 Ti

Rana_Wasil: <p>Hi,<br>
I recently bought RTX 3060 Ti  GPU before that I used to work on the google collab free version (Tesla T4 GPU). I am working on a Computer vision project so I was working with YOLO v5 on collab so now I want to shift over to my local pc. I downloaded yolov5 on my local machine and made an environment variable for it and downloaded the required dependency libraries.<br>
How I downloaded the PyTorch and Cuda:</p>
<ol>
<li>Made an Environment variable using VS Community</li>
<li>Installed Pip</li>
<li>Then used the Pytorch site to download CUDA (cuda 11.7) I used below command:<br>
“pip3 install torch torchvision torchaudio --extra-index-url <a href="https://download.pytorch.org/whl/cu117" rel="noopener nofollow ugc">https://download.pytorch.org/whl/cu117</a>”</li>
</ol>
<p>Afterward, I verified if the GPU is working using below commands:</p>
<pre><code class="lang-auto">import torch
print(torch.cuda.is_available())
print(torch.cuda.get_device_name(0))
</code></pre>
<p>and it displayed the GPU there. Then I ran training for 3 epochs to test my gpu with same dataset which I used on collab that took only around 30 seconds to complete (Tesla T4 which has around 2000 Cuda cores less than RTX 3060 Ti)on the other hand my GPU kept running for around 3 hours but didn’t stop (So I Interrupted it)</p>
<p>NOTE: I didn’t download or used cudnn (as I followed a youtube tutorial and the guy didn’t download that). Secondly, When I start training my C Drive got filled up (I don’t know why) so I uninstalled python from C and downloaded it to D (but that again didn’t help). Thirdly my GPU utilization is avg 15 to 20 while training</p>
<p>Please help me in this matter I shall be really thankful to you guys as I have my University FYP due and this is making issues in doing my work smoothly.</p>

ptrblck: <p>Check which CUDA runtime you’ve installed and make sure it’s 11.x as older ones will not work with your Ampere GPU.<br>
Once done, add print debug statements to your code to check which lines are executes, where it gets stuck, or if the script is running as expected but is just slow in your local setup.</p>

Rana_Wasil: <p><img src="https://discuss.pytorch.org/uploads/default/original/3X/4/9/4903024708083a0e9ecc70e5c32e39dee79fdd9d.png" alt="1" data-base62-sha1="apTiIoU3gH6rj3YDdStrM11jZEx" width="489" height="113"><br>
This is the cuda my system has. Though I have downloaded 11.7 cuda via pytorch using the script in pip in the environment variable I created for PyTorch<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/3/a/3a917a2890a9b7c97af192816ddc69c0904fea01.png" data-download-href="https://discuss.pytorch.org/uploads/default/3a917a2890a9b7c97af192816ddc69c0904fea01" title="3"><img src="https://discuss.pytorch.org/uploads/default/original/3X/3/a/3a917a2890a9b7c97af192816ddc69c0904fea01.png" alt="3" data-base62-sha1="8m7nm4vPHdKzyC4USA7PP64Fopr" width="690" height="253" data-dominant-color="252525"><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">3</span><span class="informations">1515×557 30.5 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><br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/e/d/ed7beedec9fe39ec22fe902a57a60f9d994960c6.png" data-download-href="https://discuss.pytorch.org/uploads/default/ed7beedec9fe39ec22fe902a57a60f9d994960c6" title="4"><img src="https://discuss.pytorch.org/uploads/default/original/3X/e/d/ed7beedec9fe39ec22fe902a57a60f9d994960c6.png" alt="4" data-base62-sha1="xSSGwDJapUcB0JeMnU1ROKdKGuW" width="690" height="249" data-dominant-color="252525"><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">4</span><span class="informations">1149×416 12.1 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><br>
.<br>
I used only 5 images in training for 3 epochs to test and the Epochs info is not showing but this time it displayed the output.</p>

Rana_Wasil: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/6/1/614a4b0ed335b76916f57737a954621a00ea2fca.png" data-download-href="https://discuss.pytorch.org/uploads/default/614a4b0ed335b76916f57737a954621a00ea2fca" title="1"><img src="https://discuss.pytorch.org/uploads/default/original/3X/6/1/614a4b0ed335b76916f57737a954621a00ea2fca.png" alt="1" data-base62-sha1="dSFucil5kNOvKRW5HbbezkO4eq6" width="690" height="251" data-dominant-color="131313"><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">1</span><span class="informations">1932×705 34.1 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><br>
I have somehow made it work but now can you please let me know if it’s taking too much time while training as GPU utilization is 3 percent and CPU is 18 percent even though it’s showing GPU enabled in pytorch though I am running it in terminal not jupyter</p>

ptrblck: <p>A GPU utilization of 3% is quite low and based on your screenshot you are also using 0.75GB for your training?  This could indicate a small batch size, so you might want to increase it.<br>
Also, profiling the code (e.g. via Nsight Systems) would be helpful to narrow down bottlenecks of your code.</p>

Rana_Wasil: <p>Oh Ok, But when I put a batch size of 6 is get a Memory error. I am new to this and I don’t know what to do in this matter that’s why put 5 batch size.</p>