I've installed PyCUDA
using pip
. I tried this in two computers.
One with a fresh install of Python 3.7.1
and one with Python 3.6.5
.
Everything fails after using PuCUDA
with no error message.
The minimum example is this:
import sys
import pycuda.driver as cuda
import pycuda.autoinit # <-- Comment in order for `print` to work
if __name__ == '__main__':
print('Print works')
sys.stdout.write("Sys print works")
This doesn't print anything unless I remove pycuda.autoinit
.
Another example would be using
printf
:
import pycuda.driver as cuda
import pycuda.autoinit
from pycuda.compiler import SourceModule
if __name__ == '__main__':
mod = SourceModule("""
#include <stdio.h>
__global__ void test() {
printf("I am %d.%d\\n", threadIdx.x, threadIdx.y);
}
""")
func = mod.get_function("test")
func(block=(4, 4, 1))
This does not return any output also.
I think that CUDA fails but nothing gets reported.
My configuration:
+--------------------+--------------------+ | PC1 | PC2 | +--------------------+--------------------+ | Python 3.6.5 | Python 3.7.1 | | Windows 10 | Windows 10 | | Cuda toolkit 9 | Cuda toolkit 10 | | GeForce GTX 1050 | GeForce GTX 1080 | | Visual Studio 2015 | Visual Studio 2015 | +--------------------+--------------------+
Drivers:
GeForce Game Ready Driver Version : 418.91 WHQL Release Date : Wed Feb 13, 2019
I've noticed that this is a common problem but there is no solution.
I'm not sure if this would help you out, but similar issue was solved by
reinstall cuda
(with anoconda
).
In case you need it, you can install it via conda
console
conda install -c anaconda cudatoolkit
And to check if it runs well,
type numba -s
Hope this can help
I'm not sure but I hope this help you address the problem.
CUDA
toolkit on your Windows. PATH
environments for CUDA
is set properly. VS
, it may be difficult(or impossible) for PyCUDA
to work with it. So if you want to install an older version of VS
additionally on your current system, after your installation, you may need to specify the path to your new (old-versioned) compiler. For example, you can add this line into compiler
function in site-packages\pycuda\compiler.py
:
options.extend(['-ccbin', 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\cl.exe'])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With