Julia optimizations causing crash on ubuntu while sorting multidim arrays

Hi all,

I’ve been using Julia on Macs for years and just got a Linux box. After installing Julia (via apt) recently, I am getting crashes sorting multidim arrays with -O2 and -O3, but not with -O0 and -O1. (Details below.)

I may be googling the wrong terms, but I haven’t found anything directly relevant. I also haven’t tried building from source yet, which I don’t mind doing but am hoping to avoid it. (Life is just easier if I can maintain Julia through apt.) Has someone seen something like this before? Is this an issue with LLVM or related library?

Thanks!

Kevin

===================

In more detail:

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04 LTS Release: 20.04 Codename: focal julia -O0 _
_ _ ()_ | Documentation: [snip]
() | () () |
_ _ | | __ _ | Type “?” for help, “]?” for Pkg help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 1.4.1
/ |_|||_’_| | Ubuntu ⛬ julia/1.4.1+dfsg-1
|__/ |

┌ Warning: Terminal not fully functional
└ @ Base client.jl:374
julia> using InteractiveUtils

julia> versioninfo()
Julia Version 1.4.1
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: Intel(R) Core™ i9-10940X CPU @ 3.30GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = [snip]

julia> sort(randn(3,3);dims=1)
3×3 Array{Float64,2}:
-0.940945 -0.210062 -1.03662
-0.68858 0.331558 -0.943664
0.184526 0.510515 0.286935

julia> sort(randn(3,3);dims=2)
3×3 Array{Float64,2}:
-1.82729 -0.0977983 0.113575
0.038866 0.0777665 0.129551
-1.66876 1.27607 2.14418

julia>
$ julia -O2
_
_ _ ()_ | Documentation: [snip]
() | () () |
_ _ | | __ _ | Type “?” for help, “]?” for Pkg help.
| | | | | | |/ ` | |
| | |
| | | | (
| | | Version 1.4.1
/ |_|||_’_| | Ubuntu ⛬ julia/1.4.1+dfsg-1
|__/ |

┌ Warning: Terminal not fully functional
└ @ Base client.jl:374
julia> sort(randn(3,3);dims=1)
3×3 Array{Float64,2}:
0.742523 -1.35216 -0.814475
1.31338 -0.944469 0.00899153
2.07566 -0.720284 1.34964

julia> sort(randn(3,3);dims=2)
Illegal inttoptr
%37 = ptrtoint double addrspace(13)* %36 to i64
Illegal inttoptr
%56 = inttoptr i64 %55 to i8 addrspace(13)*

signal (6): Aborted
in expression starting at none:1
gsignal at /usr/bin/…/lib/x86_64-linux-gnu/libc.so.6 (unknown line)
abort at /usr/bin/…/lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x7f7f21886d04)
_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE at /usr/bin/…/lib/x86_64-linux-gnu/libLLVM-8.so.1 (unknown line)
_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE at /usr/bin/…/lib/x86_64-linux-gnu/libLLVM-8.so.1 (unknown line)
_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE at /usr/bin/…/lib/x86_64-linux-gnu/libLLVM-8.so.1 (unknown line)
unknown function (ip: 0x7f7f21970ac1)
unknown function (ip: 0x7f7f219732d8)
unknown function (ip: 0x7f7f219738cd)
unknown function (ip: 0x7f7f218aeb4a)
unknown function (ip: 0x7f7f218e0082)
unknown function (ip: 0x7f7f2190584b)
jl_apply_generic at /usr/bin/…/lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
#sort#13 at ./sort.jl:1033
unknown function (ip: 0x7f7ef7089532)
sort##kw at ./sort.jl:1028
unknown function (ip: 0x7f7ef7088fb5)
unknown function (ip: 0x7f7f2191875b)
unknown function (ip: 0x7f7f21918389)
unknown function (ip: 0x7f7f219188f0)
unknown function (ip: 0x7f7f219199c8)
unknown function (ip: 0x7f7f2191a616)
unknown function (ip: 0x7f7f21932e08)
unknown function (ip: 0x7f7f219333c8)
jl_toplevel_eval_in at /usr/bin/…/lib/x86_64-linux-gnu/libjulia.so.1 (unknown line)
eval at ./boot.jl:331
eval_user_input at /build/julia-98cBbp/julia-1.4.1+dfsg/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
macro expansion at /build/julia-98cBbp/julia-1.4.1+dfsg/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:118 [inlined]
#26 at ./task.jl:358
unknown function (ip: 0x7f7f2191dcbb)
unknown function (ip: (nil))
Allocations: 2738799 (Pool: 2738051; Big: 748); GC: 3
Aborted (core dumped)

I don’t think the apt sources are officially supported in any way. There’s no need to build from source; the generic linux binaries from Download Julia work correctly and don’t have this issue at any optimization level.

1 Like

Thank you! I didn’t appreciate that there may be a difference betweenthe apt version and the one from julialang.org. I’ll try that.

Just to confirm for anyone else reading this: the binary distribution works perfectly.

1 Like