Warm up the device before benchmark timings - #111
Open
wantonsushi wants to merge 1 commit into
Open
Conversation
On a GPU build, benchmark sobol samples and benchmark lattice samples report one time CUDA context creation rather than sampler work. Both samplers have a cacheSize of zero, so neither the allocation nor the cache init touches the device, and the context is created inside the timed launch instead. On an RTX 4070 Laptop this reads as 133000us rather than 350us. See issue AcademySoftwareFoundation#109. Launch the sampler kernel once with a sample count of zero ahead of both measurements. The loop body never runs, so the launch only covers device setup. Cache backed samplers create the context in their managed allocation already, and their numbers are unchanged. Signed-off-by: wantonsushi <realeuanhughes@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On a GPU build,
benchmark sobol samplesandbenchmark lattice samplesmeasure one time CUDA context creation rather than the sampler, as reported in #109. Neither sampler allocates a cache, so nothing touches the device until the timed launch.The solution is to launch the kernel once with a sample count of zero ahead of both measurements. The loop body never runs, so this only creates the context. RTX 4070 Laptop, Release, median of three runs, microseconds:
sobolbn,latticebn,pmjandpmjbnare unchanged, as their managed cache allocation already creates the context ahead of both timers.Closes #109.