I have declared some global variables to be _Cilk_shared. They are used in the functions that I want to offload They are used in some functions I do not want to be offloaded as well.
So initially I only declared those functions that I need to offload as _Cilk_shared and call those function using _Cilk_offload.
It compiles fine. And when I run it on host only it gives correct result.
Then I run it with MIC. it gives me runtime error about can not load library blablabla undefined symbol followed by function names that I did not declare as _cilk_shared. Those functions are not needed to be _cilk_shared as well.
So I have to change those functions to _cilk_shared. Run it again. This time MIC gives correct result.
And I checked whether those functions (which I did not want to offload and did not declare as _cilk_shared initially ) are offloaded or not, by Using
#ifdef __MIC__
printf(" Running on MIC\n");
#else
printf("No MIC\n");
#endif
The result is that they are not offloaded....
So I am wondering why it wants me to declare those functions as _Cilk_shared?