Results 1 to 2 of 2

Thread: arguments to kernel functions

  1. #1
    Junior Member
    Join Date
    Apr 2010

    arguments to kernel functions

    Can I pass to kernel function pointer to structure like this:
    Code :
    structure My {
        int x1;
        int x2;
        my_structure_type1 *ps1;
        my_structure_type2 *ps2;
    where my_structure_type1 and my_structure_type2 are my own defined types from other structures.

  2. #2
    Junior Member
    Join Date
    Feb 2010

    Re: arguments to kernel functions


    I am not sure if I understand you correctly, but if you have situation, where you fill the variable of My structure with data on host(your program using OpenCL) and then you pass this struct (or pointer to it) via buffer to kernel like this:
    __kernel void myKernel(__global My* myVar)
    ...then the pointer members of My structure (ps1, ps2) will still contain address which points somewhere to host memory, while the kernel is (I presume) executed on GPU, in completely different address space.

    I remember getting myself into similar trap, resulting in various side effects like freezing up the PC.

    So, in my opinion it is not possible to do it this way.


Similar Threads

  1. Vectors and kernel arguments
    By billy124 in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 0
    Last Post: 08-07-2012, 08:47 PM
  2. Not having functions return values via pointer arguments
    By PaulS in forum OpenCL - parallel programming of heterogeneous systems
    Replies: 2
    Last Post: 10-15-2009, 06:11 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
Proudly hosted by Digital Ocean