Reputation: 1
I have this function that is called in various parts of the code when I have an error and I need to stop the program from running. However, I get this error when compiling only on nvidia video card (-ta=nvidia:managed) , this does not occur when compiling on CPU (ta:multicore)
void exit_tool()
{
printf("Simulacao interrompida");
exit(1);
}
Procedures called in a compute region must have acc routine information - exit
Upvotes: 0
Views: 236
Reputation: 5646
Correct, in order to call a routine on the device, there's needs to be a device callable version available. 'exit' is not a supported device routine since you can't terminate a host process from the device.
You can call "assert(0)" to terminate the running device kernel, but this will corrupt the CUDA context giving undefined behavior.
Given this is likely debugging code used for error checking, the simplest method to work around this would be to conditionally compile this function so exit isn't use within OpenACC:
void exit_tool()
{
printf("Simulacao interrompida");
#ifndef _OPENACC
exit(1);
#endif
}
Upvotes: 1