macfleet 2.0.0__tar.gz

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.
Files changed (48) hide show
  1. macfleet-2.0.0/LICENSE +21 -0
  2. macfleet-2.0.0/PKG-INFO +175 -0
  3. macfleet-2.0.0/README.md +130 -0
  4. macfleet-2.0.0/macfleet/__init__.py +46 -0
  5. macfleet-2.0.0/macfleet/cli/__init__.py +1 -0
  6. macfleet-2.0.0/macfleet/cli/main.py +486 -0
  7. macfleet-2.0.0/macfleet/comm/__init__.py +1 -0
  8. macfleet-2.0.0/macfleet/comm/collectives.py +343 -0
  9. macfleet-2.0.0/macfleet/comm/protocol.py +289 -0
  10. macfleet-2.0.0/macfleet/comm/transport.py +321 -0
  11. macfleet-2.0.0/macfleet/compression/__init__.py +43 -0
  12. macfleet-2.0.0/macfleet/compression/adaptive.py +394 -0
  13. macfleet-2.0.0/macfleet/compression/pipeline.py +298 -0
  14. macfleet-2.0.0/macfleet/compression/quantize.py +98 -0
  15. macfleet-2.0.0/macfleet/compression/topk.py +119 -0
  16. macfleet-2.0.0/macfleet/engines/__init__.py +33 -0
  17. macfleet-2.0.0/macfleet/engines/base.py +203 -0
  18. macfleet-2.0.0/macfleet/engines/mlx_engine.py +438 -0
  19. macfleet-2.0.0/macfleet/engines/torch_engine.py +244 -0
  20. macfleet-2.0.0/macfleet/monitoring/__init__.py +29 -0
  21. macfleet-2.0.0/macfleet/monitoring/dashboard.py +363 -0
  22. macfleet-2.0.0/macfleet/monitoring/health.py +305 -0
  23. macfleet-2.0.0/macfleet/monitoring/thermal.py +203 -0
  24. macfleet-2.0.0/macfleet/monitoring/throughput.py +218 -0
  25. macfleet-2.0.0/macfleet/pool/__init__.py +1 -0
  26. macfleet-2.0.0/macfleet/pool/agent.py +326 -0
  27. macfleet-2.0.0/macfleet/pool/discovery.py +302 -0
  28. macfleet-2.0.0/macfleet/pool/heartbeat.py +204 -0
  29. macfleet-2.0.0/macfleet/pool/network.py +280 -0
  30. macfleet-2.0.0/macfleet/pool/registry.py +149 -0
  31. macfleet-2.0.0/macfleet/pool/scheduler.py +148 -0
  32. macfleet-2.0.0/macfleet/sdk/__init__.py +22 -0
  33. macfleet-2.0.0/macfleet/sdk/decorators.py +31 -0
  34. macfleet-2.0.0/macfleet/sdk/pool.py +276 -0
  35. macfleet-2.0.0/macfleet/sdk/train.py +43 -0
  36. macfleet-2.0.0/macfleet/training/__init__.py +1 -0
  37. macfleet-2.0.0/macfleet/training/data_parallel.py +216 -0
  38. macfleet-2.0.0/macfleet/training/loop.py +163 -0
  39. macfleet-2.0.0/macfleet/training/sampler.py +183 -0
  40. macfleet-2.0.0/macfleet/utils/__init__.py +1 -0
  41. macfleet-2.0.0/macfleet.egg-info/PKG-INFO +175 -0
  42. macfleet-2.0.0/macfleet.egg-info/SOURCES.txt +46 -0
  43. macfleet-2.0.0/macfleet.egg-info/dependency_links.txt +1 -0
  44. macfleet-2.0.0/macfleet.egg-info/entry_points.txt +2 -0
  45. macfleet-2.0.0/macfleet.egg-info/requires.txt +26 -0
  46. macfleet-2.0.0/macfleet.egg-info/top_level.txt +1 -0
  47. macfleet-2.0.0/pyproject.toml +79 -0
  48. macfleet-2.0.0/setup.cfg +4 -0
