# Printf isn't working in my kernel?

**URL:** <https://forums.developer.nvidia.com/t/printf-isnt-working-in-my-kernel/20482>\
**Category:** CUDA Programming and Performance\
**Created:** [January 9, 2011, 9:15pm UTC](https://forums.developer.nvidia.com/t/printf-isnt-working-in-my-kernel/20482 "2011-01-09T21:15:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Terminas](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Terminas](https://forums.developer.nvidia.com/u/Terminas)\
**Post date:** [January 9, 2011, 9:15pm UTC](https://forums.developer.nvidia.com/t/printf-isnt-working-in-my-kernel/20482/1 "2011-01-09T21:15:42Z")

</div>

I believe I’ve done everything correctly, the program compiles just fine (using -arch sm\_20), and I have a GPU that meets the requirements for kernel-level printfs…

I have the following simple kernel:

```auto
__global__ void HelloWorld()

{

   printf("Hello World!\n");

}

```

and I call it like this:

```auto
HelloWorld<<<1, 32>>>();

```

Yet the printf statements are never displayed. Does anyone have any ideas as to why this would be occurring?

---

<div class="post-metadata">

**Author:** ![njuffa](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@njuffa](https://forums.developer.nvidia.com/u/njuffa)\
**Post date:** [January 10, 2011, 4:58am UTC](https://forums.developer.nvidia.com/t/printf-isnt-working-in-my-kernel/20482/2 "2011-01-10T04:58:40Z")

</div>

Try adding a call to cudaThreadSynchronize() after the call to HelloWorld(). It sounds like the buffer used by device-side printf() doesn’t get flushed.
