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.