torchmonarch-nightly 2025.7.28__cp311-cp311-manylinux2014_x86_64.whl → 2025.7.29__cp311-cp311-manylinux2014_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
monarch/_rust_bindings.so CHANGED
Binary file
@@ -8,7 +8,7 @@
8
8
 
9
9
  import abc
10
10
  import logging
11
- from typing import final, Optional
11
+ from typing import Awaitable, final, Optional, TYPE_CHECKING
12
12
 
13
13
  from monarch._rust_bindings.monarch_hyperactor.alloc import ( # @manual=//monarch/monarch_extension:monarch_extension
14
14
  Alloc,
@@ -19,6 +19,9 @@ from monarch._rust_bindings.monarch_hyperactor.alloc import ( # @manual=//monar
19
19
  SimAllocatorBase,
20
20
  )
21
21
 
22
+ if TYPE_CHECKING:
23
+ from monarch._rust_bindings.monarch_hyperactor.tokio import PythonTask
24
+
22
25
  from monarch._src.actor.future import Future
23
26
 
24
27
  ALLOC_LABEL_PROC_MESH_NAME = "procmesh.monarch.meta.com/name"
@@ -26,11 +29,9 @@ ALLOC_LABEL_PROC_MESH_NAME = "procmesh.monarch.meta.com/name"
26
29
  logger: logging.Logger = logging.getLogger(__name__)
27
30
 
28
31
 
29
- @final
30
- class ProcessAllocator(ProcessAllocatorBase):
31
- """
32
- An allocator that allocates by spawning local processes.
33
- """
32
+ class AllocateMixin(abc.ABC):
33
+ @abc.abstractmethod
34
+ def allocate_nonblocking(self, spec: AllocSpec) -> "Awaitable[Alloc]": ...
34
35
 
35
36
  def allocate(self, spec: AllocSpec) -> Future[Alloc]:
36
37
  """
@@ -46,42 +47,25 @@ class ProcessAllocator(ProcessAllocatorBase):
46
47
 
47
48
 
48
49
  @final
49
- class LocalAllocator(LocalAllocatorBase):
50
+ class ProcessAllocator(ProcessAllocatorBase, AllocateMixin):
50
51
  """
51
- An allocator that allocates by spawning actors into the current process.
52
+ An allocator that allocates by spawning local processes.
52
53
  """
53
54
 
54
- def allocate(self, spec: AllocSpec) -> Future[Alloc]:
55
- """
56
- Allocate a process according to the provided spec.
57
55
 
58
- Arguments:
59
- - `spec`: The spec to allocate according to.
60
-
61
- Returns:
62
- - A future that will be fulfilled when the requested allocation is fulfilled.
63
- """
64
- return Future(impl=lambda: self.allocate_nonblocking(spec), requires_loop=False)
56
+ @final
57
+ class LocalAllocator(LocalAllocatorBase, AllocateMixin):
58
+ """
59
+ An allocator that allocates by spawning actors into the current process.
60
+ """
65
61
 
66
62
 
67
63
  @final
68
- class SimAllocator(SimAllocatorBase):
64
+ class SimAllocator(SimAllocatorBase, AllocateMixin):
69
65
  """
70
66
  An allocator that allocates by spawning actors into the current process using simulated channels for transport
71
67
  """
72
68
 
73
- def allocate(self, spec: AllocSpec) -> Future[Alloc]:
74
- """
75
- Allocate a process according to the provided spec.
76
-
77
- Arguments:
78
- - `spec`: The spec to allocate according to.
79
-
80
- Returns:
81
- - A future that will be fulfilled when the requested allocation is fulfilled.
82
- """
83
- return Future(impl=lambda: self.allocate_nonblocking(spec), requires_loop=False)
84
-
85
69
 
86
70
  class RemoteAllocInitializer(abc.ABC):
87
71
  """Subclass-able Python interface for `hyperactor_mesh::alloc::remoteprocess:RemoteProcessAllocInitializer`.
@@ -210,20 +194,8 @@ class TorchXRemoteAllocInitializer(RemoteAllocInitializer):
210
194
 
211
195
 
212
196
  @final
213
- class RemoteAllocator(RemoteAllocatorBase):
197
+ class RemoteAllocator(RemoteAllocatorBase, AllocateMixin):
214
198
  """
215
199
  An allocator that allocates by spawning actors on a remote host.
216
200
  The remote host must be running hyperactor's remote-process-allocator.
217
201
  """
218
-
219
- def allocate(self, spec: AllocSpec) -> Future[Alloc]:
220
- """
221
- Allocate a process according to the provided spec.
222
-
223
- Arguments:
224
- - `spec`: The spec to allocate according to.
225
-
226
- Returns:
227
- - A future that will be fulfilled when the requested allocation is fulfilled.
228
- """
229
- return Future(impl=lambda: self.allocate_nonblocking(spec), requires_loop=False)
@@ -67,7 +67,12 @@ class MeshTrait(ABC):
67
67
  start, stop, slice_stride = e.indices(size)
68
68
  offset += start * stride
69
69
  names.append(name)
70
- sizes.append((stop - start) // slice_stride)
70
+ # The number of elems in `start..stop` with step
71
+ # `slice_stride`. This is:
72
+ # ⌈(stop - start) /slice_stride⌉
73
+ # — the number of stride steps that fit in the
74
+ # half-open interval.
75
+ sizes.append((stop - start + slice_stride - 1) // slice_stride)
71
76
  strides.append(slice_stride * stride)
72
77
  else:
73
78
  if e >= size or e < 0:
Binary file
@@ -22,7 +22,7 @@ DEFAULT_NAME: str = f"monarch-{_USER}"
22
22
  __version__ = "latest" # TODO get version from monarch.__version_
23
23
 
24
24
 
25
- def proc_mesh(
25
+ def host_mesh(
26
26
  image: str = f"ghcr.io/pytorch-labs/monarch:{__version__}", # TODO docker needs to be built and pushed to ghcr
27
27
  meshes: list[str] = _DEFAULT_MESHES,
28
28
  env: Optional[dict[str, str]] = None,
@@ -34,4 +34,4 @@ class Config:
34
34
  scheduler_args: dict[str, Any] = field(default_factory=dict)
35
35
  workspace: Optional[str] = None
36
36
  dryrun: bool = False
37
- appdef: UnnamedAppDef = UnnamedAppDef()
37
+ appdef: UnnamedAppDef = field(default_factory=UnnamedAppDef)
@@ -25,7 +25,7 @@ from torchx.schedulers import (
25
25
 
26
26
  def component_fn(scheduler: str) -> Callable[..., UnnamedAppDef]:
27
27
  """The default TorchX component function for the scheduler"""
28
- return hyperactor.proc_mesh
28
+ return hyperactor.host_mesh
29
29
 
30
30
 
31
31
  def scheduler_factories() -> dict[str, SchedulerFactory]:
monarch/tools/utils.py CHANGED
@@ -6,9 +6,36 @@
6
6
 
7
7
  # pyre-strict
8
8
  import os
9
+ import pathlib
9
10
  from typing import Optional
10
11
 
11
12
 
13
+ def MONARCH_HOME(*subdir_paths: str) -> pathlib.Path:
14
+ """
15
+ Path to the "dot-directory" for monarch.
16
+ Defaults to `~/.monarch` and is overridable via the `MONARCH_HOME` environment variable.
17
+
18
+ Usage:
19
+
20
+ .. doc-test::
21
+
22
+ from pathlib import Path
23
+ from monarch.tools.utils import MONARCH_HOME
24
+
25
+ assert MONARCH_HOME() == Path.home() / ".monarch"
26
+ assert MONARCH_HOME("conda-pack-out") == Path.home() / ".monarch" / "conda-pack-out"
27
+ ```
28
+ """
29
+
30
+ default_dir = str(pathlib.Path.home() / ".monarch")
31
+ monarch_home = pathlib.Path(os.getenv("MONARCH_HOME", default_dir))
32
+
33
+ monarch_home_subdir = monarch_home / os.path.sep.join(subdir_paths)
34
+ monarch_home_subdir.mkdir(parents=True, exist_ok=True)
35
+
36
+ return monarch_home_subdir
37
+
38
+
12
39
  class conda:
13
40
  """Conda related util functions."""
14
41
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: torchmonarch-nightly
3
- Version: 2025.7.28
3
+ Version: 2025.7.29
4
4
  Summary: Monarch: Single controller library
5
5
  Author: Meta
6
6
  Author-email: oncall+monarch@xmail.facebook.com
@@ -1,5 +1,5 @@
1
1
  monarch/__init__.py,sha256=mgKiyD1kxky-1pvhMlNfF4VmxWnhi-FSYZNFzkW1BEM,7052
2
- monarch/_rust_bindings.so,sha256=crjfqvnpPBQUV-9OeCrlZ0WBq8xEcJyX8mvK1yWsp-8,50483080
2
+ monarch/_rust_bindings.so,sha256=ScSFD_QzNVyFbKzJ7o315q8R71cj-LtiHXB2PEqwYFM,50485024
3
3
  monarch/_testing.py,sha256=_3MYNMq-_0T1qXCj2vxrW13GlWGdUuVFMskQF2Gsw_o,7877
4
4
  monarch/actor_mesh.py,sha256=VtPU9syi_vUdwDSJJ639Z4Y_EcWZUScyoj0lQ88RQPs,421
5
5
  monarch/bootstrap_main.py,sha256=39OZpNMrfvvNJf-iwuNzgslzYA_ItaRPHfXGn_V74N0,524
@@ -8,7 +8,7 @@ monarch/fetch.py,sha256=JMxC8HdWMvpik0T4E6e-gfxvmNnOkA0ul4eo4R3Jg_o,1712
8
8
  monarch/gradient_generator.py,sha256=Rl3dmXGceTdCc1mYBg2JciR88ywGPnW7TVkL86KwqEA,6366
9
9
  monarch/memory.py,sha256=ol86dBhFAJqg78iF25-BuK0wuwj1onR8FIioZ_B0gjw,1377
10
10
  monarch/mesh_controller.py,sha256=mOk2misobJun2AgR_ALjFoopAEcOPYQVrrAJXa18ZTs,13810
11
- monarch/monarch_controller,sha256=untvTxNKGEpzfX3Eh2InHETFphEaRgzxwWPwHWdroOg,24053432
11
+ monarch/monarch_controller,sha256=Sgt5YAW4P6-y8UOTShKyGvpMlUu2EBKif6lfAJE6k3s,24055184
12
12
  monarch/notebook.py,sha256=zu9MKDFKf1-rCM2TqFSRJjMBeiWuKcJSyUFLvoZRQzs,25949
13
13
  monarch/opaque_module.py,sha256=jCcg0DjbcEVXA9WNG0NhUzGteLHOJLTZEBvrIYJIAns,10436
14
14
  monarch/opaque_object.py,sha256=x1LoX6RIMGh4ux52xIfhPgoh6PhZHdkf9bMccHW3DW0,2808
@@ -26,7 +26,7 @@ monarch/world_mesh.py,sha256=ob5dJWaC49Uw0xqClHBm8CQLvL4xKnjd4TGzk7k8NxI,980
26
26
  monarch/_src/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
27
  monarch/_src/actor/__init__.py,sha256=4iK3nzQZmEPe0HGNY70fABBenw3lCVVaaF0xddF5Fa0,235
28
28
  monarch/_src/actor/actor_mesh.py,sha256=wmFUf3NJcHmJeK7WrLkGOrzmAvdHmjLUaeQ5W6WDLk0,30867
29
- monarch/_src/actor/allocator.py,sha256=WpHEK1SvjgF3GdIWIYUkonXli2-gQVKJVZPInl2RFQo,8212
29
+ monarch/_src/actor/allocator.py,sha256=KUmZYJdNK_k0R_59cXf1EntmD2K5fbptWXBA3-4Txvw,7303
30
30
  monarch/_src/actor/bootstrap_main.py,sha256=e5eU3GvX60MWWmCty7VcZrAmukD29iJdWBysNgQ2o3A,2342
31
31
  monarch/_src/actor/debugger.py,sha256=t2iAAxz03b2KZ89T3VjRc__7GzSf83R8gM81SDyX3-o,19532
32
32
  monarch/_src/actor/device_utils.py,sha256=gBpl23wMjppVAEzzj8U9HyX-B7Bs2_3ftiMAkzUS4j4,577
@@ -36,7 +36,7 @@ monarch/_src/actor/future.py,sha256=jOGh1wfwKyGJxhl9t1P8eapXYywf8KwQldZCCbupmb8,
36
36
  monarch/_src/actor/pdb_wrapper.py,sha256=-QxRktntdEO2LdHixBGKLboYtADyh8bEIAoa3gFwIEo,4161
37
37
  monarch/_src/actor/pickle.py,sha256=jD_3E07OJmMIlcMOOrNFnIuRKZU2F_Q_BP-njDFXUNM,2044
38
38
  monarch/_src/actor/proc_mesh.py,sha256=amF4fbO-33qHFudlS9WabYXIVh0Y_D_0nhCTxvOhpGg,16640
39
- monarch/_src/actor/shape.py,sha256=B-7DI768ZhT8ECUNCJcI7DfCB7iDFGFH0r-HmXaAfcM,8296
39
+ monarch/_src/actor/shape.py,sha256=_vbZW36KO4MN3MDBp2B7B1RkYQXRylj7HHoYS4SJx50,8602
40
40
  monarch/_src/actor/sync_state.py,sha256=GB6bTAGztkcN8fZ9K7zXklOzjYzv6cvkJeBje20xFkE,471
41
41
  monarch/_src/actor/tensor_engine_shim.py,sha256=hupavQ2rjPwECaTlDAhY-eeiEY18Wyyx59MZHcSEcYM,1622
42
42
  monarch/_src/actor/code_sync/__init__.py,sha256=qzWoFNJEJvEbqab0QuHbkvhdz6FHi7BOTw6-2B3p0A4,378
@@ -119,11 +119,11 @@ monarch/tools/cli.py,sha256=b3mKZnK-MwP7JwskTxHI0KcJXxSU6498jEb2ntVr_VM,5001
119
119
  monarch/tools/commands.py,sha256=3xuvHcMwl0t6cWTVUxI_r8EqrJZnay0bkKxOijhlKrw,12126
120
120
  monarch/tools/mesh_spec.py,sha256=in6txNRmA-UvveVSMHCjX6mGpofd3K8vl2Plz1eD6rg,7935
121
121
  monarch/tools/network.py,sha256=mN8Fx9mervxM3VdFHRn4ZXt4z7yWxZp52BTxx2tfpus,2455
122
- monarch/tools/utils.py,sha256=2GGUQQE0dLtzoKy40_tAsOfbSxE6krnL0WvwMgUBgmw,1213
122
+ monarch/tools/utils.py,sha256=p9zunV_OP_eYC2GQFZ_NKFj5Xl1tf7Tin1ZxjZqp3TY,2010
123
123
  monarch/tools/components/__init__.py,sha256=J8qjUOysmcMAek2KFN13mViOXZxTYc5vCrF02t3VuFU,223
124
- monarch/tools/components/hyperactor.py,sha256=gYZS8AcmoTuq48mRrZWWnyxQqaiwTNHv8YqHhHi799U,2169
125
- monarch/tools/config/__init__.py,sha256=MLa6uvVJssN_zTciCvCMeCURWglchCuqE3zdqA-gh4U,869
126
- monarch/tools/config/defaults.py,sha256=ZymyKr9fNnBIgsV-xz-KrtrXRLkJo3hymTqxjXXnBzs,1910
124
+ monarch/tools/components/hyperactor.py,sha256=jbfC5J9oRzzMQFO2eIx9acRS8RPHp3GtKyJjYblcJFM,2169
125
+ monarch/tools/config/__init__.py,sha256=HZjmRSC_R28WMDSvNAqNRlqhH7lMHFWPIrztcFFt8Us,890
126
+ monarch/tools/config/defaults.py,sha256=7YxdL8JHdjzlI2hTCgyYVgIbViJW8gfwlpcXvgfaKh0,1910
127
127
  monarch/worker/__init__.py,sha256=J8qjUOysmcMAek2KFN13mViOXZxTYc5vCrF02t3VuFU,223
128
128
  monarch/worker/_testing_function.py,sha256=A81cVMKgdlO66XvoYcBCDrxIQIm3o3GgvcH_c8M9OmI,13480
129
129
  monarch/worker/compiled_block.py,sha256=hYx1F6PAu0_BnpKAprP_nV9qJtk5XWO7mcwH3JPDioU,10114
@@ -169,9 +169,9 @@ tests/simulator/test_profiling.py,sha256=TGYCfzTLdkpIwnOuO6KApprmrgPIRQe60KRX3wk
169
169
  tests/simulator/test_simulator.py,sha256=LO8lA0ssY-OGEBL5ipEu74f97Y765TEwfUOv-DtIptM,14568
170
170
  tests/simulator/test_task.py,sha256=ipqBDuDAysuo1xOB9S5psaFvwe6VATD43IovCTSs0t4,2327
171
171
  tests/simulator/test_worker.py,sha256=QrWWIJ3HDgDLkBPRc2mwYPlOQoXQcj1qRfc0WUfKkFY,3507
172
- torchmonarch_nightly-2025.7.28.dist-info/licenses/LICENSE,sha256=e0Eotbf_rHOYPuEUlppIbvwy4SN98CZnl_hqwvbDA4Q,1530
173
- torchmonarch_nightly-2025.7.28.dist-info/METADATA,sha256=empMLiZrrLDR6taSJTViJ0CSOI3B1Jc6kI3H6wDNd8w,3852
174
- torchmonarch_nightly-2025.7.28.dist-info/WHEEL,sha256=JC9FVdjbTDi9l3EyrqUd11CgmN9LkBi1g5dFHayafwA,104
175
- torchmonarch_nightly-2025.7.28.dist-info/entry_points.txt,sha256=60QVSpYVzkzS4iDOiLp0fsLxVp47X3J2l3v7W-59LMo,117
176
- torchmonarch_nightly-2025.7.28.dist-info/top_level.txt,sha256=E-ZssZzyM17glpVrh-S9--qJ-w9p2EjuYOuNw9tQ4Eg,33
177
- torchmonarch_nightly-2025.7.28.dist-info/RECORD,,
172
+ torchmonarch_nightly-2025.7.29.dist-info/licenses/LICENSE,sha256=e0Eotbf_rHOYPuEUlppIbvwy4SN98CZnl_hqwvbDA4Q,1530
173
+ torchmonarch_nightly-2025.7.29.dist-info/METADATA,sha256=MZ_yZwBZESYMwztGOrfuxFXmKgiojuezNPNHptuMcPc,3852
174
+ torchmonarch_nightly-2025.7.29.dist-info/WHEEL,sha256=JC9FVdjbTDi9l3EyrqUd11CgmN9LkBi1g5dFHayafwA,104
175
+ torchmonarch_nightly-2025.7.29.dist-info/entry_points.txt,sha256=60QVSpYVzkzS4iDOiLp0fsLxVp47X3J2l3v7W-59LMo,117
176
+ torchmonarch_nightly-2025.7.29.dist-info/top_level.txt,sha256=E-ZssZzyM17glpVrh-S9--qJ-w9p2EjuYOuNw9tQ4Eg,33
177
+ torchmonarch_nightly-2025.7.29.dist-info/RECORD,,