diff options
Diffstat (limited to 'task_host_utilities.cu')
| -rw-r--r-- | task_host_utilities.cu | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/task_host_utilities.cu b/task_host_utilities.cu index 9bb95aa..1f76080 100644 --- a/task_host_utilities.cu +++ b/task_host_utilities.cu | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | // been copied and heavily modified for use in the gpu-microbench project. | 4 | // been copied and heavily modified for use in the gpu-microbench project. |
| 5 | #include <cuda_runtime.h> | 5 | #include <cuda_runtime.h> |
| 6 | #include <errno.h> | 6 | #include <errno.h> |
| 7 | #include <sched.h> | ||
| 7 | #include <stdint.h> | 8 | #include <stdint.h> |
| 8 | #include <stdio.h> | 9 | #include <stdio.h> |
| 9 | #include <string.h> | 10 | #include <string.h> |
| @@ -191,8 +192,8 @@ static void InternalReadGPUNanoseconds(int cuda_device, double *cpu_time, | |||
| 191 | if (!CheckCUDAError(cudaMemcpy(gpu_time, device_time, sizeof(device_time), | 192 | if (!CheckCUDAError(cudaMemcpy(gpu_time, device_time, sizeof(device_time), |
| 192 | cudaMemcpyDeviceToHost))) goto out; | 193 | cudaMemcpyDeviceToHost))) goto out; |
| 193 | max_error = (cpu_end - cpu_start) / 2.0; | 194 | max_error = (cpu_end - cpu_start) / 2.0; |
| 194 | fprintf(stderr, "Time synchronized to a maximum error of +/- %f us.\n", | 195 | fprintf(stderr, "Time synchronized to a maximum error of +/- %f us on CPU%d.\n", |
| 195 | max_error * (1000.0 * 1000.0)); | 196 | max_error * (1000.0 * 1000.0), sched_getcpu()); |
| 196 | out: | 197 | out: |
| 197 | cudaFree(device_time); | 198 | cudaFree(device_time); |
| 198 | cudaFree((void*)start_barrier); | 199 | cudaFree((void*)start_barrier); |
| @@ -200,6 +201,7 @@ out: | |||
| 200 | cudaFree((void*)ready_barrier); | 201 | cudaFree((void*)ready_barrier); |
| 201 | } | 202 | } |
| 202 | 203 | ||
| 204 | // Returns 0 on success, 1 on error | ||
| 203 | int GetHostDeviceTimeOffset(int cuda_device, double *host_seconds, | 205 | int GetHostDeviceTimeOffset(int cuda_device, double *host_seconds, |
| 204 | uint64_t *gpu_nanoseconds) { | 206 | uint64_t *gpu_nanoseconds) { |
| 205 | uint64_t *shared_gpu_time = NULL; | 207 | uint64_t *shared_gpu_time = NULL; |
