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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:20:00+00:00 2026-05-27T07:20:00+00:00

I have Nvidia geforce 310M and when i write this code int main() {

  • 0

I have Nvidia geforce 310M and when i write this code

int main()
{
    int dev;
    cudaDeviceProp prop;
    cudaGetDevice(&dev);
    cudaGetDeviceProperties(&prop,dev);
    cout << "Device name " << prop.name << endl;
    cout << "warp size  = " << prop.warpSize << endl;
    cout << "mutiprocesosrs = " << prop.multiProcessorCount << endl;
    return 0;
}

it writes :

Device name ♀
warp size  = -2144521342
mutiprocesosrs = 0
Press any key to continue . . .

and every time i run this program it produces different warp size.
how can i fix that ?

(p.s. I’m using visual studio 2010)

  • 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-27T07:20:01+00:00Added an answer on May 27, 2026 at 7:20 am

    Check first of all whether the function calls succeed!

    cudaDeviceProp prop;
    int dev;
    
    if (cudaGetDevice(&dev) != cudaSuccess)
    {
      /* error */
      abort();
    }
    
    if (cudaGetDeviceProperties(&prop, dev) != cudaSuccess)
    {
      /* error */
      abort();
    }
    

    I made a little macro I use for calling all CUDA functions which takes care of the checking and throws a custom exception:

    #define CUDACALL(F, ARGS...) do { e = F(ARGS); if (e != cudaSuccess) throw cudaException(#F, e); } while (false)
    

    With this, I just say,

    try
    {
       int dev;
       cudaDeviceProp prop;
       CUDACALL(cudaGetDevice, &dev);
       CUDACALL(cudaGetDeviceProperties, &prop, dev);
       // ...
    }
    catch (cudeException const & e)
    {
      std::cerr << "Cuda error: " << e.what() << "\n";
    }
    

    The exception class is defined as follows:

    struct cudaException : public std::exception
    {
      cudaException(const std::string & str, cudaError_t err) : s(str), e(err) { }
    
      ~cudaException() throw() { }
    
      virtual const char * what() const throw()
      {
        const std::string r = s + ": \"" + cudaGetErrorString(e) + "\" (" + (char)(e + '0') + ')';
        return r.c_str();
      }
    private:
      std::string s;
      cudaError_t e;
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have simplified my problem to this example: #include <GL/glut.h> int main(int argc, char**
I found this code in NVIDIA's CUDA SDK samples. void computeGold( float* reference, float*
Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you managed to get Aptana Studio debugging to work? I tried following this,
Have had to write my first proper multithreaded coded recently, and realised just how
Okay i have already been through most of the ati and nvidia guides to
At present, Ubuntu offers the 195.36.24 drivers as nvidia-current in their repository. This packaged
I have some code, the p.words is hidden, I tried to make a judge,
I have a NVIDIA GTX 570 compute capability 2.0 running cuda-4.0. The deviceQuery executable
For NVIDIA graphics cards, you can have two working as one (SLI). For a

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.