Closed marcpre closed 7 months ago
Seems like you need a newer version of GCC (it should work with GCC 12).
Also, pay attention that vbox may not support AVX. If you're coming from windows, it's always better to use WSL 2.
I join in with what ngxson says, virtualbox is really not good for modern cpu features. I've wasted many hours in various problems with it. I'm sure you can get CPU-llama.cpp working if disabling modern cpu features. But I don't see the point in it. WSL2 is one of the few things Microsoft did in the past 20 years that's not horrible, quite remarkable that it runs a native linux kernel by now. You can even virtualize insize WSL2 using a higher quality virtualization technology than virtualbox. Or just docker/chroot. And performance should be similar, possibly better than on native windows.
I got these _mm256_fmadd_ps errors in VirtualBox too. In my case i changed this in the Makefile:
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
# Use all CPU extensions that are available:
MK_CFLAGS += -march=native -mtune=native
MK_HOST_CXXFLAGS += -march=native -mtune=native
to
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64))
# Use all CPU extensions that are available:
MK_CFLAGS += -march=znver2 -mtune=znver2
MK_HOST_CXXFLAGS += -march=znver2 -mtune=znver2
Because my host-system has a Zen2 CPU this worked.
I compile with gcc 13 this way:
make CC=/usr/bin/gcc-13 CXX=/usr/bin/g++-13 LLAMA_OPENBLAS=1
But i'm sure, earlier gcc versions will work too. Version 9 ist old, perhaps a newer version from this PPA could be useful:
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
I use gcc-13 and g++-13 from there.
Possible targets:
gcc-13 --target-help | grep -A 7 "march=CPU"
-march=CPU[,+EXTENSION...]
generate code for CPU and EXTENSION, CPU is one of:
generic32, generic64, i386, i486, i586, i686,
pentium, pentiumpro, pentiumii, pentiumiii, pentium4,
prescott, nocona, core, core2, corei7, l1om, k1om,
iamcu, k6, k6_2, athlon, opteron, k8, amdfam10,
bdver1, bdver2, bdver3, bdver4, znver1, znver2,
znver3, btver1, btver2
Configure with cmake -DLLAMA_NATIVE=OFF ..
and see if it works VBox
Hey, I think this is something I've run into previously on another project. Maybe I can shed some light on it.
VirtualBox messes with your CPUID and reports a nonsensical set of supported features, which might look something like this: (output from ddcpuid)
Notice that FMA mysteriously disappeared inside the VM even though the processor supports it. Essentially, you can't trust -march=native -mtune=native
in VirtualBox. You'll either have to replace native
with the name of your processor, or use a common denominator like -march=x86-64-v3
or -march=x86-64-v4
. For old versions of gcc, I believe -march=x86-64-v3
is equivalent to -march=haswell -mno-pclmul -mtune=generic
, which will guarantee you AVX2+FMA instructions on processors up to ~10 years old. I hope this helps.
I got these _mm256_fmadd_ps errors in VirtualBox too. In my case i changed this in the Makefile:
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64)) # Use all CPU extensions that are available: MK_CFLAGS += -march=native -mtune=native MK_HOST_CXXFLAGS += -march=native -mtune=native
to
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686 amd64)) # Use all CPU extensions that are available: MK_CFLAGS += -march=znver2 -mtune=znver2 MK_HOST_CXXFLAGS += -march=znver2 -mtune=znver2
Because my host-system has a Zen2 CPU this worked.
I compile with gcc 13 this way:
make CC=/usr/bin/gcc-13 CXX=/usr/bin/g++-13 LLAMA_OPENBLAS=1
But i'm sure, earlier gcc versions will work too. Version 9 ist old, perhaps a newer version from this PPA could be useful:
https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
I use gcc-13 and g++-13 from there.
Possible targets:
gcc-13 --target-help | grep -A 7 "march=CPU" -march=CPU[,+EXTENSION...] generate code for CPU and EXTENSION, CPU is one of: generic32, generic64, i386, i486, i586, i686, pentium, pentiumpro, pentiumii, pentiumiii, pentium4, prescott, nocona, core, core2, corei7, l1om, k1om, iamcu, k6, k6_2, athlon, opteron, k8, amdfam10, bdver1, bdver2, bdver3, bdver4, znver1, znver2, znver3, btver1, btver2
@supportend Thank you for sharing solution! You are my light.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I am running on a
Virtualbox Version 6.1.30 r148432 (Qt5.6.2)
my operating system is:This is my
CMakeLists.txt
-file:I added these parameters to use
native
:However, I get this error:
This is my compiler version:
Any suggestions how to fix that?