Hi,
I am trying to use cuPrintf() in a very simple program below, but I am getting following error.
#include "utils/cuPrintf.cu"
#include "stdio.h"
__global__ void device_greetings(void){
cuPrintf("Hello world, form the device %d \n",5);
}
int main(){
//greet from the host
printf("Helo world, from the host\n");
//intitialize cuPrintf
cudaPrintfInit();
//launch the kernel with a single thread
device_greetings<<<1,1>>>();
//display the device's greetings
cudaPrintfDisplay();
//clean up
cudaPrintfEnd();
return 0;
}
On compilation, I am getting this
utils/cuPrintf.cu(395): error: calling a host function from a __device__/__global__ function is only allowed in device emulation mode
detected during instantiation of "int cuPrintf(const char *, T1) [with T1=int]"
hello.cu(4): here
1 error detected in the compilation of "/tmp/tmpxft_000027c1_00000000-4_hello.cpp1.ii".
Any Idea?