Reputation: 132320
I have a discrete NVIDIA GPU (say, Kepler or Maxwell). I want to clear my L2 cache before some kernel is scheduled, so as not to taint my test results.
I could do something like allocate a large slab of memory and read sequentially a lot of it that's someplace far away, and that will probably work. But I'd much rather do something simpler...
Notes:
Upvotes: 6
Views: 1832
Reputation: 132320
So, to recap the comments by @MaximMilakov and @paleonix:
cudaMemset()
on this large slab.... and this approach is used in NVIDIA's own nvbench utility.
caveat: It's a bit strange that this works, since the reads and writes with cudaMemset()
shouldn't necessarily result in L2 caching.
Upvotes: 1