Skip to content

Commit 8e0a135

Browse files
committed
[hyperactor] mesh: v0 shims for v1 meshes
Pull Request resolved: #1453 In this change, we implement: ``` From<v1::ProcMeshRef> for ProcMesh ``` and ``` From<v1::ActorMeshRef<A>> for RootActorMesh<A> ``` This will allow us to temporarily use v1 instances through a v0 API, while we transition the usage sites. ghstack-source-id: 314913615 Differential Revision: [D84081478](https://our.internmc.facebook.com/intern/diff/D84081478/)
1 parent 6ca383a commit 8e0a135

File tree

26 files changed

+719
-237
lines changed

26 files changed

+719
-237
lines changed

hyperactor_mesh/benches/main.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use criterion::Criterion;
1313
use criterion::Throughput;
1414
use criterion::criterion_group;
1515
use criterion::criterion_main;
16+
use hyperactor::Proc;
1617
use hyperactor::channel::ChannelTransport;
1718
use hyperactor_mesh::ProcMesh;
1819
use hyperactor_mesh::actor_mesh::ActorMesh;
@@ -51,9 +52,10 @@ fn bench_actor_scaling(c: &mut Criterion) {
5152
.await
5253
.unwrap();
5354

55+
let (bootstrap_instance, _) = Proc::local().instance("bench").unwrap();
5456
let mut proc_mesh = ProcMesh::allocate(alloc).await.unwrap();
5557
let actor_mesh: RootActorMesh<BenchActor> = proc_mesh
56-
.spawn("bench", &(Duration::from_millis(0)))
58+
.spawn(&bootstrap_instance, "bench", &(Duration::from_millis(0)))
5759
.await
5860
.unwrap();
5961
let client = proc_mesh.client();
@@ -149,9 +151,10 @@ fn bench_actor_mesh_message_sizes(c: &mut Criterion) {
149151
.await
150152
.unwrap();
151153

154+
let (bootstrap_instance, _) = Proc::local().instance("bench").unwrap();
152155
let mut proc_mesh = ProcMesh::allocate(alloc).await.unwrap();
153156
let actor_mesh: RootActorMesh<BenchActor> = proc_mesh
154-
.spawn("bench", &(Duration::from_millis(0)))
157+
.spawn(&bootstrap_instance, "bench", &(Duration::from_millis(0)))
155158
.await
156159
.unwrap();
157160

hyperactor_mesh/examples/dining_philosophers.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use hyperactor::Handler;
2020
use hyperactor::Instance;
2121
use hyperactor::Named;
2222
use hyperactor::PortRef;
23+
use hyperactor::Proc;
2324
use hyperactor::Unbind;
2425
use hyperactor::channel::ChannelTransport;
2526
use hyperactor_mesh::ProcMesh;
@@ -237,10 +238,12 @@ async fn main() -> Result<ExitCode> {
237238
})
238239
.await?;
239240

241+
let (instance, _) = Proc::local().instance("client").unwrap();
242+
240243
let proc_mesh = ProcMesh::allocate(alloc).await?;
241244
let params = PhilosopherActorParams { size: group_size };
242245
let actor_mesh = proc_mesh
243-
.spawn::<PhilosopherActor>("philosopher", &params)
246+
.spawn::<PhilosopherActor>(&instance, "philosopher", &params)
244247
.await?;
245248
let (dining_message_handle, mut dining_message_rx) = proc_mesh.client().open_port();
246249
actor_mesh

0 commit comments

Comments
 (0)