Framester
Framester

Reputation: 35561

Display all NVCC warnings in PyCUDA

[update] How can I output the warning messages from compiler.SourceModule(kernel_code)? With help of @flipchart I was able to pass the right parameters to NVCC trough PyCUDA, but I still don't know, where to access the compiler warnings.

[original question]

Using NVCC directly one can use the compiler switch -Wall*. How would one archive this in pycuda?

I tried mod = compiler.SourceModule(kernel_code,options=['-Wall']), but the error message states:

pytools.prefork.ExecError: error invoking 'nvcc --cubin -Wall -arch sm_11 -I/usr/local/lib/python2.6/dist-packages/pycuda-0.94.2-py2.6-linux-x86_64.egg/pycuda/../include/pycuda kernel.cu': status 255 invoking 'nvcc --cubin -Wall -arch sm_11 -I/usr/local/lib/python2.6/dist-packages/pycuda-0.94.2-py2.6-linux-x86_64.egg/pycuda/../include/pycuda kernel.cu': nvcc fatal : Unknown option 'Wall'

The source problem is, that I spent a whole day debugging, because I overlooked an inexplicit conversion fromfloat to int.

*Warnings from system-header with "--compiler-options -Wall" since CUDA 3.0

Upvotes: 0

Views: 4502

Answers (1)

flipchart
flipchart

Reputation: 6578

The -Wall option is not a nvcc compiler option, but rather one that is passed on to the supporting compiler (g++ or cl.exe). You need to pass in the option --compiler-options -Wall to indicate to nvcc that the option is for the supporting compiler. In you python code:

mod = compiler.SourceModule(kernel_code,options=['--compiler-options','-Wall'])

PyCuda seems to want each option specified as a list item, otherwise it wraps the whole thing in quotes which nvcc doesn't like.

Upvotes: 5

Related Questions