Skip to content

Commit

Permalink
build: 👷 fix cuda build
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzo Einhorn committed Jul 13, 2023
1 parent 49159dd commit 6bd18b8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
INCLUDE_PATH := $(abspath ./)
LIBRARY_PATH := $(abspath ./)
CMAKE_ARGS=${TRANSFORMERS_CMAKE_ARGS}
EXTRA_OBJS =

ifndef UNAME_S
UNAME_S := $(shell uname -s)
Expand Down Expand Up @@ -123,8 +124,8 @@ ifneq ($(filter armv8%,$(UNAME_M)),)
endif

ifeq ($(BUILD_TYPE),cublas)
EXTRA_LIBS=
CMAKE_ARGS += -DGGML_CUBLAS=ON
EXTRA_OBJS += ggml-cuda.o
endif

#
Expand All @@ -147,6 +148,9 @@ $(info )
ggml.o:
mkdir build
cd build && cmake ../ggml.cpp $(CMAKE_ARGS) && make VERBOSE=1 ggml && cp -rf src/CMakeFiles/ggml.dir/ggml.c.o ../ggml.o
@if [ "$(BUILD_TYPE)" = "cublas" ]; then \
cp -rf build/src/CMakeFiles/ggml.dir/ggml-cuda.cu.o ggml-cuda.o ;\
fi

generic-ggml.o:
$(CC) $(CFLAGS) -c ggml.cpp/src/ggml.c -o ggml.o
Expand Down Expand Up @@ -199,7 +203,7 @@ prepare:
@find ./ggml.cpp/examples/starcoder -type f -name "*.cpp" -exec sed -i'' -e 's/int main/int main_starcoder/g' {} +

libtransformers.a: prepare starcoder.o falcon.o gptj.o mpt.o gpt2.o replit.o gptneox.o ggml.o dolly.o common-ggml.o common.o
ar src libtransformers.a replit.o gptj.o mpt.o gptneox.o starcoder.o gpt2.o dolly.o falcon.o ggml.o common-ggml.o common.o
ar src libtransformers.a replit.o gptj.o mpt.o gptneox.o starcoder.o gpt2.o dolly.o falcon.o ggml.o common-ggml.o common.o ${EXTRA_OBJS}

example:
@C_INCLUDE_PATH=${INCLUDE_PATH} LIBRARY_PATH=${LIBRARY_PATH} go build -o example -x ./examples
Expand Down

0 comments on commit 6bd18b8

Please sign in to comment.