mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-04-21 09:48:49 +02:00
whisper : expose CUDA device setting in public API (#1840)
* Makefile : allow to override CUDA_ARCH_FLAG * whisper : allow to select GPU (CUDA) device from public API
This commit is contained in:
parent
b6559333ff
commit
0f80e5a80a
4
Makefile
4
Makefile
@ -215,9 +215,9 @@ endif
|
|||||||
|
|
||||||
ifdef WHISPER_CUBLAS
|
ifdef WHISPER_CUBLAS
|
||||||
ifeq ($(shell expr $(NVCC_VERSION) \>= 11.6), 1)
|
ifeq ($(shell expr $(NVCC_VERSION) \>= 11.6), 1)
|
||||||
CUDA_ARCH_FLAG=native
|
CUDA_ARCH_FLAG ?= native
|
||||||
else
|
else
|
||||||
CUDA_ARCH_FLAG=all
|
CUDA_ARCH_FLAG ?= all
|
||||||
endif
|
endif
|
||||||
|
|
||||||
CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include
|
CFLAGS += -DGGML_USE_CUBLAS -I/usr/local/cuda/include -I/opt/cuda/include -I$(CUDA_PATH)/targets/$(UNAME_M)-linux/include
|
||||||
|
@ -1060,7 +1060,7 @@ static ggml_backend_t whisper_backend_init(const whisper_context_params & params
|
|||||||
#ifdef GGML_USE_CUBLAS
|
#ifdef GGML_USE_CUBLAS
|
||||||
if (params.use_gpu && ggml_cublas_loaded()) {
|
if (params.use_gpu && ggml_cublas_loaded()) {
|
||||||
WHISPER_LOG_INFO("%s: using CUDA backend\n", __func__);
|
WHISPER_LOG_INFO("%s: using CUDA backend\n", __func__);
|
||||||
backend_gpu = ggml_backend_cuda_init(0);
|
backend_gpu = ggml_backend_cuda_init(params.gpu_device);
|
||||||
if (!backend_gpu) {
|
if (!backend_gpu) {
|
||||||
WHISPER_LOG_ERROR("%s: ggml_backend_cuda_init() failed\n", __func__);
|
WHISPER_LOG_ERROR("%s: ggml_backend_cuda_init() failed\n", __func__);
|
||||||
}
|
}
|
||||||
@ -3213,6 +3213,7 @@ int whisper_ctx_init_openvino_encoder(
|
|||||||
struct whisper_context_params whisper_context_default_params() {
|
struct whisper_context_params whisper_context_default_params() {
|
||||||
struct whisper_context_params result = {
|
struct whisper_context_params result = {
|
||||||
/*.use_gpu =*/ true,
|
/*.use_gpu =*/ true,
|
||||||
|
/*.gpu_device =*/ 0,
|
||||||
};
|
};
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user