Julia in a VM

Hello,

just a quick question. I tried to start julia 0.7.0 beta2 from some nightly build tar.gz available from the website in a VM which gave me an error
ERROR: Unable to find compatible target in system image.
The VM runs stock debian 9 (stretch) x86_64, the CPU type is

head /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 15
model name      : Intel Celeron_4x0 (Conroe/Merom Class Core 2)

OK, fair enough, that is indeed ancient. I would assume that llvm and/or the instruction set extensions used when building julia would not run on a CPU with that feature set ? Is there some documentation/ table where I could look up what the basic requirements for those nightly builds are ? Also, If I would build it myself from source, would it be possible to get it to run on that VM ? What is the minimal CPU feature set in that case ?

Best Regards

The following is only if you build julia yourself, I am not sure how to apply that to downloaded executables:

I built julia on an older netbook with an atom processor and had to set TARGET=atom (this is from memory, so it might be slightly different) in the Make.user. I guess the build scripts have some problems with older processors, I think you can set TARGET=pentium4 and it should work for almost anything.

OK, thank you ! So the requirements when building from source are still pretty minimal. That is very good to know. I now vaguely remember that I read somewhere that there is an ARM port.

you should have at least 2GB of RAM for the build, else it will swap a lot and take forever.

I have the same problem when deploying to a virtual box VM on a modern CPU:

cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core™ i7-8550U CPU @ 1.80GHz
stepping : 10
cpu MHz : 1992.008
cache size : 8192 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid pni monitor ssse3 pcid sse4_1 sse4_2 x2apic hypervisor lahf_lm invpcid_single pti fsgsbase invpcid
bugs : cpu_meltdown spectre_v1 spectre_v2
bogomips : 3984.01
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual

The flags differ drastically from the host:
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb invpcid_single intel_pt ibrs ibpb stibp kaiser tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp

I’m deploying with nixops to the v-box provider and I’m not sure if I can manipulate the cpuid with nixops. However it would be very interesting to know if this is indeed the problem and what the necessary features are.

Best,
Florian

Does have exactly that much :slight_smile: But, actually, starting julia at all on that VM was an accident in the first place. But it made me wonder.

there is for 0.7: Download Julia

Right !

Might it be checking for that flag indicating it is a VM? On the other hand that somehow does not make sense at all to me.

@flicaflow and I found out the following: Julia needs the cx16 CPU flag [1] in its most generic sysimg build [2]. cx16 is available since Pentium D / Core 2 Duo days. But when using Virtualbox, the setting nested paging needs to be turned on, so that the guest can see the cx16 cpuflag (check with cat /proc/cpuinfo).

You can enable this in the Virtualbox UI in Machine → Settings → System → Acceleration → Enable Nested Paging. You can also use the VBoxManage vmmodify command in the terminal to set --nestedpaging on.

Alternatively [2] mentions that Julia can be built with the -cx16 flag, which might make it work on even older CPUs / lower capabilities (we did not test this).

[1] http://www.tomshardware.co.uk/answers/id-2396559/cmpxchg16b-compatible-cpu.html
[2] julia/processor_x86.cpp at 906db16e52226ce142777a71fd246c4b820f58cf · JuliaLang/julia · GitHub

2 Likes

Hello,

apparently qemu/kvm which is used in my case does not expose that flag by default. Or the debian guest does not pick it up for some reason. A quick google does not come up with something directly useful why this flag might be missing. And the debian guest apparently does not care :slight_smile:

EDIT: Or the CPU which is emulated (Conroe/Merom Class Core 2) is really to old, if I understand correctly @flicaflow uses virtualbox

EDIT2: Well, apparently the penryn 45 nm die shrink is the first CPU with cx16, the merom 65 nm (and presumably the 65 nm conroe) does not have it. Well, bad luck :slight_smile:

I had the same problem ( ERROR: Unable to find compatible target in system image.) using VirtualBox . Although Nested Paging was enabled and my CPU does support cx16 (CMPXCHG16B), that flag wasn’t exposed to the guest.

To fix this issue I had to manually enabled CMPXCHG16B via

VBoxManage setextradata global VBoxInternal/CPUM/CMPXCHG16B 1

This line didn’t work for us.
Is not very clear what I need to do:
reference

Building like this? When or where to add the -cx16 flag?

git clone git://github.com/JuliaLang/julia.git
git checkout v1.6.0
./julia

Thanks!

You’re missing the make step, but yes. I think the -cx16 may be autodetected then (since the default is to build for the current machine), but you’ll also need to specify USE_BINARYBUILDER=0 (either on the same line as make, or in a file named Make.user)

1 Like