Skip to content

Commit 7ebbbf6

Browse files
amacatiratheron
andauthored
Apply suggestions from code review
Co-authored-by: Marcel Rath <75042654+ratheron@users.noreply.github.com>
1 parent f49ca01 commit 7ebbbf6

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎crazyflow/sim/sharding.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def shard(data: SimData, mesh: Mesh) -> SimData:
7373
return jax.device_put(data, placement(data, mesh))
7474

7575

76-
def build_sharded(
76+
def build_sharded_data(
7777
create: Callable[[int | Array], SimData], rng_key: int | Array, mesh: Mesh
7878
) -> SimData:
7979
"""Build simulation data distributed over a mesh.

‎crazyflow/sim/sim.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from crazyflow.sim.data import SimControls, SimCore, SimData, SimParams, SimState, SimStateDeriv
3636
from crazyflow.sim.integration import Integrator, euler, rk4, symplectic_euler
3737
from crazyflow.sim.pipeline import append_fn
38-
from crazyflow.sim.sharding import build_sharded, placement
38+
from crazyflow.sim.sharding import build_sharded_data, placement
3939
from crazyflow.utils import grid_2d, pytree_replace, world_mask
4040

4141
if TYPE_CHECKING:
@@ -143,7 +143,7 @@ def __init__(
143143
if mesh is None:
144144
self.data = self.init_data(*freqs, rng_key)
145145
else:
146-
self.data = build_sharded(partial(self.init_data, *freqs), rng_key, mesh)
146+
self.data = build_sharded_data(partial(self.init_data, *freqs), rng_key, mesh)
147147
self.default_data: SimData = self.build_default_data()
148148

149149
# Build the simulation pipeline and overwrite the default _step implementation with it
@@ -454,7 +454,7 @@ def build_data(self) -> SimData:
454454
if self.mesh is None:
455455
self.data = self.init_data(*freqs, rng_key)
456456
else:
457-
self.data = build_sharded(partial(self.init_data, *freqs), rng_key, self.mesh)
457+
self.data = build_sharded_data(partial(self.init_data, *freqs), rng_key, self.mesh)
458458
return self.data
459459

460460
def shard(self, mesh: Mesh) -> SimData:

0 commit comments

Comments
 (0)