From fa0c33d216f14fa6f81f177cc7098c7d8ae70286 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Wed, 5 Jul 2023 16:45:46 -0400 Subject: Comments and check for successful cleanup in mon_cross_ctx_copies --- copy_experiments/mon_cross_ctx_copies.cu | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'copy_experiments') diff --git a/copy_experiments/mon_cross_ctx_copies.cu b/copy_experiments/mon_cross_ctx_copies.cu index dfccdfc..d9749e0 100644 --- a/copy_experiments/mon_cross_ctx_copies.cu +++ b/copy_experiments/mon_cross_ctx_copies.cu @@ -3,7 +3,13 @@ * (by default) and logs the times that pages are copied to the GPU. Supports * monitoring copy progress from either the GPU or the CPU. All output times are * converted to ns. - * WARNING: By default, assumes that GPU and CPU clocks tick at the same rate. + * Some assumptions: + * - GPU clock ticks at a constant rate + * - GPU clock ticks even while GPU is idle + * - Different contexts view the same underlying GPU clock + +WARNING: By default, assumes that GPU and CPU clocks tick at the same rate. + * */ #include "copy_testbench.h" #include "../task_host_utilities.cu" // Just for GetHostDeviceTimeOffset() @@ -46,7 +52,7 @@ static const int CPU_MON_DIVISOR = 50; static const int GPU_MON_THREADS = 32; // If delay start is enabled on any thread, how great is the delay? static const struct timespec DELAY_TIME = {0, 50*1000l*1000l}; // 50ms (use 30ms for GV100) -// Should each thread doing GPU monitoring check for GPU clock skew? +// Should each GPU-copy-monitoring thread check for GPU clock skew? static const bool SKEW_CHECK = false; // Size of each copy to the GPU, in bytes @@ -204,9 +210,9 @@ void* copy_thread(void* args_raw) { fprintf(stderr, "GPU clock ran at rate %f of CPU clock (%f ticks GPU vs %f ticks CPU)\n", dev_diff/host_diff, dev_diff, host_diff); } - cudaFreeHost(pinned_hostmem); - cudaFree(devtimes); - cudaFree(devmem); + SAFE(cudaFreeHost(pinned_hostmem)); + SAFE(cudaFree(devtimes)); + SAFE(cudaFree(devmem)); return times; } -- cgit v1.2.2