Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing is inaccurate #6

Open
nh2 opened this issue Aug 29, 2015 · 0 comments
Open

Timing is inaccurate #6

nh2 opened this issue Aug 29, 2015 · 0 comments

Comments

@nh2
Copy link

nh2 commented Aug 29, 2015

I found two problems with the way kfusion measures how long the individual kernels take:

  • Use of return double(std::clock())/CLOCKS_PER_SEC

This is not an atomic clock, and worse it depends on the CPU activity. Changing it to

struct timespec clockData;
clock_gettime(CLOCK_MONOTONIC, &clockData);
return (double) clockData.tv_sec + clockData.tv_nsec / 1000000000.0;

makes the timing more accurate, and also shows that kfusion is around 10% faster than measured with the old way.

  • CUDA kernels are asynchronous. Timing information can really only be measured after cudaDeviceSynchronize(), but kfusion doesn't do that in many places (apart from the total time, which consequently is correct). Adding it before each Stats.sample fixes that, and and changes my measurement for integrate from 0.00* milliseconds to 3.* milliseconds, which makes a lot of sense.

Note though that cudaDeviceSynchronize() can slow things sometimes, but hasn't done so in my measurements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant