I get an error when I try to use printf() in a kernel

后端 未结 3 1042
孤独总比滥情好
孤独总比滥情好 2021-01-25 00:47

I\'m using Visual Studio 2010 and a GTX480 with compute capability 2.0.

I have tried setting sm to 2.0, but when I attempt to use printf() in a kernel, I get:

3条回答
  •  [愿得一人]
    2021-01-25 01:01

    You are probably compiling for an architecture that does not support printf(). By default the project is compiled for compute architecture 1.0. To change this, in VS open the project properties -> CUDA C/C++ -> Device and change the "Code Generation" property to "compute_20,sm_20".

    You do not need #include "util\cuPrintf.cu". Please see this for details on how to use printf and how to flush the output so you actually see the result.

提交回复
热议问题