Julia in x32 mode?! Precompiling Plots slow (or any package) with --compile=min

On Julia 1.6 using Plots is taking forever (EDIT: now done, took 21 minutes) to precompile so I ran strace on the Julia process:

strace: Process 4845 attached
strace: [ Process PID=4845 runs in x32 mode. ]

[hung forever here, then I got, while writing this post, precompiling is still ongoing.]

strace: [ Process PID=4845 runs in 64 bit mode. ]
statx(AT_FDCWD, "/home/pharaldsson_sym/.julia/packages/PlotThemes/4DCOG/src/lime.jl", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=674, ...}) = 0
openat(AT_FDCWD, "/home/pharaldsson_sym/.julia/packages/PlotThemes/4DCOG/src/lime.jl", O_RDONLY|O_CLOEXEC) = 17
read(17, "# a blue/green/yellow theme of n"..., 32768) = 674
close(17)                               = 0
brk(0x22bd000)                          = 0x22bd000

EDIT: I see I started with: $ julia --compile=min -t2
maybe it’s slowing down.

EDIT2:

It finally ended:

julia> @time using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
┌ Warning: Module PlotUtils with build ID 6135914092619044 is missing from the cache.
│ This may mean PlotUtils [995b91a9-d308-5afd-9ec6-746e21dbc043] does not support precompilation but is imported by a module that does.
â”” @ Base loading.jl:907

1272.954376 seconds (5.11 M allocations: 375.400 MiB, 0.01% gc time)

I noticed from strace:

[..]
openat(AT_FDCWD, "/home/pharaldsson_sym/.julia/packages/PlotThemes/4DCOG/src/juno.jl", O_RDONLY|O_CLOEXEC) = 17
read(17, "#inspired by nucleus theme for A"..., 32768) = 529
close(17)                               = 0
statx(AT_FDCWD, "/home/pharaldsson_sym/.julia/packages/PlotThemes/4DCOG/src/gruvbox.jl", AT_STATX_SYNC_AS_STAT, STATX_ALL, {stx_mask=STATX_ALL, stx_attributes=0, stx_mode=S_IFREG|0444, stx_size=2695, ...}) = 0
openat(AT_FDCWD, "/home/pharaldsson_sym/.julia/packages/PlotThemes/4DCOG/src/gruvbox.jl", O_RDONLY|O_CLOEXEC) = 17
read(17, "# https://github.com/morhetz/gru"..., 32768) = 2695
[..]

what can only be either (seems to be former copined into):

[ gruvbox](https://github.com/morhetz/gruvbox)

[ gruvbox-contrib](https://github.com/morhetz/gruvbox-contrib)

[..]
epoll_ctl(3, EPOLL_CTL_DEL, 14, 0x7ffd1b5107f0) = -1 ENOENT (No such file or directory)
close(14)                               = 0
epoll_ctl(3, EPOLL_CTL_DEL, 12, 0x7ffd1b5107f0) = -1 ENOENT (No such file or directory)
[..]

I honestly have no idea what this post is about. Are you complaining about the time it takes to load Plots?

Why are you running with --compile=min?

2 Likes

I wanted to ask about why x32 mode in Julia (then after posting I saw more strace lines). I often use --compile=min as it can be faster (and it actually is one sec. faster after precompiling, using Plots is down do 3.6 sec.), wasn’t really my intention here (I wasn’t expecting precompilation), I do it out of habit. Anyway, it finished, I wasn’t sure it would.

I think strace gets it wrong sometimes. Later you see

strace: [ Process PID=4845 runs in 64 bit mode. ]
2 Likes

I tried again with a clean install (emptied .julia) and without --compile=min precompiling doesn’t seem to trigger 32-bit x32 mode any more and is 8x faster (also no longer the “Warning” I got eventually):

julia> @time using Plots
[ Info: Precompiling Plots [91a5bcdd-55d7-5caf-9e0b-520d859cae80]
145.397138 seconds (6.26 M allocations: 446.843 MiB, 0.11% gc time)

https://stackoverflow.com/questions/52647286/strace-reports-x32-and-64-bit-mode

strace have a handful of heuristics to try to detect the mode of the binary (32bit, 64 bit, x32 and so on).

This logic is not accurate in all cases, so you’re seeing a result of that. (This is also the consensus on the linux kernel mailing list)

Well yeah, you might load packages faster but Julia itself will be dog slow for many things.

1 Like

Since it’s precompiling (for future use, on potentially different global settings), to well compiled code, I thought there might be an exception to the interpreter used. At least I think we should consider changing Julia that way.

Do you know, does the interpreter apply to everything, e.g. Base too, what’s in the system image already?