macfleet-2.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MacFleet Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.2
2
+ Name: macfleet
3
+ Version: 2.0.0
4
+ Summary: Pool Apple Silicon Macs into a distributed ML training cluster
5
+ Author: MacFleet Contributors
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/vikranthreddimasu/MacFleet
8
+ Project-URL: Documentation, https://github.com/vikranthreddimasu/MacFleet#readme
9
+ Project-URL: Repository, https://github.com/vikranthreddimasu/MacFleet
10
+ Project-URL: Issues, https://github.com/vikranthreddimasu/MacFleet/issues
11
+ Keywords: distributed,machine-learning,apple-silicon,mps,mlx,pytorch,training,gpu-pooling,data-parallel
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
21
+ Requires-Python: >=3.11
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: zeroconf>=0.131.0
25
+ Requires-Dist: rich>=13.0.0
26
+ Requires-Dist: click>=8.1.0
27
+ Requires-Dist: numpy>=1.24.0
28
+ Requires-Dist: msgpack>=1.0.0
29
+ Provides-Extra: torch
30
+ Requires-Dist: torch>=2.1.0; extra == "torch"
31
+ Provides-Extra: mlx
32
+ Requires-Dist: mlx>=0.5.0; extra == "mlx"
33
+ Provides-Extra: yaml
34
+ Requires-Dist: pyyaml>=6.0; extra == "yaml"
35
+ Provides-Extra: all
36
+ Requires-Dist: torch>=2.1.0; extra == "all"
37
+ Requires-Dist: mlx>=0.5.0; extra == "all"
38
+ Requires-Dist: pyyaml>=6.0; extra == "all"
39
+ Provides-Extra: dev
40
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
41
+ Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
42
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
43
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
44
+ Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
45
+
46
+ # MacFleet
47
+
48
+ **Pool Apple Silicon Macs into a distributed ML training cluster.**
49
+
50
+ Zero-config discovery. N-node scaling. WiFi, Ethernet, or Thunderbolt.
51
+
52
+ ```
53
+ macfleet join macfleet join macfleet join
54
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
55
+ │ MacBook Pro │◄────────►│ MacBook Air │◄────────►│ Mac Studio │
56
+ │ M4 Pro │ WiFi / │ M4 │ WiFi / │ M4 Ultra │
57
+ │ 16 GPU cores │ ETH / │ 10 GPU cores │ ETH / │ 60 GPU cores │
58
+ │ 48 GB RAM │ TB4 │ 16 GB RAM │ TB4 │ 192 GB RAM │
59
+ │ weight: 0.35 │ │ weight: 0.15 │ │ weight: 0.50 │
60
+ └──────────────┘ └──────────────┘ └──────────────┘
61
+ ▲ ▲ ▲
62
+ └──────────────────────────┴──────────────────────────┘
63
+ Ring AllReduce (gradient sync)
64
+ ```
65
+
66
+ ## Features
67
+
68
+ - **Zero-Config Pooling**: `pip install macfleet && macfleet join` — auto-discovers peers via mDNS/Bonjour
69
+ - **N-Node Scaling**: Ring AllReduce for 2+ nodes (not limited to pairs)
70
+ - **Any Network**: WiFi, Ethernet, and Thunderbolt with adaptive buffer tuning
71
+ - **Dual Engine**: PyTorch+MPS and Apple MLX — pluggable via Engine protocol
72
+ - **Heterogeneous Scheduling**: Weighted batch allocation based on GPU cores + thermal state
73
+ - **Gossip Heartbeat**: Peer-to-peer failure detection, automatic coordinator election
74
+ - **Adaptive Compression**: Bandwidth-aware TopK+FP16 (auto-selects by link type: WiFi=200x, Ethernet=20x, TB4=off)
75
+ - **Framework-Agnostic Core**: Communication layer uses numpy — never imports torch/mlx
76
+ - **Health Monitoring**: Thermal, memory, battery, loss trend — composite health score per node
77
+ - **Rich TUI Dashboard**: Real-time cluster topology, training progress, and warnings
78
+
79
+ ## Quick Start
80
+
81
+ ```bash
82
+ pip install macfleet
83
+ ```
84
+
85
+ ### Join the pool
86
+
87
+ ```bash
88
+ # On each Mac:
89
+ macfleet join
90
+ ```
91
+
92
+ ### Train a model (Python SDK)
93
+
94
+ ```python
95
+ import macfleet
96
+
97
+ # PyTorch
98
+ with macfleet.Pool() as pool:
99
+ pool.train(
100
+ model=MyModel(),
101
+ dataset=my_dataset,
102
+ epochs=10,
103
+ batch_size=128,
104
+ )
105
+
106
+ # MLX (Apple native)
107
+ with macfleet.Pool(engine="mlx") as pool:
108
+ pool.train(
109
+ model=mlx_model,
110
+ dataset=(X, y),
111
+ epochs=10,
112
+ loss_fn=my_loss_fn,
113
+ )
114
+
115
+ # One-liner
116
+ macfleet.train(model=MyModel(), dataset=ds, epochs=10)
117
+
118
+ # Decorator
119
+ @macfleet.distributed(engine="torch")
120
+ def my_training():
121
+ ...
122
+ ```
123
+
124
+ ### CLI commands
125
+
126
+ ```bash
127
+ macfleet info # Local hardware profile
128
+ macfleet status # Discover pool members on the network
129
+ macfleet diagnose # System health check (MPS, thermal, network)
130
+ macfleet train # Demo training on synthetic data
131
+ macfleet bench # Benchmark compute, network, and allreduce
132
+ ```
133
+
134
+ ## Architecture
135
+
136
+ ```
137
+ ┌─────────────────────────────────────────────────────────────────┐
138
+ │ CLI: macfleet join | status | train | bench | info | diagnose │
139
+ │ SDK: macfleet.Pool() | macfleet.train() │
140
+ ├─────────────────────────────────────────────────────────────────┤
141
+ │ Training: DataParallel | TrainingLoop | WeightedSampler │
142
+ ├─────────────────────────────────────────────────────────────────┤
143
+ │ Engines: TorchEngine (PyTorch+MPS) | MLXEngine (Apple MLX) │
144
+ ├─────────────────────────────────────────────────────────────────┤
145
+ │ Compression: TopK + FP16 + Adaptive pipeline │
146
+ ├─────────────────────────────────────────────────────────────────┤
147
+ │ Pool: Agent | Registry | Discovery | Scheduler | Heartbeat │
148
+ ├─────────────────────────────────────────────────────────────────┤
149
+ │ Communication: PeerTransport | WireProtocol | Collectives │
150
+ ├─────────────────────────────────────────────────────────────────┤
151
+ │ Monitoring: Thermal | Health | Throughput | Dashboard │
152
+ └─────────────────────────────────────────────────────────────────┘
153
+ ```
154
+
155
+ ## Development
156
+
157
+ ```bash
158
+ git clone https://github.com/yourusername/MacFleet.git
159
+ cd MacFleet
160
+ pip install -e ".[dev]"
161
+ make test # 268 tests
162
+ make bench # compute + network + allreduce benchmarks
163
+ make lint # ruff + mypy
164
+ ```
165
+
166
+ ## Requirements
167
+
168
+ - Python 3.11+
169
+ - macOS with Apple Silicon (M1/M2/M3/M4)
170
+ - PyTorch 2.1+ (for torch engine)
171
+ - MLX 0.5+ (optional, for mlx engine)
172
+
173
+ ## License
174
+
175
+ MIT
@@ -0,0 +1,130 @@
1
+ # MacFleet
2
+
3
+ **Pool Apple Silicon Macs into a distributed ML training cluster.**
4
+
5
+ Zero-config discovery. N-node scaling. WiFi, Ethernet, or Thunderbolt.
6
+
7
+ ```
8
+ macfleet join macfleet join macfleet join
9
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
10
+ │ MacBook Pro │◄────────►│ MacBook Air │◄────────►│ Mac Studio │
11
+ │ M4 Pro │ WiFi / │ M4 │ WiFi / │ M4 Ultra │
12
+ │ 16 GPU cores │ ETH / │ 10 GPU cores │ ETH / │ 60 GPU cores │
13
+ │ 48 GB RAM │ TB4 │ 16 GB RAM │ TB4 │ 192 GB RAM │
14
+ │ weight: 0.35 │ │ weight: 0.15 │ │ weight: 0.50 │
15
+ └──────────────┘ └──────────────┘ └──────────────┘
16
+ ▲ ▲ ▲
17
+ └──────────────────────────┴──────────────────────────┘
18
+ Ring AllReduce (gradient sync)
19
+ ```
20
+
21
+ ## Features
22
+
23
+ - **Zero-Config Pooling**: `pip install macfleet && macfleet join` — auto-discovers peers via mDNS/Bonjour
24
+ - **N-Node Scaling**: Ring AllReduce for 2+ nodes (not limited to pairs)
25
+ - **Any Network**: WiFi, Ethernet, and Thunderbolt with adaptive buffer tuning
26
+ - **Dual Engine**: PyTorch+MPS and Apple MLX — pluggable via Engine protocol
27
+ - **Heterogeneous Scheduling**: Weighted batch allocation based on GPU cores + thermal state
28
+ - **Gossip Heartbeat**: Peer-to-peer failure detection, automatic coordinator election
29
+ - **Adaptive Compression**: Bandwidth-aware TopK+FP16 (auto-selects by link type: WiFi=200x, Ethernet=20x, TB4=off)
30
+ - **Framework-Agnostic Core**: Communication layer uses numpy — never imports torch/mlx
31
+ - **Health Monitoring**: Thermal, memory, battery, loss trend — composite health score per node
32
+ - **Rich TUI Dashboard**: Real-time cluster topology, training progress, and warnings
33
+
34
+ ## Quick Start
35
+
36
+ ```bash
37
+ pip install macfleet
38
+ ```
39
+
40
+ ### Join the pool
41
+
42
+ ```bash
43
+ # On each Mac:
44
+ macfleet join
45
+ ```
46
+
47
+ ### Train a model (Python SDK)
48
+
49
+ ```python
50
+ import macfleet
51
+
52
+ # PyTorch
53
+ with macfleet.Pool() as pool:
54
+ pool.train(
55
+ model=MyModel(),
56
+ dataset=my_dataset,
57
+ epochs=10,
58
+ batch_size=128,
59
+ )
60
+
61
+ # MLX (Apple native)
62
+ with macfleet.Pool(engine="mlx") as pool:
63
+ pool.train(
64
+ model=mlx_model,
65
+ dataset=(X, y),
66
+ epochs=10,
67
+ loss_fn=my_loss_fn,
68
+ )
69
+
70
+ # One-liner
71
+ macfleet.train(model=MyModel(), dataset=ds, epochs=10)
72
+
73
+ # Decorator
74
+ @macfleet.distributed(engine="torch")
75
+ def my_training():
76
+ ...
77
+ ```
78
+
79
+ ### CLI commands
80
+
81
+ ```bash
82
+ macfleet info # Local hardware profile
83
+ macfleet status # Discover pool members on the network
84
+ macfleet diagnose # System health check (MPS, thermal, network)
85
+ macfleet train # Demo training on synthetic data
86
+ macfleet bench # Benchmark compute, network, and allreduce
87
+ ```
88
+
89
+ ## Architecture
90
+
91
+ ```
92
+ ┌─────────────────────────────────────────────────────────────────┐
93
+ │ CLI: macfleet join | status | train | bench | info | diagnose │
94
+ │ SDK: macfleet.Pool() | macfleet.train() │
95
+ ├─────────────────────────────────────────────────────────────────┤
96
+ │ Training: DataParallel | TrainingLoop | WeightedSampler │
97
+ ├─────────────────────────────────────────────────────────────────┤
98
+ │ Engines: TorchEngine (PyTorch+MPS) | MLXEngine (Apple MLX) │
99
+ ├─────────────────────────────────────────────────────────────────┤
100
+ │ Compression: TopK + FP16 + Adaptive pipeline │
101
+ ├─────────────────────────────────────────────────────────────────┤
102
+ │ Pool: Agent | Registry | Discovery | Scheduler | Heartbeat │
103
+ ├─────────────────────────────────────────────────────────────────┤
104
+ │ Communication: PeerTransport | WireProtocol | Collectives │
105
+ ├─────────────────────────────────────────────────────────────────┤
106
+ │ Monitoring: Thermal | Health | Throughput | Dashboard │
107
+ └─────────────────────────────────────────────────────────────────┘
108
+ ```
109
+
110
+ ## Development
111
+
112
+ ```bash
113
+ git clone https://github.com/yourusername/MacFleet.git
114
+ cd MacFleet
115
+ pip install -e ".[dev]"
116
+ make test # 268 tests
117
+ make bench # compute + network + allreduce benchmarks
118
+ make lint # ruff + mypy
119
+ ```
120
+
121
+ ## Requirements
122
+
123
+ - Python 3.11+
124
+ - macOS with Apple Silicon (M1/M2/M3/M4)
125
+ - PyTorch 2.1+ (for torch engine)
126
+ - MLX 0.5+ (optional, for mlx engine)
127
+
128
+ ## License
129
+
130
+ MIT
@@ -0,0 +1,46 @@
1
+ """MacFleet v2: Pool Apple Silicon Macs into a distributed ML training cluster.
2
+
3
+ Zero-config discovery. Framework-agnostic engines. Adaptive networking.
4
+
5
+ pip install macfleet && macfleet join
6
+ """
7
+
8
+ import logging
9
+
10
+ __version__ = "2.0.0"
11
+
12
+ logging.getLogger(__name__).addHandler(logging.NullHandler())
13
+
14
+
15
+ def __getattr__(name: str):
16
+ """Lazy imports for heavy modules (avoid importing torch/mlx at module load)."""
17
+ if name == "Pool":
18
+ from macfleet.sdk.pool import Pool
19
+ return Pool
20
+ if name == "train":
21
+ from macfleet.sdk.train import train
22
+ return train
23
+ if name == "distributed":
24
+ from macfleet.sdk.decorators import distributed
25
+ return distributed
26
+ if name == "DataParallel":
27
+ from macfleet.training.data_parallel import DataParallel
28
+ return DataParallel
29
+ if name == "TorchEngine":
30
+ from macfleet.engines.torch_engine import TorchEngine
31
+ return TorchEngine
32
+ if name == "MLXEngine":
33
+ from macfleet.engines.mlx_engine import MLXEngine
34
+ return MLXEngine
35
+ raise AttributeError(f"module 'macfleet' has no attribute {name!r}")
36
+
37
+
38
+ __all__ = [
39
+ "__version__",
40
+ "Pool",
41
+ "train",
42
+ "distributed",
43
+ "DataParallel",
44
+ "TorchEngine",
45
+ "MLXEngine",
46
+ ]
@@ -0,0 +1 @@
1
+ """CLI interface for MacFleet."""