Results 1 to 2 of 2

Thread: user defined data Structures as kernel arguments

  1. #1
    Junior Member
    Join Date
    Oct 2009
    Posts
    1

    user defined data Structures as kernel arguments

    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
    Code :
    struct TLM_node {
    	float v1;
    	float v2;
    	float v3;
    	float v4;
    };
    typedef struct TLM_node nodeTLM;


    Code :
    __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.

  2. #2
    Senior Member
    Join Date
    Sep 2002
    Location
    Santa Clara
    Posts
    105

    Re: user defined data Structures as kernel arguments

    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.

Similar Threads

  1. user defined data types in OpenCL
    By Linuxboy2007 in forum OpenCL
    Replies: 0
    Last Post: 10-12-2012, 06:12 AM
  2. Replies: 8
    Last Post: 04-23-2010, 01:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •