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 6381057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:20:51+00:00 2026-05-25T02:20:51+00:00

I have a 2D array that I have split up into several 1D arrays

  • 0

I have a 2D array that I have split up into several 1D arrays and made those 1D arrays into OpenCL buffers. Sometimes I need a kernel function to take the entire 2D array but since its size is determined at runtime I cannot just make enough kernel arguments as there are 1D arrays (plus there can be over 1000 1D arrays). I am hoping that there is some way I can take the 1D array holding OpenCL buffers and combine them into one large buffer that has the entire data and send it to my kernel. Right now the only way I can see of doing this is if I read the data from the 1D buffers back to my program, arrange them into a giant 1D array and write the new buffer back to my compute device this seems like it will be extremely slow, is there any other way?

  • 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-05-25T02:20:52+00:00Added an answer on May 25, 2026 at 2:20 am

    Here are a couple of ideas (though I admit they are not ideal).

    Instead of copying the buffers back to your program, then building new buffers from it, you can use the clEnqueueCopyBuffer() method (or the clEnqueueCopyBufferRect(), depending on your situation) to copy data from one buffer to another. I believe (but I wouldn’t swear to it) that how this copy is performed is implementation dependent, but it seems that a buffer that resides in device memory could be copied to another buffer in device memory without the need to cross the bus back to host memory.

    Of course (if I understand correctly), copying is not really what you wanted anyway. How about using the clCreateSubBuffer() method? This method can make a new buffer that simply points to a sub-section of an existing buffer (without actually making a copy of its own). To do this, (from my understanding of what you’ve described) you would need to make the large 2D buffer, then create a number of light-weight 1D sub-buffers that point to regions of this memory.

    In this way, you can pass the buffer that represents the whole 2D array when necessary, but just pass one or more 1D sub-buffers when that is all that is required.

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

Sidebar

Related Questions

I have a large array in PHP. It contains strings that are split into
I have a string which I need to split into an array and then
I have an object array that is being passed and then split up into
I have a string that I need split into smaller strings with an equal
I have a char array in a C application that I have to split
I have a form that has been split out into a partial so I
I have an array full of sub arrays. I need to break apart the
I have a list of numbers and I need to split into to corresponding
I have a set of data which is split into two arrays (let's call
I have an array that can hold up to several thousands of items.(usually around

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.