|  | 
|  | 1 | +default: main bench | 
|  | 2 | + | 
| 1 | 3 | ifndef UNAME_S | 
| 2 | 4 | UNAME_S := $(shell uname -s) | 
| 3 | 5 | endif | 
| @@ -157,6 +159,18 @@ ifdef WHISPER_OPENBLAS | 
| 157 | 159 | 	LDFLAGS += -lopenblas | 
| 158 | 160 | endif | 
| 159 | 161 | 
 | 
|  | 162 | +ifdef WHISPER_CUBLAS | 
|  | 163 | +	CFLAGS      += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include | 
|  | 164 | +	CXXFLAGS    += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/x86_64-linux/include | 
|  | 165 | +	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 | 
|  | 166 | +	WHISPER_OBJ += ggml-cuda.o | 
|  | 167 | +	NVCC        = nvcc | 
|  | 168 | +	NVCCFLAGS   = --forward-unknown-to-host-compiler -arch=native | 
|  | 169 | + | 
|  | 170 | +ggml-cuda.o: ggml-cuda.cu ggml-cuda.h | 
|  | 171 | +	$(NVCC) $(NVCCFLAGS) $(CXXFLAGS) -Wno-pedantic -c $< -o $@ | 
|  | 172 | +endif | 
|  | 173 | + | 
| 160 | 174 | ifdef WHISPER_GPROF | 
| 161 | 175 | 	CFLAGS   += -pg | 
| 162 | 176 | 	CXXFLAGS += -pg | 
| @@ -200,28 +214,26 @@ $(info I CC:       $(CCV)) | 
| 200 | 214 | $(info I CXX:      $(CXXV)) | 
| 201 | 215 | $(info ) | 
| 202 | 216 | 
 | 
| 203 |  | -default: main bench | 
| 204 |  | - | 
| 205 | 217 | # | 
| 206 | 218 | # Build library | 
| 207 | 219 | # | 
| 208 | 220 | 
 | 
| 209 |  | -ggml.o: ggml.c ggml.h | 
| 210 |  | -	$(CC)  $(CFLAGS)   -c ggml.c -o ggml.o | 
|  | 221 | +ggml.o: ggml.c ggml.h ggml-cuda.h | 
|  | 222 | +	$(CC)  $(CFLAGS)   -c $< -o $@ | 
| 211 | 223 | 
 | 
| 212 |  | -whisper.o: whisper.cpp whisper.h ggml.h | 
| 213 |  | -	$(CXX) $(CXXFLAGS) -c whisper.cpp -o whisper.o | 
|  | 224 | +whisper.o: whisper.cpp whisper.h ggml.h ggml-cuda.h | 
|  | 225 | +	$(CXX) $(CXXFLAGS) -c $< -o $@ | 
| 214 | 226 | 
 | 
| 215 | 227 | ifndef WHISPER_COREML | 
| 216 |  | -WHISPER_OBJ = whisper.o | 
|  | 228 | +WHISPER_OBJ += whisper.o | 
| 217 | 229 | else | 
| 218 | 230 | whisper-encoder.o: coreml/whisper-encoder.mm coreml/whisper-encoder.h | 
| 219 | 231 | 	$(CXX) -O3 -I . -c coreml/whisper-encoder.mm -o whisper-encoder.o | 
| 220 | 232 | 
 | 
| 221 | 233 | whisper-encoder-impl.o: coreml/whisper-encoder-impl.m coreml/whisper-encoder-impl.h | 
| 222 | 234 | 	$(CXX) -O3 -I . -fobjc-arc -c coreml/whisper-encoder-impl.m -o whisper-encoder-impl.o | 
| 223 | 235 | 
 | 
| 224 |  | -WHISPER_OBJ = whisper.o whisper-encoder.o whisper-encoder-impl.o | 
|  | 236 | +WHISPER_OBJ += whisper.o whisper-encoder.o whisper-encoder-impl.o | 
| 225 | 237 | endif | 
| 226 | 238 | 
 | 
| 227 | 239 | libwhisper.a: ggml.o $(WHISPER_OBJ) | 
|  | 
0 commit comments