File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -65,13 +65,19 @@ void run(int NTASKS, int ms)
65
65
66
66
ctx.finalize ();
67
67
68
- float elapsed;
68
+ [[maybe_unused]] float elapsed;
69
69
cuda_safe_call (cudaEventElapsedTime (&elapsed, start, stop));
70
70
71
- // Give 25% margin of error
72
- float expected = 1 .0f * NTASKS * ms;
73
- float err = fabs (elapsed - expected) / expected;
74
- EXPECT (err < 0 .25f );
71
+ [[maybe_unused]] float expected = 1 .0f * NTASKS * ms;
72
+
73
+ /* We cannot really expect this measurement to be accurate because the
74
+ * thread(s) executing the code might be preempted on a system with a high load
75
+ * (as during unit tests). So the best we can expect is that the elapsed time
76
+ * is larger than the sleep time, but event the timer on the GPU is not
77
+ * perfectly accurate so we do not make any strict assumptions about the
78
+ * test, and just keep this test to demonstrate how to use the mechanisms,
79
+ * and ensure they are functional . */
80
+ // EXPECT(elapsed >= expected);
75
81
}
76
82
77
83
int main (int argc, char ** argv)
You can’t perform that action at this time.
0 commit comments