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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:31:22+00:00 2026-06-10T05:31:22+00:00

I am calling CUDA kernels from matlab. I was previously told that ( David

  • 0

I am calling CUDA kernels from matlab.

I was previously told that ( David Kirk’s book) one could only take 16kb of shared memory per thread, but I am able to consume far more than that:

__global__ void plain(float* arg)
{

    __shared__ float array[12000];
    int k;

    for (k=1;k<12000; k++)
    {
        array[k]=1;
    }   
}

CUDA C reports that a float is 4 bytes, meaning that total array size is 48Kb which is greater than 12Kb. It runs fine, so how can this be?

I am also told in
GPU shared memory size is very small – what can I do about it?
that the max shared mem per block is important. Max shared memory per block for my card is
49152 bytes, yet I am able to run the above code with 1000 threads per block.

it seems like it would use 49Kb per block, which can’t be right. Is it that the SM only services one block at once and in dong preserves the condition that there can only be 49Kb per thread block?

How is 49Kb shared mem per block reconciled with 16Kb shared memory per thread?

Thanks

  • 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-10T05:31:23+00:00Added an answer on June 10, 2026 at 5:31 am

    Shared memory is allocated per thread block, with as much as 48 KB available per SM with compute capability 2.0 and up. So on a given SM you could be running a single thread block that consumes the entire 48 KB or, say, three thread blocks each of which allocates 16 KB. The limit of 16 KB of shared memory per SM applies to compute capabilities < 2.0. As opposed to shared memory, which is allocated per thread block, local memory (“local” meaning “thread local”) is allocated per thread.

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

Sidebar

Related Questions

Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
A follow up Q from: CUDA: Calling a __device__ function from a kernel I'm
To hide latency for calling cuda kernels, is there support for calling a sequence
Calling Specific Method from ListActivity which invokes method in one of the Parent(TabActivity) w/o
Calling the WriteObject Method from a background thread is not possible! Is there a
Calling urrlib2.urlopen on a link to an article fetched from an RSS feed leads
While calling from my Web Application, WCF response i am getting is : <s:Envelope
Am calling a webservice from my jQuery to fetch both Staff and Student details.
Calling a .net SOAP1.1 web service from android using ksoap2 lib I met a
Calling System.gc() requests that garbage collection takes place, and isn't guaranteed. The part about

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.