Skip to content

Commit

Permalink
Better strategy for data realisation and ASV.
Browse files Browse the repository at this point in the history
  • Loading branch information
trexfeathers committed Nov 21, 2022
1 parent e543a3c commit af1fd52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
16 changes: 9 additions & 7 deletions benchmarks/benchmarks/ci/esmf_regridder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
)
from esmf_regrid.schemes import ESMFAreaWeightedRegridder

from .. import disable_repeat_between_setup
from ..generate_data import _grid_cube, _gridlike_mesh_cube


Expand Down Expand Up @@ -124,7 +123,6 @@ def time_perform_regridding(self, tp):
_ = self.regridder(self.src)


@disable_repeat_between_setup
class TimeLazyRegridding:
def setup_cache(self):
SYNTH_DATA_DIR = Path().cwd() / "tmp_data"
Expand Down Expand Up @@ -172,8 +170,10 @@ def time_lazy_regridding(self, cache):
_ = regridder(self.src)

def time_regridding_realisation(self, cache):
# Don't touch result.data - permanent realisation plays badly with
# ASV's re-run strategy.
assert self.result.has_lazy_data()
_ = self.result.data
self.result.core_data().compute()


class TimeMeshToGridRegridding(TimeRegridding):
Expand Down Expand Up @@ -208,7 +208,6 @@ def setup(self, tp):
self.tgt = tgt


@disable_repeat_between_setup
class TimeLazyMeshToGridRegridding:
def setup_cache(self):
SYNTH_DATA_DIR = Path().cwd() / "tmp_data"
Expand Down Expand Up @@ -252,8 +251,10 @@ def time_lazy_regridding(self, cache):
_ = regridder(self.src)

def time_regridding_realisation(self, cache):
# Don't touch result.data - permanent realisation plays badly with
# ASV's re-run strategy.
assert self.result.has_lazy_data()
_ = self.result.data
self.result.core_data().compute()


class TimeGridToMeshRegridding(TimeRegridding):
Expand Down Expand Up @@ -288,7 +289,6 @@ def setup(self, tp):
self.tgt = tgt


@disable_repeat_between_setup
class TimeLazyGridToMeshRegridding:
def setup_cache(self):
SYNTH_DATA_DIR = Path().cwd() / "tmp_data"
Expand Down Expand Up @@ -328,8 +328,10 @@ def time_lazy_regridding(self, cache):
_ = regridder(self.src)

def time_regridding_realisation(self, cache):
# Don't touch result.data - permanent realisation plays badly with
# ASV's re-run strategy.
assert self.result.has_lazy_data()
_ = self.result.data
self.result.core_data().compute()


class TimeRegridderIO(MultiGridCompare):
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/benchmarks/long/esmf_regridder.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
)
from esmf_regrid.schemes import ESMFAreaWeightedRegridder

from .. import disable_repeat_between_setup, skip_benchmark
from .. import skip_benchmark
from ..generate_data import _grid_cube, _gridlike_mesh_cube


Expand Down Expand Up @@ -126,7 +126,6 @@ def time_prepare(self, _, n):
super().time_prepare(n)


@disable_repeat_between_setup
class PerformScalabilityGridToGrid:
params = [100, 200, 400, 600, 800, 1000]
param_names = ["height"]
Expand Down Expand Up @@ -192,8 +191,10 @@ def time_perform(self, cache, height):
_ = rg(self.src)

def time_lazy_perform(self, cache, height):
# Don't touch result.data - permanent realisation plays badly with
# ASV's re-run strategy.
assert self.result.has_lazy_data()
_ = self.result.data
self.result.core_data().compute()


class PerformScalabilityMeshToGrid(PerformScalabilityGridToGrid):
Expand Down

0 comments on commit af1fd52

Please sign in to comment.