Timing cudaEventRecord() ok for cpu timing?

I’m writing my first cuda program to compare performance of the device over the host. Here is the code I used to record the host computation time:

    //Create and Record cuda events to time cpu execution
    cudaEvent_t start1, stop1;
    float cputime;

    doCompOnHost(a_h, b_h, c_h, result_h, N );

    //End Time events for host
    cudaEventRecord(stop1, 0);
    cudaEventElapsedTime(&cputime, start1, stop1);

Would this return an accurate time for the cpu compuation?

Thanks in advance.

Short answer, no…events only time GPU.

Long answer from Mister Anderson:

Thanks, I just read the kernel calls are asynchronous, so it makes sense why it wouldn’t work for CPU times. Do you know of a comprehensible CPU timing tutorial in C. I just want to time a cpu function. :ermm: