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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:03:02+00:00 2026-05-24T06:03:02+00:00

I have a vector of size n (unknown before the main program is launched),

  • 0

I have a vector of size n (unknown before the main program is launched), and I want to experiment with the work-group sizes. However, unless I set the local_work_size to a number that exactly divides n, I only get 0 values in fprop below.

Kernel:

__kernel void palt(__global double *fprop, __global const double *fcoll,
                   __global const int *nn, const uint max_size)
{
    size_t l = get_global_id(0);

    if( l > max_size ) return;

    fprop[l] = fcoll[nn[l]];

}

Host code:

int block_sz_p = 128;
const int max_size = ns*imax;

// set the parameters for the propagation operator
errNum = clSetKernelArg(propagation_kernel, 0, sizeof(cl_mem), &fpd);
errNum |= clSetKernelArg(propagation_kernel, 1, sizeof(cl_mem), &fcd);
errNum |= clSetKernelArg(propagation_kernel, 2, sizeof(cl_mem), &nnd);
errNum |= clSetKernelArg(propagation_kernel, 3, sizeof(int), (void *) &max_sz);
checkErr(errNum, "clSetKernelArg(propagation)");

// specify the work group size/dim
const size_t work_dim = 3;  
const size_t global_work_size_propagation[] = {imax*ns, 1, 1};
const size_t local_work_size_propagation[] = {block_sz_p, 1, 1};

// propagation
clEnqueueNDRangeKernel(queue, propagation_kernel, work_dim, NULL, 
                       global_work_size_propagation, local_work_size_propagation,
                       0, NULL, &event);

clWaitForEvents(1, &event); 
clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_START, 
                        sizeof(cl_ulong), &start, NULL);
clGetEventProfilingInfo(event, CL_PROFILING_COMMAND_END, 
                        sizeof(cl_ulong), &end, NULL);
tker2 = (end-start);

What’s going on here?

  • 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-24T06:03:03+00:00Added an answer on May 24, 2026 at 6:03 am

    You should check for CL errors, clEnqueueNDRangeKernel and other calls return a error code (others return the error code by reference).

    I assume the problem is when the global workgroup size isn’t divisible by the local workgroup size, which is not supported and generates a CL error:

    CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and number of work-items specified by global_work_size is not evenly divisable by size of work-group given by local_work_size or does not match the work-group size specified for kernel using the attribute((reqd_work_group_size(X, Y, Z))) qualifier in program source.

    From the clEnqueueNDRangeKernel man page.

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

Sidebar

Related Questions

I want to be able to initialize a vector of a size 'SIZE' before
I have a vector of size four and want to be able to iterate
Suppose I have a std::vector (let's call it myVec ) of size N .
I have a vector that I want to insert into a set . This
I have a vector of integers and I want to convert it to a
I have a vector of beans that holds information I want to display in
I have a std::vector of values for which I know the maximum size, but
I have a vector<char> of data which I want to write into std::stringstream .
I have following requirement, std::vector< std::vector < std::string > > segments; There are unknown
I have a vector containing large number of elements. Now I want to write

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.