In case someone is still looking for an answer:
configure.py generates a siteconf.py file containing the paths to CUDA .lib files used to compile pycuda. However, it uses incorrect paths (at least when on Windows and using toolkit V7.5).
Now this can be fixed multiple ways (make sure you've downloaded the pycuda package and decompressed it somewhere):
1. Modifying setup.py
This is where the main culprit lies. These are the paths it currently uses:
default_lib_dirs = [
"${CUDA_ROOT}/lib", "${CUDA_ROOT}/lib64",
# https://github.com/inducer/pycuda/issues/98
"${CUDA_ROOT}/lib/stubs", "${CUDA_ROOT}/lib64/stubs",
]
Currently Nvidia uses CUDA_PATH as environmental variable, and the .lib files are stored within a separate x64 or Win32 folder. You can either add these paths to the array, or just get rid of the incorrect ones
default_lib_dirs = ["${CUDA_PATH}/lib/x64", "${CUDA_PATH}/lib/Win32"]
now run py configure.py
to generate the siteconf.py file.
2. Override settings generated by configure.py
As mentioned, configure.py generates the siteconf.py file. You can call configure.py with optional parameters to override the default library folders (what we defined in setup.py).
Partial output after running configure.py --help
--cudadrv-lib-dir=DIR
Library directories for Cudadrv (default:
${CUDA_PATH}/lib/x64) (several ok)
--cudadrv-libname=LIBNAME
Library names for Cudadrv (without lib or .so)
(default: cuda) (several ok)
--cudart-lib-dir=DIR Library directories for Cudart (default:
${CUDA_PATH}/lib/x64) (several ok)
--cudart-libname=LIBNAME
Library names for Cudart (without lib or .so)
(default: cudart) (several ok)
--curand-lib-dir=DIR Library directories for Curand (default:
${CUDA_PATH}/lib/x64) (several ok)
--curand-libname=LIBNAME
Library names for Curand (without lib or .so)
(default: curand) (several ok)
3. Modify siteconf.py directly
The easiest method. Just run py configure.py
to generate a siteconf.py
file with default paths, and edit that file afterwards.
Later on I figured both these pages recommend doing just that:
https://kerpanic.wordpress.com/2015/09/28/pycuda-windows-installation-offline/
https://wiki.tiker.net/PyCuda/Installation/Windows
Finish the installation
To wrap it all up, compile and install pycuda by running:
py setup.py build
py setup.py install
(this will use the previously generated/modified siteconf.py file).
That's it :)
(If you are wondering why I wrote down all 3 methods instead of just the most easiest one, I actually found out about the siteconf.py and configure.py file after I messed around with default_lib_dirs
in the setup.py
file. Same for the two website links, I found those after manually solving the problem)