Use compiler to determine best optimizations for platform

This commit is contained in:
Andrei Betlen 2023-09-12 18:21:49 -04:00
parent 4c0787b408
commit dadfd96745
2 changed files with 9 additions and 1 deletions

View file

@ -73,7 +73,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: | run: |
python3 -m pip install --upgrade pip python3 -m pip install --upgrade pip
CMAKE_ARGS="-DLLAMA_AVX=OFF -DLLAMA_AVX2=OFF -DLLAMA_AVX512=OFF -DLLAMA_AVX512_VBMI=OFF -DLLAMA_AVX512_VNNI=OFF -DLLAMA_FMA=OFF -DLLAMA_F16C=OFF -DLLAMA_ACCELERATE=OFF -DLLAMA_METAL=OFF" python3 -m pip install .[all] --verbose --config-settings=cmake.verbose=true --config-settings=logging.level=INFO python3 -m pip install .[all] --verbose
- name: Test with pytest - name: Test with pytest
run: | run: |
python3 -m pytest python3 -m pytest

View file

@ -4,6 +4,14 @@ project(llama_cpp)
option(BUILD_LLAMA_CPP "Build llama.cpp shared library and install alongside python package" ON) option(BUILD_LLAMA_CPP "Build llama.cpp shared library and install alongside python package" ON)
if (APPLE)
set(LLAMA_AVX ON CACHE BOOL)
set(LLAMA_AVX2 OFF CACHE BOOL)
set(LLAMA_FMA OFF CACHE BOOL)
set(LLAMA_F16C OFF CACHE BOOL)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native -mtune=native")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -mtune=native")
endif()
if (BUILD_LLAMA_CPP) if (BUILD_LLAMA_CPP)
set(BUILD_SHARED_LIBS "On") set(BUILD_SHARED_LIBS "On")