Skip to content

Commit

Permalink
ggml: add openmp compiler flags
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Bevenius <[email protected]>
  • Loading branch information
danbev committed Jun 30, 2024
1 parent 41ec511 commit 2e4f115
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions fundamentals/ggml/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
CC = gcc
CFLAGS = -g -Wall -Iggml/include -Wno-unused-variable
CXX = g++
CFLAGS = -g -Wall -Iggml/include -Iggml/src/ -Wno-unused-variable -fopenmp
LDFLAGS = -Lggml/build/src/
CMAKE_FLAGS = -DCMAKE_BUILD_TYPE=Debug -DBUILD_SHARED_LIBS=OFF

Expand All @@ -11,20 +12,27 @@ VULKAN_FLAGS :=
SRCDIR = src
BINDIR = bin

SOURCES := $(wildcard $(SRCDIR)/*.c)
TARGETS := $(patsubst $(SRCDIR)/%.c, %, $(SOURCES))
SOURCES_C := $(wildcard $(SRCDIR)/*.c)
SOURCES_CPP := $(wildcard $(SRCDIR)/*.cpp)
TARGETS_C := $(patsubst $(SRCDIR)/%.c, %, $(SOURCES_C))
TARGETS_CPP := $(patsubst $(SRCDIR)/%.cpp, %, $(SOURCES_CPP))

.PHONY: all clean

all: $(TARGETS)

ggml-quants: CFLAGS += -Iggml/src -Iggml/include/ggml

$(TARGETS): % : $(SRCDIR)/%.c | bindir
$(TARGETS_C): % : $(SRCDIR)/%.c | bindir
$(CC) $(CFLAGS) $(LDFLAGS) -o ${BINDIR}/$@ $< \
-Wl,--whole-archive ggml/build/src/libggml.a -Wl,--no-whole-archive \
-lm $(CUDA_FLAGS) $(VULKAN_FLAGS)

$(TARGETS_CPP): % : $(SRCDIR)/%.cpp | bindir
$(CXX) $(CFLAGS) $(LDFLAGS) -o ${BINDIR}/$@ $< \
-Wl,--whole-archive ggml/build/src/libggml.a -Wl,--no-whole-archive \
-lm $(CUDA_FLAGS) $(VULKAN_FLAGS)

.PHONY: pre-quants
pre-quants: CFLAGS += -Iggml/src -Iggml/include/ggml
pre-quants:
Expand Down

0 comments on commit 2e4f115

Please sign in to comment.