When running a certain code, the screen goes black. What hardware problem?

I want to optimize the performance of my previous code:

using BenchmarkTools

function discrete_integrate(xvec::Vector, y1vec::Vector, y2vec::Vector, y3vec::Vector)
    s = zero(promote_type(eltype(xvec), eltype(y1vec), eltype(y2vec), eltype(y3vec)))
    for i in 1:length(xvec)-1
        s += (y1vec[i+1] * y2vec[i+1] * y3vec[i+1] + y1vec[i] * y2vec[i] * y3vec[i]) * (xvec[i+1] - xvec[i])
    end
    0.5 * s
end

function funF2(matSlωJ::Array{ComplexF64,3}, Zvec::Vector, ωvec::Vector, nJ::Int64, lm::Int64)
    resmat = zeros(ComplexF64, nJ, nJ, 2lm + 1, 2lm + 1)
    @sync for l1 = -lm:lm, l2 = -lm:lm
        idx1 = lm + l1 + 1
        idx2 = lm + l2 + 1
        Threads.@spawn for j1 = 1:nJ, j2 = 1:nJ
            resmat[j1, j2, idx1, idx2] = discrete_integrate(ωvec, Zvec, conj.(matSlωJ[idx1, :, j1]), matSlωJ[idx2, :, j2])
        end
    end
    resmat
end

function funF3(matSlωJ::Array{ComplexF64,3}, Zvec::Vector, ωvec::Vector, nJ::Int64, lm::Int64)
    resmat = zeros(ComplexF64, nJ, nJ, 2lm + 1, 2lm + 1)
    nω = length(ωvec)
    @sync for l1 = -lm:lm, l2 = -lm:lm
        idx1 = lm + l1 + 1
        idx2 = lm + l2 + 1
        Threads.@spawn for j1 = 1:nJ, j2 = 1:nJ
            s = zero(ComplexF64)
            for i in 1:(nω-1)
                tmpy1 = Zvec[i] * conj.(matSlωJ[idx1, i, j1]) * matSlωJ[idx2, i, j2]
                tmpy2 = Zvec[i+1] * conj.(matSlωJ[idx1, i+1, j1]) * matSlωJ[idx2, i+1, j2]
                s += (tmpy1 + tmpy2) * (ωvec[i+1] - ωvec[i])
            end
            resmat[j1, j2, idx1, idx2] = 0.5 * s
        end
    end
    resmat
end

matS = rand(ComplexF64, 5, 1000, 60);
impedance = rand(1000);
ωvec = collect(range(0.0, step=0.01, length=1000));

# @benchmark funF2($matS, $impedance, $ωvec, 60, 2)
# @benchmark funF3($matS, $impedance, $ωvec, 60, 2)

I ran @benchmark funF2($matS, $impedance, $ωvec, 60, 2) and my PC was fine. But as soon as I run @benchmark funF3($matS, $impedance, $ωvec, 60, 2), the screen will definitely go black immediately, and all the peripherals plugged into the back of the computer case will power off. The hard drive indicator light inserted into the front panel of the computer case, memory module RGB light, and fan are all working. Moreover, pressing the shutdown button at this time will not shut down. But when the power switch is turned off and immediately turned back on, it automatically turns on.

It has been tested on different machines, and other machines do not go black, so it is not a problem with the code. I have tested with different Julia versions on the same machine, but the screen still goes black, so it is not a bug in the Julia version. So it should be a hardware problem.

But what hardware problem is that? Did funF3 bring more pressure than funF2 to memory module or CPU?

And I have wiped the connecting finger of memory module. It didn’t work.


This is my computer hardware information:

Do you know what model and wattage your computer’s power supply is?

1 Like

To test if it is an issue with the power-supply or CPU, you can run a generic stresstest like prime95.

If it is a power issue, then it should also occur if you stress test the GPU (e.g. with FurMark).

If the GPU stress test does not crash, then it could be a thermal issue, i.e. the CPU just gets too hot under load probably caused by setting up the cooling improperly. I don’t think the CPU is broken per se because that would likely manifest during boot already.

If both crash, then it sounds like an issue with the power supply (as @mike.ingold suggests). Either it is generally too weak or it might be broken.

In any case, it doesn’t hurt to check the RAM for errors with memtest86+ (you need to create a bootable USB stick with this though).

Please note: For further assistance with hardware issues, there are probably better places to look than a Julia forum.

3 Likes