Tuesday 29 November 2016

Printf works in CUDA

In order to execute the printf("something") in cuda code, we need to compile the code with an extra parameter i.e. [-arch=sm_20] which enables us to print our output inside cuda kernel.
for example i have my hello.cu file. The following command is use to compile the code.

nvcc -arch=sm_20 -o hello hello.cu

for complete documentation you can follow the link