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

  • Home
  • SEARCH
  • 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 124749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:02:59+00:00 2026-05-11T05:02:59+00:00

I have a CUDA kernel which I’m compiling to a cubin file without any

  • 0

I have a CUDA kernel which I’m compiling to a cubin file without any special flags:

nvcc text.cu -cubin 

It compiles, though with this message:

Advisory: Cannot tell what pointer points to, assuming global memory space

and a reference to a line in some temporary cpp file. I can get this to work by commenting out some seemingly arbitrary code which makes no sense to me.

The kernel is as follows:

__global__ void string_search(char** texts, int* lengths, char* symbol, int* matches, int symbolLength) {     int localMatches = 0;     int blockId = blockIdx.x + blockIdx.y * gridDim.x;     int threadId = threadIdx.x + threadIdx.y * blockDim.x;     int blockThreads = blockDim.x * blockDim.y;      __shared__ int localMatchCounts[32];      bool breaking = false;     for(int i = 0; i < (lengths[blockId] - (symbolLength - 1)); i += blockThreads)     {         if(texts[blockId][i] == symbol[0])         {             for(int j = 1; j < symbolLength; j++)             {                 if(texts[blockId][i + j] != symbol[j])                 {                     breaking = true;                     break;                 }             }             if (breaking) continue;             localMatches++;         }     }      localMatchCounts[threadId] = localMatches;      __syncthreads();      if(threadId == 0)     {         int sum = 0;         for(int i = 0; i < 32; i++)         {             sum += localMatchCounts[i];         }         matches[blockId] = sum;     } } 

If I replace the line

localMatchCounts[threadId] = localMatches; 

after the first for loop with this line

localMatchCounts[threadId] = 5; 

it compiles with no notices. This can also be achieved by commenting out seemingly random parts of the loop above the line. I have also tried replacing the local memory array with a normal array to no effect. Can anyone tell me what the problem is?

The system is Vista 64bit, for what its worth.

Edit: I fixed the code so it actually works, though it still produces the compiler notice. It does not seem as though the warning is a problem, at least with regards to correctness (it might affect performance).

  • 1 1 Answer
  • 1 View
  • 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. 2026-05-11T05:02:59+00:00Added an answer on May 11, 2026 at 5:02 am

    Arrays of pointers like char** are problematic in kernels, since the kernels have no access to the host’s memory.
    It is better to allocate a single continuous buffer and to divide it in a manner that enables parallel access.
    In this case I’d define a 1D array which contains all the strings positioned one after another and another 1D array, sized 2*numberOfStrings which contains the offset of each string within the first array and it’s length:

    For example – preparation for kernel:

     char* buffer = st[0] + st[1] + st[2] + ….; int* metadata = new int[numberOfStrings * 2]; int lastpos = 0; for (int cnt = 0; cnt < 2* numberOfStrings; cnt+=2) {     metadata[cnt] = lastpos;     lastpos += length(st[cnt]);     metadata[cnt] = length(st[cnt]); } 

    In kernel:

     currentIndex = threadId + blockId * numberOfBlocks; char* currentString = buffer + metadata[2 * currentIndex]; int currentStringLength = metadata[2 * currentIndex + 1]; 

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

Sidebar

Ask A Question

Stats

  • Questions 173k
  • Answers 173k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I see no real problems with your first option --… May 12, 2026 at 2:41 pm
  • Editorial Team
    Editorial Team added an answer The only way is to list all 9 columns. Such… May 12, 2026 at 2:41 pm
  • Editorial Team
    Editorial Team added an answer Here are a few hints: Start with trying to connect… May 12, 2026 at 2:41 pm

Related Questions

I have a CUDA kernel which I'm compiling to a cubin file without any
This article describes a way, in C#, to allow the addition of arbitrary value
In a CUDA kernel, I have code similar to the following. I am trying
I've struggled with this all day, I am trying to get a random number
So, im trying to write some code that utilizes Nvidia's CUDA architecture. I noticed

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.