Skip to content

Warm up the device before benchmark timings - #111

Open
wantonsushi wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
wantonsushi:benchmark-gpu-warm-up
Open

Warm up the device before benchmark timings#111
wantonsushi wants to merge 1 commit into
AcademySoftwareFoundation:mainfrom
wantonsushi:benchmark-gpu-warm-up

Conversation

@wantonsushi

@wantonsushi wantonsushi commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

On a GPU build, benchmark sobol samples and benchmark lattice samples measure 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:

sampler before after
sobol 133457 349
lattice 131444 119

sobolbn, latticebn, pmj and pmjbn are unchanged, as their managed cache allocation already creates the context ahead of both timers.

Closes #109.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

benchmark samples measures CUDA context creation on GPU

1 participant