I am passing in a pointer to the struct in code like the following and I am getting a compiler warning in func :: Cannot tell what pointer points to, assuming global memory space. Each thread has this pattern so I assume I do not want this global. Can anyone let me know how I should resolve this problem. I want this to refer to the address of the struct that I declared in the calling function and I passed in.
struct global_variables{
double k,tau,sigma,sigma2,r,delta,b1,e1,b2,e2,b3,e3;
double yv1,yv2,yv3,qv1,tv;
double pe123;
int exp_or_const;
};
device double func(GlobalVariables *g)
{
return (log(b/g->k) + (g->r-g->delta)*g->tv)/g->yv1 + g->yv1/2.0;
}
__device void foo()
{
GlobalVariables g;
// Fill struct
***************
// call func
double x = func(&g);
*********
}