Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9223621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:06:58+00:00 2026-06-18T04:06:58+00:00

I want to pass a structure to opencl kernel, the structure is struct test

  • 0

I want to pass a structure to opencl kernel, the structure is

struct test
{
    int *x;
    float *y;
    char *z;
};

and the memory allocation and initialization is like

    struct test t;
t.x = (int*)malloc(sizeof(int)*100);
t.y = (float*) malloc (sizeof(float)*50);
t.z = (char*) malloc (sizeof(char) *25);
  for(i = 0;i<100;i++)
  {
      t.x[i] = i;
      if(i<50)
          {
              t.y[i] = i;
          if(i<25)
              t.z[i] = 'a';
          }
  }

can i pass such a structure to opencl kernel

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:06:59+00:00Added an answer on June 18, 2026 at 4:06 am

    You can pass such a structure, but it will be pointless because x, y and z point to different memory regions. Each of these memory buffers must be transferred on its own.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I want to pass a structure defined in windows.h to one of method
I want to pass '#' to the query string like ?page.aspx?someParam=1234#5 .
I want to pass a serialized Perl data structure as a GET variable to
I want to pass a JSON data structure to an MVC (3) Controller, have
I want to pass this structure from intent A to intent B: Hashtable> parsedData;
I want to pass two anonymous functions as arguments for jQuery's hover, like so:
So in structure like struct RenderCastedDataFunctor { simpleRendererGraphElement* obj_; RenderCastedDataFunctor(simpleRendererGraphElement* obj) : obj_(obj) {
I want to create my url structure like:: facebook i.e. facebook.com/?pageid=122 For which I
I want to pass a structure in C++ to a javascript function. I can
I want to know how to pass structures to another function and subsequently access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.