Hi! i am newbie for cuda programming. Now i try to make a C program use the GPU memory.
#define BIAS_SIZE 100
struct BIAS_ENTRY /* Bias array entries */
{
char inner_tbl; //left element
char inner_tbm; //middle element
char inner_tbr; //right element
};
struct DHGN /* DHGN node data structure */
{
char left; //left message
char right; //right message
char middle; //bottom message
int idx; //index
struct BIAS_ENTRY bias_element[BIAS_SIZE]; //Bias entry size
};
—The code above is the header file.
int ccl(char hleft, char hmiddle, char hright, int neuron)
{
int a, data;
for(a = 0; a < 100; a++)
{
if((hleft == node[neuron].bias_element[a].inner_tbl) && (hmiddle == node[neuron].bias_element[a].inner_tbm) && (hright == node[neuron].bias_element[a].inner_tbr))
{
data = a+1;
break;
}
else
{
if((node[neuron].bias_element[a].inner_tbl == '\0') && (node[neuron].bias_element[a].inner_tbm == '\0') && (node[neuron].bias_element[a].inner_tbr == '\0'))
{
node[neuron].bias_element[a].inner_tbl = hleft;
node[neuron].bias_element[a].inner_tbm = hmiddle;
node[neuron].bias_element[a].inner_tbr = hright;
data = a+1;
break;
}
}
}
return data;
}
–The above is the function that i want to run in the kernel function.
So, how i allocate the nested structure in the gpu memory?