PDA

View Full Version : user defined data Structures as kernel arguments



cjam
10-09-2009, 01:15 PM
Hello,

I have been working on a kernel for some simulation application where I am using a defined data Structure inside my kernel. I am however having some issues with it and was hoping for some help. My program keeps dying at a certain point in my kernel. Here is the code in question:

Data Structure


struct TLM_node {
float v1;
float v2;
float v3;
float v4;
};
typedef struct TLM_node nodeTLM;



__kernel void meshTLM_scatter_kernel(
__global nodeTLM* inputMesh,
__global nodeTLM* outputMesh,
__global float* test,
__local nodeTLM* subMesh)
{
// Block, Thread and global ID's.
// Local and Global work size dimensions
// Block index
int blockX = get_group_id(0);
int blockY = get_group_id(1);

// Thread index
int threadX = get_local_id(0);
int threadY = get_local_id(1);

// Local Work Group Size (x and y)
int localWidth = get_local_size(0);
int localHeight = get_local_size(1);

// Global work size
int globalWidth=get_global_size(0);
int globalHeight=get_global_size(1);

// Global id of this thread
int globalX=get_global_id(0);
int globalY=get_global_id(1);

int col=blockX*localWidth+threadX;
int row=blockY*localHeight+threadY;
// Just a test
if(threadX==0 && threadY==0){
subMesh[0]=inputMesh[0]; // Kills my program
// subMesh[0].v1=inputMesh[0].v1 // Does not kill my program
test[0]=subMesh[0].v1;
}

}

I can't figure out why I am unable to copy an entire node (nodeTLM) from my inputMesh variable however I can copy individual structure elements.

Thanks for any help you can offer,

I feel like it might just be a stupid mistake.

affie
10-09-2009, 04:53 PM
If you can copy individual structure elements, then you should be able copy the entire struct as well. This looks like a bug in the implementation to me. Please file a bug report against the implementation.