Printf not working from kernel

According to “professional cuda c programming” ISBN: 978-1-118-73932-7, p19 folowing should compile and printf statement should work from kernel.
Compile is ok:

nvcc -arch sm_20 hello.cu -o hello" ; ./hello

but when executed, no output from kernel. How is that possible?

#include <stdio.h>

    __global__ void helloFromGpu() {
            printf("Hello from GPU.\n");
    }
    int main(void) {
            // hello from
        printf("Hello from cpu.\n");
            helloFromGpu<<<1, 10>>>();
            return 0;
    }
  1. Add proper CUDA error checking (google that, take the first hit, apply it to your code)
  2. Add the following:

after:

add:

cudaDeviceSynchronize();