LocalAI icon indicating copy to clipboard operation
LocalAI copied to clipboard

Compilation error when using Docker on Ubuntu (virtual environment)

Open xerexesx opened this issue 2 years ago • 5 comments

Here are the details of my environment: Operating system: Ubuntu 22.04 (Virtual-Machine) Docker version: 20.10.21

In file included from /usr/lib/gcc/x86_64-linux-gnu/10/include/immintrin.h:111,
                 from /build/go-gpt2/ggml.cpp/src/ggml.c:183:
/build/go-gpt2/ggml.cpp/src/ggml.c: In function 'ggml_gpt2_vec_dot_q4_0_q8_0':
/usr/lib/gcc/x86_64-linux-gnu/10/include/fmaintrin.h:63:1: error: inlining failed in call to 'always_inline' '_mm256_fmadd_ps': target specific option mismatch
   63 | _mm256_fmadd_ps (__m256 __A, __m256 __B, __m256 __C)
      | ^~~~~~~~~~~~~~~
/build/go-gpt2/ggml.cpp/src/ggml.c:2944:15: note: called from here
 2944 |         acc = _mm256_fmadd_ps( d, q, acc );
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
make[5]: *** [src/CMakeFiles/ggml.dir/build.make:82: src/CMakeFiles/ggml.dir/ggml.c.o] Error 1
make[4]: *** [CMakeFiles/Makefile2:310: src/CMakeFiles/ggml.dir/all] Error 2
make[3]: *** [CMakeFiles/Makefile2:317: src/CMakeFiles/ggml.dir/rule] Error 2
make[2]: *** [Makefile:194: ggml] Error 2
make[1]: *** [Makefile:144: ggml.o] Error 2
make: *** [Makefile:116: go-gpt2/libgpt2.a] Error 2
The command '/bin/sh -c make build' returned a non-zero code: 2
ERROR: Service 'api' failed to build : Build failed

However, the compilation fails with the above mentioned errors related to incompatibilities of target specific options in the "ggml.c" file Since the problem appears specifically in the Ubuntu virtual environment, it is possible that some specific configurations or dependencies of this virtual machine are causing the problem ? Can anyone help me ?

xerexesx avatar May 15 '23 15:05 xerexesx

Launch cat /proc/cpuinfo in your VM, maybe it's lacking some CPU features like avx2.

sebastien-prudhomme avatar May 15 '23 16:05 sebastien-prudhomme

I launch : grep flags /proc/cpuinfo

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single tpr_shadow vnmi flexpriority ept vpid fsgsbase bmi1 avx2 bmi2 invpcid rdseed clflushopt md_clear flush_l1d arch_capabilities

AVX2 seems to be present, I have checked the bios settings for the virtualization to be activated as well as the VM configuration.In the VM logs I have a problem :

ERROR [COM]: aRC=VBOX_E_INVALID_OBJECT_STATE (0x80bb0007) aIID={d7b98d2b-30e8-447e-99cb-e31becae6ae4} aComponent={ProgressWrap} aText={Operation cannot be canceled}, preserve=false aResultDetail=0

it seems that it can come from Hyper-V ? I'm looking for . Thanks again for your help, much appreciated

xerexesx avatar May 16 '23 17:05 xerexesx

Screenshot 2023-05-16 001755x

I had same problem when compiling go-gpt2/libgpt2.a with Ubuntu and Docker on Proxmox. Enabling AVX and AVX2 CPU flags or using host CPU fixed the issue. Cheers to @sebastien-prudhomme!

Soberia avatar May 16 '23 18:05 Soberia

[solved] I exported my vm on VMware and I can compile .

xerexesx avatar May 18 '23 20:05 xerexesx

The problem came from a hardware incompatibility when using VirtualBox for the vritualization of my host. I tested that my virtual machine had avx support. I checked my configuration to make sure that pcu host PAE/NX and VT-x virtualization was enabled and still the same error. I exported my machine in .ova, I reconfigured the VM under VMWare, remove VirtualBox Guest Additions. I boot on VMware image, I can compile without any modification of the code. I really think I have a hardware compatibility problem on VirtualBox .

xerexesx avatar May 20 '23 07:05 xerexesx

Thanks for you guys feedback. I saw you guys already fixed this issue. If not, here is detail of how to set the CPU type https://github.com/go-skynet/LocalAI/issues/90#issuecomment-1585728856. And I'm going to close the issue.

Aisuko avatar Sep 18 '23 05:09 Aisuko