[CRASH!] System crash/reboot on RTX 4090

username: rajatmodi62
cooked: <p>hi all,<br>
i am making this post after banging my head over these past 2 weeks of hell,<br>
my small brain  has exhausted all the things that it can think of.</p>
<p>My gpu is asus rtx 4090 overclock edition from tufts gaming<br>
os:ubuntu 22.04 .<br>
processor: intel 2X xeon 4214R CPU<br>
power supply:1650w &gt;&gt; 450 watt which 4090 requires.<br>
ram: 100 Gigs.</p>
<p>for some reason, running pytorch codes on it crashes the whole gpu and causes the machine to reboot.  more specifically, training the official repositories of detr and dino detr locally is enough to crash the machine.</p>
<p>here is the debug things i have tried:<br>
[1] ran a simple pytorch code</p>
<pre><code class="lang-auto">import torch 
import torch.nn as nn
import torch.optim as optim
x = torch.randn((1000000,700)).cuda()
print("shape", x.shape)
class model(torch.nn.Module):

    def __init__(self):
        super(model, self).__init__()
        self.l = nn.Linear(700,1000)
        self.l2 = nn.Linear(1000,700)
    def forward(self, x):
        x = self.l(x)
        x = self.l2(x)
        return x


m = model().cuda()
loss = nn.MSELoss()
adam = optim.Adam(m.parameters() ,lr=0.001,)

i = 0
while 1:
    print(i)
    i+=1
    out = m(x)
    l = loss(out, out + 1e-7)
    l.backward()
    adam.step()
</code></pre>
<p>this achieves 100% gpu utilization and reaches peak temps. this DOES NOT crash</p>
<p>[2] ran gpu burn, memtest for over 12 hours → all passed. eliminates power supply/ram issues.<br>
[3] however, running official detr/dino detr training code causes a lot of crashes.<br>
dinodetr can crash in such 40 training iterations.<br>
[4] machine works fine with other generations of cards like quadro and pascals.</p>
<p>now, this has led me to believe that this is a software issue and not a hardware one since simple benchmarking works.<br>
but, my expertise stops at knowing which precise call reproduces this issue,<br>
so, i would be grateful if someone could please give some suggestions:<br>
[1] is it my machine issue?<br>
[2] is it a nvidia-smi issue or a pytorch issue?<br>
i have tried both latest dev(430) and stable (425) drivers. also, tried cuda 11,11.7,12. all have the same issue.<br>
[3] or can it be my gpu issue?<br>
[4] are other people also facing such troubles?<br>
[5] i dont think it is a temperature issue, since most of the times the crashes happen even if temperature is in range.<br>
<a class="mention" href="/u/ptrblck">@ptrblck</a> and everyone, will be grateful for your guidance,<br>
can you think of anything that might be the cause,<br>
something (api) somewhere is doing something it shoudn’t <img src="https://discuss.pytorch.org/images/emoji/apple/frowning.png?v=12" title=":frowning:" class="emoji" alt=":frowning:" loading="lazy" width="20" height="20"> , but i cant think of it,<br>
thanks,<br>
rajat</p>

username: eqy
cooked: <p>Note that “100% GPU utilization” doesn’t necessarily imply maximum power/temperature stress so I’m not sure a thermal, power, (or other hardware-related) issue can be ruled out from your test script. Could you try to isolate a runnable portion of the detr/dino training code (e.g., using dummy random tensors instead of the actual data is fine) that reproduces the issue?</p>
<p>In most cases, we would not expect a software issue such as a misbehaving kernel to trigger a whole system crash/reboot.</p>

username: rajatmodi62
cooked: <p>cant do it since it runs fine for some training iterations and not for other ones, if it was some access issue, it should have crashed in first iteration only…</p>
<p>is there a code which i can run to eliminate hardware issues and is far more simpler.</p>

username: ptrblck
cooked: <p>The reboot points towards a weak or defect PSU and I would recommend swapping it our for a new one, even if temporarily, to check if this would help.</p>
<p>I won’t post the same on the other issues where you have tagged me and assume you will keep the GitHub issues updated.</p>

username: JWnew295
cooked: <p>I would power limit 4090 to 250-300w just in case GPU or PSU crash under the stress.  You should manually set up fan speed and make sure CPU and GPU are not running at high temperatures.  I run it around 250W and fan speed 40-45% with GPU temperature below 60C, CPU below 70C.  I choose this setting because it runs almost silent.  I also run it with side door open to reduce the temperature.</p>

username: jkdev
cooked: <p>Hi Rajat, did you solve this?</p>

username: rajatmodi62
cooked: <p><a class="mention" href="/u/eqy">@eqy</a> <a class="mention" href="/u/ptrblck">@ptrblck</a> <a class="mention" href="/u/jkdev">@jkdev</a> was never able to solve it. checked on two machines with two separate power supplies. did rma with asus 2 times, and checked 3 separate rtx 4090s versions of same compnay now. still same issue.</p>
<p>gpuburn and all other tests pass.<br>
i am clueless now, and have had multiple people reach out to me.<br>
will be grateful for your suggestions, if anyone can solve it , its you guys</p>

username: ptrblck
cooked: <p>You could check if <code>dmesg</code> or other system logging utils. would give you more information about why your system dies. I’m unaware of any 4090-specfic issues and similar errors reported here were due to the PSU.</p>

username: winpih
cooked: <p>I had same issue, but solved it using following method.</p>
<ol>
<li>Install cuda 12.2.2 version with 535.104.05 driver</li>
<li>Install pytorch nightly latest version(‘2.1.0.dev20230831+cu121’)</li>
</ol>
<p>I hope this solve your issue.</p>

username: ndaba
cooked: <p><a class="mention" href="/u/winpih">@winpih</a> Thank you for your suggestion.</p>
<p>May I ask how you installed those specific cuda and driver versions on linux?</p>