| 39 | # consistent numbers. |
| 40 | class BaseOpCacheLimit(AbstractOpBase): |
| 41 | def setup(self, input, new_cache_limit, low, high): |
| 42 | super().setup(input) |
| 43 | |
| 44 | # make this benchmark compatible with older cvcuda versions |
| 45 | if hasattr(cvcuda, "set_cache_limit_inbytes"): |
| 46 | cvcuda.set_cache_limit_inbytes(new_cache_limit) |
| 47 | |
| 48 | # We don't have access to the outer benchmark iterations (default=10), so we have to create our own |
| 49 | # counter. |
| 50 | self.max_iter_outer = 10 |
| 51 | self.iter_outer = 0 |
| 52 | |
| 53 | # Number of "random" tensors created per benchmarked run |
| 54 | self.n_tensors = 20 |
| 55 | self.hw = torch.randint( |
| 56 | low=low, high=high, size=(self.max_iter_outer, 2, self.n_tensors) |
| 57 | ) |
| 58 | |
| 59 | def run(self, input): |
| 60 | # If we exceed the outer bench iterations, we return. |