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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:24:17+00:00 2026-05-22T14:24:17+00:00

As anything with CUDA, the most basic things are sometimes the hardest… So…I just

  • 0

As anything with CUDA, the most basic things are sometimes the hardest…

So…I just want to copy a variable from the CPU to a GPU’s constant variable, and I am having a hard time.

This is what i have:

__constant__ int contadorlinhasx_d;

int main(){

(...)
int contadorlinhasx=100;
     status=cudaMemcpyToSymbol(contadorlinhasx_d,contadorlinhasx,1*sizeof(int),0,cudaMemcpyHostToDevice);

And i get this error

presortx.cu(222): error: no instance of overloaded function "cudaMemcpyToSymbol" matches the argument list
        argument types are: (int, int, unsigned long, int, cudaMemcpyKind)

Could anyone help me? I know it is some stupid error, but I am tired of googling it, and I have spent almost 30 minutes just trying to copy a stupid variable :/

Thanks in advance

  • 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-22T14:24:18+00:00Added an answer on May 22, 2026 at 2:24 pm

    You need to do something like

    cudaMemcpyToSymbol("contadorlinhasx_d",
                       &contadorlinhasx,
                       1*sizeof(int),
                       0,
                       cudaMemcpyHostToDevice);
    

    [Note this is the old API call, now deprecated in CUDA 4.0 and newer]

    or

    cudaMemcpyToSymbol(contadorlinhasx_d,
                       &contadorlinhasx,
                       1*sizeof(int),
                       0,
                       cudaMemcpyHostToDevice);
    

    If you look at the API documentation, the first two arguments are pointers. The first can either be a string, which will force a symbol lookup internally in the API (pre CUDA 4), or a device symbol address (CUDA 4 and later). The second argument is the address of the host source memory for the copy. The compiler error message is pretty explicit – you are passing the wrong types of argument and the compiler can’t find an instance in the library which matches.

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

Sidebar

Related Questions

Is there anything as half precision floating points in CUDA? Background: I want to
It seems like anything you can do with bytecode you can do just as
Is anything wrong with this code? <?php $variable = ; if (isset($variable)) { echo
I just managed to install my cuda SDK under Linux Ubuntu 10.04. My graphic
Before anything, this is not necessarily a question.. But I really want to know
Before anything, yes, this is from coursework and I've been at it sporadically while
Is there anything wrong the script bewlow, because I just can't login..... And I'm
I converted a program from IDL into CUDA that performs some calculations on a
Anything wrong with this code? I want it to print the name and address
Anything thats as good and as stable and as feature-rich as gigaspaces?

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.