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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T18:19:32+00:00 2026-06-07T18:19:32+00:00

For a given Kernel, why are work_groups of always the same size? I read

  • 0

For a given Kernel, why are work_groups of always the same size?
I read somewhere (for the case in which we don’t specify the local work size) that openCL creates 3 work groups(of 217 work-items each) for kernel with 651 work-items(divisible by 3) while it creates 653 work-groups of 1 work-item each, as 653 is a prime number.

Suppose we specify the local_work_size(i.e. no. of work-items in a work-group), let’s say,5. And we have given the total work-items(global_work_size) as 9. How will the work groups be created? is this why the global_work_size have to be a multiple of local_work_size? If the data requires only 9 work-items, how do I increase it to 10(multiple of local_work_size,5)?

Why can’t host allocate the memory for result array if it doesn’t know how many work groups will execute the kernel?

Please help.
I read all this on this:
http://www.openclblog.com/2011/09/work-group-sizes.html

  • 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-07T18:19:33+00:00Added an answer on June 7, 2026 at 6:19 pm

    OpenCL Work groups sizes don’t need to be always the same size. The Global work group size is frequently related to the problem size. The Local Work Group Size is selected based on maximizing Compute Unit throughput and the number of threads that need to share Local Memory.

    Let consider a couple of examples;

    A) Scale a image from N by M to X by Y.

    B) Sum N numbers.

    For A)

    The obvious Global Work Group Size is X ,Y, 1. Why? This gives 1 thread per out pixel.
    The Local Work Group Size should be chosen based on the number of Input pixels that need to be processed to generate an output pixel.

    Eg.

    A.1)Scale an image from 4K by 3.2K to 64 by 64. GWG Size [64,64,1] LWG Size 256
    A.2)Scale an image from 4k by 3.2k to 800 by 600.GWG Size [800,60,1] LWG Size 256

    For B)

    The obvious Global Work Group Size is N/2,1,1, Why? So each thread starts by summing 2 values together. The Local Work Group should be set to the device max.

    There are some caveats;

    1) Global Work Group Size is constrained by the Global Memory Size and the Max Global Memory Allocation size.

    2) Each device has a max Local Work group size often 256

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

Sidebar

Related Questions

I'm writing a CUDA kernel which involves calculating the maximum value on a given
I have a kernel that, for each thread in a given block, computes a
I have a library I am using (which is critical to my work) that
Given the class Ninja, with a specified binding in the Ninject kernel I can
I followed the instructions given in the link: http://blog.avirtualhome.com/how-to-compile-a-new-ubuntu-11-04-natty-kernel/ for building a custom kernel
Given that the web application doesn't have su privileges, I'd like to execute a
Given this method to work on a HTML page in a webbrowser: bool semaphoreForDocCompletedEvent;
I'm taking an operating systems design class in which they have given us a
Given a float[n] inputdata to pass to the OpenCL kernel, could anyone enlighten me
I am unable to compile a linux kernel module, Given the following source: /*

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.