I want to pass an array of structures to a CUDA Kernel.
My structure:
Host device makes the AoS
And then to see if it copied to the Kernel correctly:
The problem is that only the first element of Group_Places gets to the Kernel. How can I get the whole AoS to go over to the kernel?
My structure:
Code:
struct Group_Output_Places
{
float Parameter[3];
int Place_ID[3];
};
Host device makes the AoS
Code:
struct Group_Output_Places Group_Places[31]; // 31 places
Group_Places[0].Parameter[0] = 360.2f; // f at the end tells it it is a float so it doesnt complain about it being a double
Group_Places[0].Place_ID[0] = 1;
Group_Places[0].Parameter[1] = 128.4f;
Group_Places[0].Place_ID[1] = 2;
...
struct Group_Output_Places *Dev_Group_Places;
cudaMalloc((void**)&Dev_Group_Places, sizeof(struct Group_Output_Places)* 31);
cudaMemcpy(Dev_Group_Places, &Group_Places, sizeof(struct Group_Output_Places)* 31, cudaMemcpyHostToDevice); // sizeof(Group_Output_Places)* 31 becuase it is an array
AddInts << <1, 1 >> >(Dev_Group_Places);
And then to see if it copied to the Kernel correctly:
Code:
__global__ void AddInts(struct Group_Output_Places *Dev_Group_Places){
struct Group_Output_Places GPU_Group_Places;
GPU_Group_Places = *Dev_Group_Places;
}
The problem is that only the first element of Group_Places gets to the Kernel. How can I get the whole AoS to go over to the kernel?