Killed julia process with threads

I am calculating slices of a multivariate function, with and without threads (here, commented out):

function calculate_slice(f, x, i, xl, xu; n = 50)
    z = range(xl, xu; length = n)
    fz = zeros(n)
    #=Threads.@threads=# for j in 1:n
        y = vcat(x[1:(i-1)], z[j], x[(i+1):end])
        fz[i] = f(y)
    end
    (i = i, xi = x[i], z = z, fz = fz)
end

f here is very CPU- and memory-intensive (about 10K LOC + dependencies, so sorry, no MWE :slight_smile: ).

When I use threads, the julia process ends up killed with no error message. I am using the 1.4-rc branch.

Any hints on debugging this would be appreciated. Would something like this happen if Julia ran out of memory?

Is the Out of Memory Killer (OOM) killer being triggered?
On Linux use sudo dmesg to see if this is logged

6 Likes

Thanks, that’s what is happening:

$ dmesg | tail -3
[241730.696827] oom-kill:constraint=CONSTRAINT_NONE,nodemask=(null),cpuset=/,mems_allowed=0,global_oom,task_memcg=/user.slice/user-1000.slice/session-c1.scope,task=julia,pid=21662,uid=1000
[241730.696877] Out of memory: Killed process 21662 (julia) total-vm:15685904kB, anon-rss:12200080kB, file-rss:0kB, shmem-rss:0kB
[241731.105188] oom_reaper: reaped process 21662 (julia), now anon-rss:0kB, file-rss:0kB, shmem-rss:0kB