How can I use cuBLAS lib with WSL?

Viewed 42

I have installed Nvidia drivers for Windows and CUDA on WSL correctly. But CUDA runtime could not initialize.

The cuBLAS library was not initialized. This is usually caused by the lack of a prior cublasCreate() call, an error in the CUDA Runtime API called by the cuBLAS routine, or an error in the hardware setup.

Nvidia's document.

enter image description here enter image description here


#include <iostream>
#include "cuda_runtime.h"
#include "cublas_v2.h"

cublasHandle_t cuHandle;
cublasStatus_t status = cublasCreate(&cuHandle);

if (status == CUBLAS_STATUS_NOT_INITIALIZED) return EXIT_FAILURE;
else {
    cublasDestroy (cuHandle);
    std::cout << "OK" << std::endl;
    return EXIT_SUCCESS;
}

The code above would print nothing.

I suspect this would be resulted by drivers or CUDA installing incorrectly, however it remains after repeated.

0 Answers
Related