NVIDIA / cuda-python

CUDA Python Low-level Bindings
https://nvidia.github.io/cuda-python/
Other
809 stars 63 forks source link

getLocalRuntimeVersion return val wrong when exisit different version of cuda lib #67

Closed MARD1NO closed 2 weeks ago

MARD1NO commented 2 weeks ago

When I use cuda-python getLocalRuntimeVersion(), it do not return the correct value.

I write a simple cpp:

#include "cuda_runtime.h"
#include "stdio.h"

int main() {
    int x; 
    cudaRuntimeGetVersion(&x); 

    printf("x is: %d. \n", static_cast<int32_t>(x)); 
}

it returns the correct version 12040, but getLocalRuntimeVersion() returns 12030.

I have cuda12.3 and cuda12.4, use PATH to assign which cuda I use, How can I solve the problem?

leofang commented 2 weeks ago

You also need to update LD_LIBRARY_PATH if you're on Linux and manage your own CUDA installation instead of relying on the system package manager. getLocalRuntimeVersion was designed to always load libcudart from the library search path and return the loaded version.

MARD1NO commented 2 weeks ago

You also need to update LD_LIBRARY_PATH if you're on Linux and manage your own CUDA installation instead of relying on the system package manager. getLocalRuntimeVersion was designed to always load libcudart from the library search path and return the loaded version.

Got it, after update LD_LIBRARY_PATH, it return the right result, thanks! :D