179 questions
No questions match those filters.
← All questions
LLMOps & ProductionMedium· CUDA· Benchmarking· Performance
How would you correctly benchmark a custom CUDA kernel’...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansBenchmarking a custom CUDA kernel requires careful attention to the asynchronous nature of GPU execution. First, warm-up iterations are mandatory to prime the JIT compilation and caches. Second, you must use torch.cuda.synchronize() before and after the timed region to drain the GPU command queue, ensuring the timer measures actual GPU execution time rather than CPU dispatch time. Finally, results should be averaged over 20 or more trials using time.perf_counter() to ensure statistical significance.