Skip to content

Commit 582f559

Browse files
committed
make : add WHISPER_CUBLAS
1 parent 0ccd674 commit 582f559

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

Makefile

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ ifdef WHISPER_OPENBLAS
157157
LDFLAGS += -lopenblas
158158
endif
159159

160+
ifdef WHISPER_CUBLAS
161+
CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include
162+
CXXFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include
163+
LDFLAGS += -lcublas -lculibos -lcudart -lcublasLt -lpthread -ldl -lrt -L/usr/local/cuda/lib64 -L/opt/cuda/lib64 -L$(CUDA_PATH)/targets/x86_64-linux/lib
164+
OBJS += ggml-cuda.o
165+
NVCC = nvcc
166+
NVCCFLAGS = --forward-unknown-to-host-compiler -arch=native
167+
ggml-cuda.o: ggml-cuda.cu ggml-cuda.h
168+
$(NVCC) $(NVCCFLAGS) $(CXXFLAGS) -Wno-pedantic -c $< -o $@
169+
endif
170+
160171
ifdef WHISPER_GPROF
161172
CFLAGS += -pg
162173
CXXFLAGS += -pg
@@ -206,11 +217,11 @@ default: main bench
206217
# Build library
207218
#
208219

209-
ggml.o: ggml.c ggml.h
210-
$(CC) $(CFLAGS) -c ggml.c -o ggml.o
220+
ggml.o: ggml.c ggml.h ggml-cuda.h
221+
$(CC) $(CFLAGS) -c $< -o $@
211222

212-
whisper.o: whisper.cpp whisper.h ggml.h
213-
$(CXX) $(CXXFLAGS) -c whisper.cpp -o whisper.o
223+
whisper.o: whisper.cpp whisper.h ggml.h ggml-cuda.h
224+
$(CXX) $(CXXFLAGS) -c $< -o $@
214225

215226
ifndef WHISPER_COREML
216227
WHISPER_OBJ = whisper.o

0 commit comments

Comments
 (0)