From d90826c1cc5f03fdc0aaef5bf20c57aec6556940 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Mon, 19 Feb 2024 20:53:09 -0500 Subject: Always synchronize GPU and CPU time in the current process Performing the synchronization in a child process was fragile, high-overhead, and unnecessary for our use cases. --- preemption_logger.cu | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'preemption_logger.cu') diff --git a/preemption_logger.cu b/preemption_logger.cu index d93600e..89b348a 100644 --- a/preemption_logger.cu +++ b/preemption_logger.cu @@ -1,4 +1,4 @@ -/* Copyright 2023 Joshua Bakita +/* Copyright 2024 Joshua Bakita * Tool that tracks preemptions as discontinuities in GPU time and logs them. * * The logged intervals are output to standard out as a CSV, with each row @@ -92,8 +92,11 @@ int main(int argc, char **argv) { if (!skip_conversion) { // Note that this appears to almost always be 1.0 on recent GPUs d2h_scale = GetGPUTimerScale(0); - // The following uses a subprocess for clock synchronization. Sketch? - GetHostDeviceTimeOffset(0, &host_s, &dev_ns); + InternalReadGPUNanoseconds(0, &host_s, &dev_ns); + if (host_s == 0 && !dev_ns) { + fprintf(stderr, "Unable to synchronize time with the GPU. Aborting...\n"); + return 1; + } } // Initialize GPU and CPU memory to store the intervals of execution -- cgit v1.2.2