Thursday, 14 February 2019

No output after using PyCUDA

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:

Python 3.6.5 / `Python 3.7.1
Windows 10
Cuda toolkit 9 / Cuda toolkit 10
GeForce GTX 1050 / GeForce GTX 1080

I've noticed that this is a common problem but there is no answer.



from No output after using PyCUDA

No comments:

Post a Comment