Skip to content

Commit 1e08f59

Browse files
author
Lizarbe
committed
adapt runtime
1 parent 62cb3be commit 1e08f59

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

asv_bench/benchmarks/benchmark_argofloat.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pandas as pd
55
import xarray as xr
66

7-
from parcels import AdvectionRK4, FieldSet, JITParticle, ParticleSet, StatusCode, Variable
7+
from parcels import AdvectionRK4, FieldSet, JITParticle, ParticleSet, StatusCode, Variable, ScipyParticle
88

99

1010
def ArgoVerticalMovement(particle, fieldset, time):
@@ -55,8 +55,11 @@ def ArgoVerticalMovement(particle, fieldset, time):
5555

5656

5757
class ArgoFloatJIT:
58+
particle_type = JITParticle
59+
5860
def setup(self):
59-
time = pd.date_range(start="2025-01-01", end="2025-02-16", freq="D")
61+
self.runtime_days = 45
62+
time = np.datetime64("2025-01-01") + np.arange(self.runtime_days + 1) * np.timedelta64(1, "D")
6063
lon = np.linspace(-180, 180, 120)
6164
lat = np.linspace(-90, 90, 100)
6265

@@ -109,7 +112,9 @@ def setup(self):
109112
# uppermost layer in the hydrodynamic data
110113
fieldset.mindepth = fieldset.U.depth[0]
111114
# Define a new Particle type including extra Variables
112-
ArgoParticle = JITParticle.add_variables(
115+
116+
117+
ArgoParticle = self.particle_type.add_variables(
113118
[
114119
Variable("cycle_phase", dtype=np.int32, initial=0.0),
115120
Variable("cycle_age", dtype=np.float32, initial=0.0),
@@ -121,5 +126,9 @@ def setup(self):
121126

122127
def time_run_many_timesteps(self):
123128
self.pset.execute(
124-
[ArgoVerticalMovement, AdvectionRK4], runtime=timedelta(seconds=1 * 30), dt=timedelta(seconds=30)
129+
[ArgoVerticalMovement, AdvectionRK4], runtime=timedelta(days=self.runtime_days), dt=timedelta(seconds=30)
125130
)
131+
132+
# How do we derive benchmarks ?
133+
# class ArgoFloatScipy(ArgoFloatJIT):
134+
# particle_type = ScipyParticle

0 commit comments

Comments
 (0)