From cd9ee070e2fcaa49fe35944ea0fd60ed5d197ba2 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Mon, 19 Feb 2024 20:39:39 -0500 Subject: Split SAFE() macro into API-specific typed variants Avoids incorrectly interpreting CUDA Driver Library error codes as though they were CUDA Runtime Library error codes (the numbering is similar, but not identical). Also cleans up how we initialize and terminate a context for capability checking in `mon_cross_ctx_copies`. --- task_host_utilities.cu | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'task_host_utilities.cu') 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 @@ // been copied and heavily modified for use in the gpu-microbench project. #include #include +#include #include #include #include @@ -191,8 +192,8 @@ static void InternalReadGPUNanoseconds(int cuda_device, double *cpu_time, if (!CheckCUDAError(cudaMemcpy(gpu_time, device_time, sizeof(device_time), cudaMemcpyDeviceToHost))) goto out; max_error = (cpu_end - cpu_start) / 2.0; - fprintf(stderr, "Time synchronized to a maximum error of +/- %f us.\n", - max_error * (1000.0 * 1000.0)); + fprintf(stderr, "Time synchronized to a maximum error of +/- %f us on CPU%d.\n", + max_error * (1000.0 * 1000.0), sched_getcpu()); out: cudaFree(device_time); cudaFree((void*)start_barrier); @@ -200,6 +201,7 @@ out: cudaFree((void*)ready_barrier); } +// Returns 0 on success, 1 on error int GetHostDeviceTimeOffset(int cuda_device, double *host_seconds, uint64_t *gpu_nanoseconds) { uint64_t *shared_gpu_time = NULL; -- cgit v1.2.2