Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on Centos7 with make: *** [all] Error 2 #569

Closed
makermotion opened this issue Oct 10, 2023 · 5 comments · Fixed by #573
Closed

Build fails on Centos7 with make: *** [all] Error 2 #569

makermotion opened this issue Oct 10, 2023 · 5 comments · Fixed by #573

Comments

@makermotion
Copy link

When I try to follow the instructions building ggml to use mpt here: https://github.com/ggerganov/ggml/tree/79ea7a41a388e9e7c85e426e912ab38399c44bfa/examples/mpt

distro: Centos7
gcc: 13.2.0
g++: 13.2.0
command for "cmake": cmake -D CMAKE_C_COMPILER=/usr/local/bin/gcc -D CMAKE_CXX_COMPILER=/usr/local/bin/g++ ..
command for "make": make -j 4 CC=/usr/local/bin/gcc CXX=/usr/local/bin/g++

I get the following error:

[ 48%] Linking CXX executable ../bin/test-quantize-fns
repos/ggml/tests/test-vec1.c: In function ‘reduce_vector8_0’:
repos/ggml/tests/test-vec1.c:38:7: note: the ABI for passing parameters with 32-byte alignment has changed in GCC 4.6
   38 | float reduce_vector8_0(__m256 v) {
      |       ^~~~~~~~~~~~~~~~
repos/ggml/tests/test-vec1.c: In function ‘mul_mat_vec_f32_1’:
repos/ggml/tests/test-vec1.c:60:16: warning: AVX vector return without AVX enabled changes the ABI [-Wpsabi]
   60 |         __m256 sum = _mm256_setzero_ps();
      |                ^~~
In file included from /usr/local/lib/gcc/x86_64-pc-linux-gnu/13.2.0/include/immintrin.h:43,
                 from repos/ggml/tests/test-vec1.c:10:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/13.2.0/include/avxintrin.h: In function ‘reduce_vector8_0’:
/usr/local/lib/gcc/x86_64-pc-linux-gnu/13.2.0/include/avxintrin.h:524:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_extractf128_ps’: target specific option mismatch
  524 | _mm256_extractf128_ps (__m256 __X, const int __N)
      | ^~~~~~~~~~~~~~~~~~~~~
repos/ggml/tests/test-vec1.c:40:17: note: called from here
   40 |     __m128 v2 = _mm256_extractf128_ps(v, 1);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/lib/gcc/x86_64-pc-linux-gnu/13.2.0/include/avxintrin.h:524:1: error: inlining failed in call to ‘always_inline’ ‘_mm256_extractf128_ps’: target specific option mismatch
  524 | _mm256_extractf128_ps (__m256 __X, const int __N)
      | ^~~~~~~~~~~~~~~~~~~~~
repos/ggml/tests/test-vec1.c:39:17: note: called from here
   39 |     __m128 v1 = _mm256_extractf128_ps(v, 0);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [tests/CMakeFiles/test-vec1.dir/test-vec1.c.o] Error 1
make[1]: *** [tests/CMakeFiles/test-vec1.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 48%] Built target test-quantize-fns
[ 49%] Linking C executable ../bin/test-mul-mat2
[ 50%] Linking CXX executable ../../bin/mnist-cnn
[ 51%] Linking CXX executable ../../bin/mnist-cpu
[ 51%] Built target test-mul-mat2
[ 51%] Built target mnist-cnn
[ 51%] Built target mnist-cpu
[ 52%] Linking CXX executable ../../bin/mnist
[ 52%] Built target mnist
[ 54%] Linking CXX executable ../bin/test-grad0
[ 54%] Built target test-grad0
[ 55%] Linking CXX executable ../bin/test-quantize-perf
[ 55%] Built target test-quantize-perf
[ 56%] Linking CXX static library libcommon-ggml.a
[ 56%] Built target common-ggml
[ 57%] Linking CXX executable ../../bin/sam
[ 57%] Built target sam
[ 58%] Linking CXX static library libwhisper-cpp.a
[ 58%] Built target whisper-cpp
make: *** [all] Error 2`
@slaren
Copy link
Collaborator

slaren commented Oct 10, 2023

Does your CPU support AVX?

@makermotion
Copy link
Author

Does your CPU support AVX?

this returns nothing grep avx /proc/cpuinfo so no.

@slaren
Copy link
Collaborator

slaren commented Oct 10, 2023

That's probably the issue then. test-vec1.c requires AVX, but it is built unconditionally on x86. It shouldn't be built on systems without AVX support. Can you test if this change to tests/CMakeLists.txt fixes the issue?

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index a1cedf0..35e8e67 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -159,7 +159,7 @@ target_link_libraries(${TEST_TARGET} PRIVATE ggml)

 #
 # test-vec1 (x86)
-if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86")
+if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86" AND ${CMAKE_C_FLAGS} MATCHES "avx")
     set(TEST_TARGET test-vec1)
     add_executable(${TEST_TARGET} ${TEST_TARGET}.c)
     target_link_libraries(${TEST_TARGET} PRIVATE ggml)

Edit: updated the diff.

@makermotion
Copy link
Author

that works thanks!

@slaren
Copy link
Collaborator

slaren commented Oct 11, 2023

Let's keep this open until it is fixed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants