Device not ready Cuda

Source: Internet
Author: User

Problem Description:

CUDA: Return device not ready error when using Cudaeventelapsedtime

Emphasize that I am using Google big God to search the structure Oh!

Http://stackoverflow.com/questions/6551121/cuda-cudaeventelapsedtime-returns-device-not-ready-error

My own environment is using the Tesla C2070 GPU, and I don't know why this problem occurs, but it is possible to solve the problem on the Internet.

The scheme is as follows:

1         cudaerror_t err;2 cudaevent_t start, stop;3Cudaeventcreate (&start);4Cudaeventcreate (&stop);5Err = Cudaeventrecord (Start,0);6F (Err! =cudasuccess) {7printf ("\ n \ 1. Error:%s\n\n", cudageterrorstring (err));8Exit1);9         }Ten         //Actual code One cudathreadsynchronize (); AErr = Cudaeventrecord (Stop,0); -         if(Err! =cudasuccess) { -printf ("\n\n2. Error:%s\n\n", cudageterrorstring (err)); theExit1); -         } -Err = Cudaeventelapsedtime (&Elapsed_time, start, stop); -F (Err! =cudasuccess) { +printf ("\ n \ 3. Error:%s\n\n", cudageterrorstring (err)); -Exit1); +}

The above code is adjusted as follows:

Swap 11 lines of code and 12 lines of code for the position.

That's OK!

However, if the GPU is other structures such as the Fermi architecture, there is no need to modify the reason unknown!

Device not ready Cuda

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.