Skip to content

[monarch] monarch.actor submodule #437

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monarch_extension/src/mesh_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ impl History {
.getattr("RemoteException")
.unwrap();
let pickle = py
.import("monarch.actor_mesh")
.import("monarch._src.actor.actor_mesh")
.unwrap()
.getattr("_pickle")
.unwrap();
Expand Down
2 changes: 1 addition & 1 deletion monarch_tensor_worker/src/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -990,7 +990,7 @@ impl StreamActor {
})
.and_then(|result| -> Result<PythonMessage, WorkerError> {
let pickle = py
.import("monarch.actor_mesh")
.import("monarch._src.actor.actor_mesh")
.unwrap()
.getattr("_pickle")
.unwrap();
Expand Down
15 changes: 6 additions & 9 deletions python/monarch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@

if TYPE_CHECKING:
from monarch import timer
from monarch.allocator import LocalAllocator, ProcessAllocator
from monarch._src.actor.allocator import LocalAllocator, ProcessAllocator
from monarch._src.actor.shape import NDSlice, Shape
from monarch.common._coalescing import coalescing

from monarch.common.device_mesh import (
Expand All @@ -50,11 +51,9 @@
from monarch.common.pipe import create_pipe, Pipe, remote_generator
from monarch.common.remote import remote
from monarch.common.selection import Selection
from monarch.common.shape import NDSlice, Shape
from monarch.common.stream import get_active_stream, Stream
from monarch.common.tensor import reduce, reduce_, Tensor
from monarch.fetch import fetch_shard, inspect, show
from monarch.future import ActorFuture
from monarch.gradient_generator import grad_function, grad_generator
from monarch.notebook import mast_mesh, reserve_torchx as mast_reserve
from monarch.python_local_mesh import python_local_mesh
Expand All @@ -79,8 +78,8 @@
"function_resolvers": ("monarch.common.function", "resolvers"),
"Future": ("monarch.common.future", "Future"),
"RemoteException": ("monarch.common.invocation", "RemoteException"),
"Shape": ("monarch.common.shape", "Shape"),
"NDSlice": ("monarch.common.shape", "NDSlice"),
"Shape": ("monarch._src.actor.shape", "Shape"),
"NDSlice": ("monarch._src.actor.shape", "NDSlice"),
"Selection": ("monarch.common.selection", "Selection"),
"OpaqueRef": ("monarch.common.opaque_ref", "OpaqueRef"),
"create_pipe": ("monarch.common.pipe", "create_pipe"),
Expand Down Expand Up @@ -112,9 +111,8 @@
"Simulator": ("monarch.simulator.interface", "Simulator"),
"world_mesh": ("monarch.world_mesh", "world_mesh"),
"timer": ("monarch.timer", "timer"),
"ProcessAllocator": ("monarch.allocator", "ProcessAllocator"),
"LocalAllocator": ("monarch.allocator", "LocalAllocator"),
"ActorFuture": ("monarch.future", "ActorFuture"),
"ProcessAllocator": ("monarch._src.actor.allocator", "ProcessAllocator"),
"LocalAllocator": ("monarch._src.actor.allocator", "LocalAllocator"),
"builtins": ("monarch.builtins", "builtins"),
}

Expand Down Expand Up @@ -183,7 +181,6 @@ def __getattr__(name):
"timer",
"ProcessAllocator",
"LocalAllocator",
"ActorFuture",
"builtins",
]
assert sorted(__all__) == sorted(_public_api)
8 changes: 8 additions & 0 deletions python/monarch/_rust_bindings/__init__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

# True iff the rust extension was built with the tensor engine feature.
def has_tensor_engine() -> bool: ...
2 changes: 1 addition & 1 deletion python/monarch/_rust_bindings/monarch_hyperactor/alloc.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class RemoteAllocatorBase:
def __new__(
cls,
world_id: str,
initializer: "monarch.allocator.RemoteAllocInitializer", # pyre-ignore[11] defined in monarch/python/monarch/allocator.py
initializer: "monarch._src.actor.allocator.RemoteAllocInitializer", # pyre-ignore[11]
heartbeat_interval: timedelta = timedelta(seconds=5),
) -> Self:
"""
Expand Down
Empty file added python/monarch/_src/__init__.py
Empty file.
9 changes: 9 additions & 0 deletions python/monarch/_src/actor/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

"""
Monarch Actor API
"""
Loading
Loading