inducer / pycuda

CUDA integration for Python, plus shiny features
http://mathema.tician.de/software/pycuda
Other
1.85k stars 288 forks source link

DynamicModule SDK library path #317

Open matthiaswilms opened 3 years ago

matthiaswilms commented 3 years ago

Hello, I would just like to confirm this consideration

TODO: - Is $CUDA_ROOT/lib64 the correct path to assume for 64-Bit CUDA libraries on Linux?

in _locate_cuda_libdir of the DynamicModule class in compiler.py

I'm running 64-bit Linux (Ubuntu 20.04) and installed cuda and pycuda in a conda environment. In particular _locate_cuda_libdir ends up in this case for me:

if libdir is None:
    nvcc_path = _find_nvcc_on_path()
    if nvcc_path is not None:
        libdir = join(os.path.dirname(nvcc_path), "..", "lib64")

However the correct directory name is just "lib" instead of "lib64" in my installation. Providing the correct path in the constructor of course makes it work.

inducer commented 3 years ago

What version of the CUDA toolkit do you have? It's lib64 on mine. (11.2.2 installed from Debian.)

matthiaswilms commented 3 years ago

I can't seem to dig up 11.2.2 on conda anywhere to test that, but 11.1.1, 11.3.1 (which I am running) and 11.5.0 all result in the folder being lib for me.

matthiaswilms commented 3 years ago

I just manually installed CUDA, and as per the installation instructions , the folder is named lib64. So it seems the above is a conda specific situation. Edit: I don't know too much about any of this, but my impression is conda packages are expected to always install into lib, lib64 is not used.

inducer commented 3 years ago

I suspect that test could be improved by checking if lib64 exists, and if it does not, to try lib.

inducer commented 3 years ago

PRs welcome.

inducer commented 3 years ago

FWIW, if you're using conda, you might as well use the pycuda package from conda-forge.