diff --git a/.devops/full.Dockerfile b/.devops/full.Dockerfile index 491d67676f0cd..4e59e81b5c6a3 100644 --- a/.devops/full.Dockerfile +++ b/.devops/full.Dockerfile @@ -14,6 +14,6 @@ WORKDIR /app COPY . . -RUN make +RUN LLAMA_AVX2_ONLY=1 make ENTRYPOINT ["/app/.devops/tools.sh"] diff --git a/.devops/main.Dockerfile b/.devops/main.Dockerfile index 2e629f8ce9a69..d66a9c64b0e70 100644 --- a/.devops/main.Dockerfile +++ b/.devops/main.Dockerfile @@ -9,7 +9,7 @@ WORKDIR /app COPY . . -RUN make +RUN LLAMA_AVX2_ONLY=1 make FROM ubuntu:$UBUNTU_VERSION as runtime diff --git a/Makefile b/Makefile index 94acefdded320..0cfc11d781b34 100644 --- a/Makefile +++ b/Makefile @@ -78,13 +78,14 @@ endif # TODO: probably these flags need to be tweaked on some architectures # feel free to update the Makefile for your architecture and send a pull request or issue ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686)) - # Use all CPU extensions that are available: - CFLAGS += -march=native -mtune=native - CXXFLAGS += -march=native -mtune=native - - # Usage AVX-only - #CFLAGS += -mfma -mf16c -mavx - #CXXFLAGS += -mfma -mf16c -mavx + ifdef LLAMA_AVX2_ONLY + CFLAGS += -mfma -mf16c -mavx2 + CXXFLAGS += -mfma -mf16c -mavx2 + else + # Use all CPU extensions that are available: + CFLAGS += -march=native -mtune=native + CXXFLAGS += -march=native -mtune=native + endif endif ifneq ($(filter ppc64%,$(UNAME_M)),) POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)