I’m just looking for some addtional info here from people who have more experience.
Can anyone recommend JULIA_CPU_TARGET
settings for running Julia inside a Linux docker image on arm64 Amazon EC2?
Can anyone provide some more information about what’s happening?
We’ve migrated a Julia-based microservice from an x64 docker image to aarch64/arm64/armv8, as we are moving to using an all arm64 cluster on AWS EC2.
On x64 we used the debian-based official Julia image from dockerhub.
On aarch64 we started getting precompile errors e.g. “illegal instruction” when instantiating the service project during docker build.
We tinkered with setting JULIA_CPU_TARGET
, but it seemed like our problems were solved without setting JULIA_CPU_TARGET
by switching to an amazonlinux2 docker image instead. In it I install Juliaup and get official Julia that way. At least, that worked temporarily.
Then a couple of days ago I added some debug info to the docker build, so that it is logged in case of future breaks, and this seems to have broken the build again
In particular, now versioninfo(verbose = true)
runs into “illegal instruction”. It dies at the step of trying to compute the LoadAvg
. I get the message Load Avg: Invalid instruction at
and then some memory addresses.
versioninfo(verbose=false)
works but then I get precompilation failures in some packages.
Anyway it seems like sometimes the docker build goes through, with or without precompilation failures, and sometimes not. When it goes through I’m able to run the microservice. At service startup it does some precompilation and these (so far) succeed.
Previously I did try instantiating the project with --pkgimages=no
but then got fatal precompilation failures during service startup.
My main concern now is that if we get to a state where it looks as though everything is good, maybe it isn’t. Maybe we’ll run into illegal instructions while running the service, or build failures a few days later after merging some seemingly unrelated code change inside the service.
Here’s some info reported by Julia from within the docker image as it is being built. The first 5 lines are Sys
constants and the rest is from versioninfo()
.
MACHINE: aarch64-linux-gnu
ARCH: aarch64
KERNEL: Linux
CPU_NAME: neoverse-v1
CPU_THREADS: 8
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Linux (aarch64-linux-gnu)
CPU: 8 × unknown
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, neoverse-v1)
Threads: 1 default, 0 interactive, 1 GC (on 8 virtual cores)
So it looks like we certainly need to set JULIA_CPU_TARGET
, and in that case, we may as well switch back to the official debian-based Julia docker image.
From Julia itself (Base Julia ISA targets) I get this possibility for aarch64:
JULIA_CPU_TARGET="generic;cortex-a57;thunderx2t99;carmel,clone_all;apple-m1,base(3);neoverse-512tvb,base(3)"
Should I modify this? Use as is? Use something else?
Any knowledge you can share would be appreciated.