diff options
Diffstat (limited to 'preemption_logger.cu')
| -rw-r--r-- | preemption_logger.cu | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/preemption_logger.cu b/preemption_logger.cu index 89b348a..ec3c22e 100644 --- a/preemption_logger.cu +++ b/preemption_logger.cu | |||
| @@ -90,10 +90,11 @@ int main(int argc, char **argv) { | |||
| 90 | // Synchronize the GPU and CPU clocks (if requested) using the utilities | 90 | // Synchronize the GPU and CPU clocks (if requested) using the utilities |
| 91 | // from task_host_utilities.cu. | 91 | // from task_host_utilities.cu. |
| 92 | if (!skip_conversion) { | 92 | if (!skip_conversion) { |
| 93 | // Note that this appears to almost always be 1.0 on recent GPUs | 93 | // The skew is between -13 and 60 microseconds per second on the GTX |
| 94 | d2h_scale = GetGPUTimerScale(0); | 94 | // 1080, GTX 1060 3 GiB, GTX 970, RTX 6000 Ada, and GTX 1080 Ti. |
| 95 | d2h_scale = InternalGetGPUTimerScale(0); | ||
| 95 | InternalReadGPUNanoseconds(0, &host_s, &dev_ns); | 96 | InternalReadGPUNanoseconds(0, &host_s, &dev_ns); |
| 96 | if (host_s == 0 && !dev_ns) { | 97 | if (d2h_scale == -1 || (host_s == 0 && !dev_ns)) { |
| 97 | fprintf(stderr, "Unable to synchronize time with the GPU. Aborting...\n"); | 98 | fprintf(stderr, "Unable to synchronize time with the GPU. Aborting...\n"); |
| 98 | return 1; | 99 | return 1; |
| 99 | } | 100 | } |
| @@ -153,7 +154,9 @@ int main(int argc, char **argv) { | |||
| 153 | fprintf(stderr, "(%d) Aprox launch overhead: %ld ns\n", pid, launch_oh); | 154 | fprintf(stderr, "(%d) Aprox launch overhead: %ld ns\n", pid, launch_oh); |
| 154 | fprintf(stderr, "(%d) CPU clock - GPU clock: %ld tick gap\n", pid, | 155 | fprintf(stderr, "(%d) CPU clock - GPU clock: %ld tick gap\n", pid, |
| 155 | (long)s2ns(host_s) - dev_ns); | 156 | (long)s2ns(host_s) - dev_ns); |
| 156 | fprintf(stderr, "(%d) 1 CPU tick/1 GPU tick: %.3f\n", pid, d2h_scale); | 157 | fprintf(stderr, "(%d) After 1 second, the GPU clock is %.f us %s (%.9fx d2h)\n", |
| 158 | pid, fabs((d2h_scale - 1) * 1e6), | ||
| 159 | d2h_scale > 1 ? "behind" : "ahead", d2h_scale); | ||
| 157 | } | 160 | } |
| 158 | 161 | ||
| 159 | return 0; | 162 | return 0; |
