Skip to content

Commit

Permalink
Revert "protyping the idea that supports running on CPU for a GGML_US…
Browse files Browse the repository at this point in the history
…E_CUBLAS=on build"

This reverts commit b5149aa.
  • Loading branch information
wsxiaoys committed Nov 6, 2023
1 parent b5149aa commit d0a81f4
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 124 deletions.
17 changes: 1 addition & 16 deletions ggml-cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -5724,11 +5724,6 @@ static void ggml_cuda_pool_free(void * ptr, size_t size) {
CUDA_CHECK(cudaFree(ptr));
}

static bool g_cublas_loaded = false;

bool ggml_cublas_loaded(void) {
return g_cublas_loaded;
}

void ggml_init_cublas() {
static bool initialized = false;
Expand All @@ -5742,12 +5737,7 @@ void ggml_init_cublas() {
CUDA_CHECK(cudaDeviceSynchronize());
#endif

if (cudaGetDeviceCount(&g_device_count) != cudaSuccess) {
initialized = true;
g_cublas_loaded = false;
return;
}

CUDA_CHECK(cudaGetDeviceCount(&g_device_count));
GGML_ASSERT(g_device_count <= GGML_CUDA_MAX_DEVICES);
int64_t total_vram = 0;
#if defined(GGML_CUDA_FORCE_MMQ)
Expand Down Expand Up @@ -5795,7 +5785,6 @@ void ggml_init_cublas() {
// CUBLAS_CHECK(cublasLoggerConfigure(1, 1, 0, nullptr));

initialized = true;
g_cublas_loaded = true;
}
}

Expand Down Expand Up @@ -7070,8 +7059,6 @@ static void ggml_cuda_rms_norm(const ggml_tensor * src0, const ggml_tensor * src
}

bool ggml_cuda_can_mul_mat(const struct ggml_tensor * src0, const struct ggml_tensor * src1, struct ggml_tensor * dst) {
if (!g_cublas_loaded) return false;

const int64_t ne10 = src1->ne[0];

const int64_t ne0 = dst->ne[0];
Expand Down Expand Up @@ -7735,8 +7722,6 @@ void ggml_cuda_free_scratch() {
}

bool ggml_cuda_compute_forward(struct ggml_compute_params * params, struct ggml_tensor * tensor) {
if (!g_cublas_loaded) return false;

ggml_cuda_func_t func;
const bool any_on_device = tensor->backend == GGML_BACKEND_GPU
|| (tensor->src[0] != nullptr && (tensor->src[0]->backend == GGML_BACKEND_GPU || tensor->src[0]->backend == GGML_BACKEND_GPU_SPLIT))
Expand Down
2 changes: 0 additions & 2 deletions ggml-cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ extern "C" {
#define GGML_CUDA_MAX_DEVICES 16

GGML_API void ggml_init_cublas(void);
GGML_API bool ggml_cublas_loaded(void);

GGML_API void * ggml_cuda_host_malloc(size_t size);
GGML_API void ggml_cuda_host_free(void * ptr);

Expand Down
Loading

0 comments on commit d0a81f4

Please sign in to comment.