ladon-ml 0.1.0a1__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.
- ladon_ml-0.1.0a1/LICENSE +201 -0
- ladon_ml-0.1.0a1/PKG-INFO +109 -0
- ladon_ml-0.1.0a1/README.md +86 -0
- ladon_ml-0.1.0a1/ladon/__init__.py +1 -0
- ladon_ml-0.1.0a1/ladon/brain.py +0 -0
- ladon_ml-0.1.0a1/ladon/cli.py +21 -0
- ladon_ml-0.1.0a1/ladon/collector/__init__.py +0 -0
- ladon_ml-0.1.0a1/ladon/collector/base.py +16 -0
- ladon_ml-0.1.0a1/ladon/collector/neuron.py +15 -0
- ladon_ml-0.1.0a1/ladon/collector/nvidia.py +37 -0
- ladon_ml-0.1.0a1/ladon/reaper/__init__.py +0 -0
- ladon_ml-0.1.0a1/ladon/reaper/local.py +0 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/PKG-INFO +109 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/SOURCES.txt +22 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/dependency_links.txt +1 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/entry_points.txt +2 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/requires.txt +7 -0
- ladon_ml-0.1.0a1/ladon_ml.egg-info/top_level.txt +1 -0
- ladon_ml-0.1.0a1/pyproject.toml +38 -0
- ladon_ml-0.1.0a1/setup.cfg +4 -0
- ladon_ml-0.1.0a1/tests/test_cli.py +14 -0
- ladon_ml-0.1.0a1/tests/test_collector_base.py +23 -0
- ladon_ml-0.1.0a1/tests/test_collector_neuron.py +9 -0
- ladon_ml-0.1.0a1/tests/test_collector_nvidia.py +10 -0
ladon_ml-0.1.0a1/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ladon-ml
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Guardian of Distributed Compute: Zombie utilization detection for ML infra.
|
|
5
|
+
Author-email: Saptarshi Bhattacharjee <bsaptarshi52@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/bsaptarshi/ladon-ml
|
|
8
|
+
Keywords: ml,gpu,observability,infrastructure
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: System :: Monitoring
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: pyyaml>=6.0
|
|
18
|
+
Requires-Dist: nvidia-ml-py>=12.535.133
|
|
19
|
+
Requires-Dist: prometheus_client
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Ladon-ML 🐉
|
|
25
|
+
|
|
26
|
+
[](https://github.com/bsaptarshi/ladon-ml/actions/workflows/ci.yml)
|
|
27
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
28
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
|
|
31
|
+
**The Hundred-Headed Guardian of Distributed Compute.**
|
|
32
|
+
|
|
33
|
+
`ladon-ml` is a lightweight, infrastructure-level Python library designed to identify and reclaim **Zombie Utilization** in high-performance ML clusters. It is purpose-built for teams managing large-scale accelerator fleets (GPUs or specialized silicon like Trainium) where stalled kernels and silent hangs can lead to massive resource waste.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## The Problem: Zombie Utilization
|
|
38
|
+
|
|
39
|
+
In distributed training, a "Zombie" is a node that reports **100% Compute Utilization** and high power draw but provides **0% Functional Throughput**. This usually happens due to:
|
|
40
|
+
|
|
41
|
+
* **Stalled Kernels:** An infinite loop in a custom op pinning the chip.
|
|
42
|
+
* **Collective Deadlocks:** A node waiting for a synchronization signal (Gloo/NCCL) that never arrives.
|
|
43
|
+
* **Silent HBM Failures:** Memory errors that stop the training loop but keep the hardware active.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Core Features
|
|
50
|
+
|
|
51
|
+
* **Zero-Trust Telemetry:** Correlates hardware-level metrics (Power, Thermal, Compute) with software-level progress (Network IO, Memory Delta, Gradient Updates).
|
|
52
|
+
* **Inverse Correlation Detection:** Identifies the signature of a zombie: high power/utilization + near-zero network/collective-communication traffic.
|
|
53
|
+
* **Modular Reapers:** Pluggable actions to "drain" a node, kill a specific process group, or signal orchestrators (Kubernetes/Slurm).
|
|
54
|
+
* **Low Overhead:** Written to run as a sidecar or a lightweight daemon with minimal impact on training latency.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
|
|
60
|
+
Ladon follows a **Collector → Brain → Reaper** pattern:
|
|
61
|
+
|
|
62
|
+
1. **Collectors:** Interface with hardware drivers (e.g., `NVML`, `Neuron SDK`) to pull raw telemetry.
|
|
63
|
+
2. **The Brain:** Applies statistical analysis to detect anomalies and "Zombie" patterns over a sliding time window.
|
|
64
|
+
3. **The Reaper:** Executes the reclamation policy (Log, Alert, or Kill).
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
### Installation
|
|
71
|
+
```bash
|
|
72
|
+
pip install ladon-ml
|
|
73
|
+
Basic Usage
|
|
74
|
+
Run Ladon as a daemon to monitor the local node and detect stalled processes.
|
|
75
|
+
|
|
76
|
+
Python
|
|
77
|
+
|
|
78
|
+
import time
|
|
79
|
+
from ladon import LadonBrain, Collector
|
|
80
|
+
|
|
81
|
+
# Initialize with a 10-second sliding window
|
|
82
|
+
guardian = LadonBrain(window_size=10, sensitivity=0.05)
|
|
83
|
+
|
|
84
|
+
while True:
|
|
85
|
+
# Get telemetry from GPU/Trainium chips
|
|
86
|
+
stats = Collector.get_chip_telemetry()
|
|
87
|
+
status = guardian.analyze(stats)
|
|
88
|
+
|
|
89
|
+
if status == "ZOMBIE_DETECTED":
|
|
90
|
+
print("Alert: Stalled compute detected on Device 0!")
|
|
91
|
+
# Trigger your reclamation logic here (e.g., os.kill or k8s delete)
|
|
92
|
+
|
|
93
|
+
time.sleep(1)
|
|
94
|
+
Configuration
|
|
95
|
+
Ladon can be configured via ladon_conf.yaml:
|
|
96
|
+
|
|
97
|
+
YAML
|
|
98
|
+
|
|
99
|
+
thresholds:
|
|
100
|
+
compute_min: 90.0 # Min utilization to trigger "Pinned" state
|
|
101
|
+
net_max: 0.01 # Max network throughput (MB/s) for "Silent" state
|
|
102
|
+
window_seconds: 30 # How long to wait before declaring a Zombie
|
|
103
|
+
reclamation:
|
|
104
|
+
action: "SIGTERM" # Options: LOG, SIGTERM, DRAIN, CUSTOM
|
|
105
|
+
Why "Ladon"?
|
|
106
|
+
In Greek mythology, Ladon was the dragon with one hundred heads that guarded the golden apples. He never slept and each head watched a different part of the garden. Ladon-ML serves as that unblinking guardian for your compute garden, ensuring no single chip goes rogue and wastes your "golden" training time.
|
|
107
|
+
|
|
108
|
+
License
|
|
109
|
+
Apache 2.0
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Ladon-ML 🐉
|
|
2
|
+
|
|
3
|
+
[](https://github.com/bsaptarshi/ladon-ml/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
5
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
8
|
+
**The Hundred-Headed Guardian of Distributed Compute.**
|
|
9
|
+
|
|
10
|
+
`ladon-ml` is a lightweight, infrastructure-level Python library designed to identify and reclaim **Zombie Utilization** in high-performance ML clusters. It is purpose-built for teams managing large-scale accelerator fleets (GPUs or specialized silicon like Trainium) where stalled kernels and silent hangs can lead to massive resource waste.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## The Problem: Zombie Utilization
|
|
15
|
+
|
|
16
|
+
In distributed training, a "Zombie" is a node that reports **100% Compute Utilization** and high power draw but provides **0% Functional Throughput**. This usually happens due to:
|
|
17
|
+
|
|
18
|
+
* **Stalled Kernels:** An infinite loop in a custom op pinning the chip.
|
|
19
|
+
* **Collective Deadlocks:** A node waiting for a synchronization signal (Gloo/NCCL) that never arrives.
|
|
20
|
+
* **Silent HBM Failures:** Memory errors that stop the training loop but keep the hardware active.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Core Features
|
|
27
|
+
|
|
28
|
+
* **Zero-Trust Telemetry:** Correlates hardware-level metrics (Power, Thermal, Compute) with software-level progress (Network IO, Memory Delta, Gradient Updates).
|
|
29
|
+
* **Inverse Correlation Detection:** Identifies the signature of a zombie: high power/utilization + near-zero network/collective-communication traffic.
|
|
30
|
+
* **Modular Reapers:** Pluggable actions to "drain" a node, kill a specific process group, or signal orchestrators (Kubernetes/Slurm).
|
|
31
|
+
* **Low Overhead:** Written to run as a sidecar or a lightweight daemon with minimal impact on training latency.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
Ladon follows a **Collector → Brain → Reaper** pattern:
|
|
38
|
+
|
|
39
|
+
1. **Collectors:** Interface with hardware drivers (e.g., `NVML`, `Neuron SDK`) to pull raw telemetry.
|
|
40
|
+
2. **The Brain:** Applies statistical analysis to detect anomalies and "Zombie" patterns over a sliding time window.
|
|
41
|
+
3. **The Reaper:** Executes the reclamation policy (Log, Alert, or Kill).
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Quick Start
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
```bash
|
|
49
|
+
pip install ladon-ml
|
|
50
|
+
Basic Usage
|
|
51
|
+
Run Ladon as a daemon to monitor the local node and detect stalled processes.
|
|
52
|
+
|
|
53
|
+
Python
|
|
54
|
+
|
|
55
|
+
import time
|
|
56
|
+
from ladon import LadonBrain, Collector
|
|
57
|
+
|
|
58
|
+
# Initialize with a 10-second sliding window
|
|
59
|
+
guardian = LadonBrain(window_size=10, sensitivity=0.05)
|
|
60
|
+
|
|
61
|
+
while True:
|
|
62
|
+
# Get telemetry from GPU/Trainium chips
|
|
63
|
+
stats = Collector.get_chip_telemetry()
|
|
64
|
+
status = guardian.analyze(stats)
|
|
65
|
+
|
|
66
|
+
if status == "ZOMBIE_DETECTED":
|
|
67
|
+
print("Alert: Stalled compute detected on Device 0!")
|
|
68
|
+
# Trigger your reclamation logic here (e.g., os.kill or k8s delete)
|
|
69
|
+
|
|
70
|
+
time.sleep(1)
|
|
71
|
+
Configuration
|
|
72
|
+
Ladon can be configured via ladon_conf.yaml:
|
|
73
|
+
|
|
74
|
+
YAML
|
|
75
|
+
|
|
76
|
+
thresholds:
|
|
77
|
+
compute_min: 90.0 # Min utilization to trigger "Pinned" state
|
|
78
|
+
net_max: 0.01 # Max network throughput (MB/s) for "Silent" state
|
|
79
|
+
window_seconds: 30 # How long to wait before declaring a Zombie
|
|
80
|
+
reclamation:
|
|
81
|
+
action: "SIGTERM" # Options: LOG, SIGTERM, DRAIN, CUSTOM
|
|
82
|
+
Why "Ladon"?
|
|
83
|
+
In Greek mythology, Ladon was the dragon with one hundred heads that guarded the golden apples. He never slept and each head watched a different part of the garden. Ladon-ML serves as that unblinking guardian for your compute garden, ensuring no single chip goes rogue and wastes your "golden" training time.
|
|
84
|
+
|
|
85
|
+
License
|
|
86
|
+
Apache 2.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.0a1"
|
|
File without changes
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import click
|
|
2
|
+
|
|
3
|
+
from . import __version__
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
@click.group()
|
|
7
|
+
@click.version_option(__version__)
|
|
8
|
+
def main():
|
|
9
|
+
"""ladon-ml: Zombie Utilization detection for ML infra (pre-alpha)."""
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@main.command()
|
|
13
|
+
def status():
|
|
14
|
+
"""Show collector/brain status. Not yet implemented."""
|
|
15
|
+
click.echo("ladon-ml is pre-alpha: 'status' is not implemented yet. See the project roadmap.")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@main.command()
|
|
19
|
+
def run():
|
|
20
|
+
"""Run the detection daemon. Not yet implemented."""
|
|
21
|
+
click.echo("ladon-ml is pre-alpha: 'run' is not implemented yet. See the project roadmap.")
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
@dataclass
|
|
5
|
+
class ChipTelemetry:
|
|
6
|
+
device_id: int
|
|
7
|
+
compute_util: float # Percentage
|
|
8
|
+
memory_util: float # Percentage
|
|
9
|
+
net_io_speed: float # MB/s (Crucial for Zombie detection)
|
|
10
|
+
power_draw: float # Watts
|
|
11
|
+
|
|
12
|
+
class BaseCollector(ABC):
|
|
13
|
+
@abstractmethod
|
|
14
|
+
def collect(self) -> list[ChipTelemetry]:
|
|
15
|
+
"""Fetch telemetry from all chips on the local node."""
|
|
16
|
+
pass
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from .base import BaseCollector, ChipTelemetry
|
|
2
|
+
|
|
3
|
+
class NeuronCollector(BaseCollector):
|
|
4
|
+
def collect(self) -> list[ChipTelemetry]:
|
|
5
|
+
# In reality, this calls the Neuron Runtime API
|
|
6
|
+
# Mocking one Trainium core for now:
|
|
7
|
+
return [
|
|
8
|
+
ChipTelemetry(
|
|
9
|
+
device_id=0,
|
|
10
|
+
compute_util=99.8,
|
|
11
|
+
memory_util=85.0,
|
|
12
|
+
net_io_speed=0.001, # The 'Silent' indicator
|
|
13
|
+
power_draw=190.0
|
|
14
|
+
)
|
|
15
|
+
]
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import pynvml
|
|
2
|
+
from .base import BaseCollector, ChipTelemetry
|
|
3
|
+
|
|
4
|
+
class NvidiaCollector(BaseCollector):
|
|
5
|
+
def __init__(self):
|
|
6
|
+
self.enabled = False
|
|
7
|
+
try:
|
|
8
|
+
pynvml.nvmlInit()
|
|
9
|
+
self.device_count = pynvml.nvmlDeviceGetCount()
|
|
10
|
+
self.enabled = True
|
|
11
|
+
except (pynvml.NVMLError_LibraryNotFound, pynvml.NVMLError_DriverNotLoaded, OSError):
|
|
12
|
+
# This catches the "stub not found" or "library not found" errors
|
|
13
|
+
print("NvidiaCollector: NVIDIA driver/library not found. GPU monitoring disabled.")
|
|
14
|
+
except Exception as e:
|
|
15
|
+
print(f"NvidiaCollector: Unexpected error: {e}")
|
|
16
|
+
|
|
17
|
+
def collect(self) -> list[ChipTelemetry]:
|
|
18
|
+
if not self.enabled:
|
|
19
|
+
return []
|
|
20
|
+
|
|
21
|
+
snapshots = []
|
|
22
|
+
for i in range(self.device_count):
|
|
23
|
+
handle = pynvml.nvmlDeviceGetHandleByIndex(i)
|
|
24
|
+
|
|
25
|
+
# Official NVML calls
|
|
26
|
+
util = pynvml.nvmlDeviceGetUtilizationRates(handle)
|
|
27
|
+
mem = pynvml.nvmlDeviceGetMemoryInfo(handle)
|
|
28
|
+
power = pynvml.nvmlDeviceGetPowerUsage(handle) / 1000.0 # mW to W
|
|
29
|
+
|
|
30
|
+
snapshots.append(ChipTelemetry(
|
|
31
|
+
device_id=i,
|
|
32
|
+
compute_util=float(util.gpu),
|
|
33
|
+
memory_util=(mem.used / mem.total) * 100,
|
|
34
|
+
net_io_speed=0.0, # Placeholder for Brain to fill
|
|
35
|
+
power_draw=power
|
|
36
|
+
))
|
|
37
|
+
return snapshots
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ladon-ml
|
|
3
|
+
Version: 0.1.0a1
|
|
4
|
+
Summary: Guardian of Distributed Compute: Zombie utilization detection for ML infra.
|
|
5
|
+
Author-email: Saptarshi Bhattacharjee <bsaptarshi52@gmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/bsaptarshi/ladon-ml
|
|
8
|
+
Keywords: ml,gpu,observability,infrastructure
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: System :: Monitoring
|
|
13
|
+
Requires-Python: >=3.8
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.0
|
|
17
|
+
Requires-Dist: pyyaml>=6.0
|
|
18
|
+
Requires-Dist: nvidia-ml-py>=12.535.133
|
|
19
|
+
Requires-Dist: prometheus_client
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# Ladon-ML 🐉
|
|
25
|
+
|
|
26
|
+
[](https://github.com/bsaptarshi/ladon-ml/actions/workflows/ci.yml)
|
|
27
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
28
|
+
[](https://pypi.org/project/ladon-ml/)
|
|
29
|
+
[](LICENSE)
|
|
30
|
+
|
|
31
|
+
**The Hundred-Headed Guardian of Distributed Compute.**
|
|
32
|
+
|
|
33
|
+
`ladon-ml` is a lightweight, infrastructure-level Python library designed to identify and reclaim **Zombie Utilization** in high-performance ML clusters. It is purpose-built for teams managing large-scale accelerator fleets (GPUs or specialized silicon like Trainium) where stalled kernels and silent hangs can lead to massive resource waste.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## The Problem: Zombie Utilization
|
|
38
|
+
|
|
39
|
+
In distributed training, a "Zombie" is a node that reports **100% Compute Utilization** and high power draw but provides **0% Functional Throughput**. This usually happens due to:
|
|
40
|
+
|
|
41
|
+
* **Stalled Kernels:** An infinite loop in a custom op pinning the chip.
|
|
42
|
+
* **Collective Deadlocks:** A node waiting for a synchronization signal (Gloo/NCCL) that never arrives.
|
|
43
|
+
* **Silent HBM Failures:** Memory errors that stop the training loop but keep the hardware active.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Core Features
|
|
50
|
+
|
|
51
|
+
* **Zero-Trust Telemetry:** Correlates hardware-level metrics (Power, Thermal, Compute) with software-level progress (Network IO, Memory Delta, Gradient Updates).
|
|
52
|
+
* **Inverse Correlation Detection:** Identifies the signature of a zombie: high power/utilization + near-zero network/collective-communication traffic.
|
|
53
|
+
* **Modular Reapers:** Pluggable actions to "drain" a node, kill a specific process group, or signal orchestrators (Kubernetes/Slurm).
|
|
54
|
+
* **Low Overhead:** Written to run as a sidecar or a lightweight daemon with minimal impact on training latency.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Architecture
|
|
59
|
+
|
|
60
|
+
Ladon follows a **Collector → Brain → Reaper** pattern:
|
|
61
|
+
|
|
62
|
+
1. **Collectors:** Interface with hardware drivers (e.g., `NVML`, `Neuron SDK`) to pull raw telemetry.
|
|
63
|
+
2. **The Brain:** Applies statistical analysis to detect anomalies and "Zombie" patterns over a sliding time window.
|
|
64
|
+
3. **The Reaper:** Executes the reclamation policy (Log, Alert, or Kill).
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Quick Start
|
|
69
|
+
|
|
70
|
+
### Installation
|
|
71
|
+
```bash
|
|
72
|
+
pip install ladon-ml
|
|
73
|
+
Basic Usage
|
|
74
|
+
Run Ladon as a daemon to monitor the local node and detect stalled processes.
|
|
75
|
+
|
|
76
|
+
Python
|
|
77
|
+
|
|
78
|
+
import time
|
|
79
|
+
from ladon import LadonBrain, Collector
|
|
80
|
+
|
|
81
|
+
# Initialize with a 10-second sliding window
|
|
82
|
+
guardian = LadonBrain(window_size=10, sensitivity=0.05)
|
|
83
|
+
|
|
84
|
+
while True:
|
|
85
|
+
# Get telemetry from GPU/Trainium chips
|
|
86
|
+
stats = Collector.get_chip_telemetry()
|
|
87
|
+
status = guardian.analyze(stats)
|
|
88
|
+
|
|
89
|
+
if status == "ZOMBIE_DETECTED":
|
|
90
|
+
print("Alert: Stalled compute detected on Device 0!")
|
|
91
|
+
# Trigger your reclamation logic here (e.g., os.kill or k8s delete)
|
|
92
|
+
|
|
93
|
+
time.sleep(1)
|
|
94
|
+
Configuration
|
|
95
|
+
Ladon can be configured via ladon_conf.yaml:
|
|
96
|
+
|
|
97
|
+
YAML
|
|
98
|
+
|
|
99
|
+
thresholds:
|
|
100
|
+
compute_min: 90.0 # Min utilization to trigger "Pinned" state
|
|
101
|
+
net_max: 0.01 # Max network throughput (MB/s) for "Silent" state
|
|
102
|
+
window_seconds: 30 # How long to wait before declaring a Zombie
|
|
103
|
+
reclamation:
|
|
104
|
+
action: "SIGTERM" # Options: LOG, SIGTERM, DRAIN, CUSTOM
|
|
105
|
+
Why "Ladon"?
|
|
106
|
+
In Greek mythology, Ladon was the dragon with one hundred heads that guarded the golden apples. He never slept and each head watched a different part of the garden. Ladon-ML serves as that unblinking guardian for your compute garden, ensuring no single chip goes rogue and wastes your "golden" training time.
|
|
107
|
+
|
|
108
|
+
License
|
|
109
|
+
Apache 2.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
ladon/__init__.py
|
|
5
|
+
ladon/brain.py
|
|
6
|
+
ladon/cli.py
|
|
7
|
+
ladon/collector/__init__.py
|
|
8
|
+
ladon/collector/base.py
|
|
9
|
+
ladon/collector/neuron.py
|
|
10
|
+
ladon/collector/nvidia.py
|
|
11
|
+
ladon/reaper/__init__.py
|
|
12
|
+
ladon/reaper/local.py
|
|
13
|
+
ladon_ml.egg-info/PKG-INFO
|
|
14
|
+
ladon_ml.egg-info/SOURCES.txt
|
|
15
|
+
ladon_ml.egg-info/dependency_links.txt
|
|
16
|
+
ladon_ml.egg-info/entry_points.txt
|
|
17
|
+
ladon_ml.egg-info/requires.txt
|
|
18
|
+
ladon_ml.egg-info/top_level.txt
|
|
19
|
+
tests/test_cli.py
|
|
20
|
+
tests/test_collector_base.py
|
|
21
|
+
tests/test_collector_neuron.py
|
|
22
|
+
tests/test_collector_nvidia.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ladon
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ladon-ml"
|
|
7
|
+
version = "0.1.0a1"
|
|
8
|
+
description = "Guardian of Distributed Compute: Zombie utilization detection for ML infra."
|
|
9
|
+
authors = [{ name = "Saptarshi Bhattacharjee", email = "bsaptarshi52@gmail.com" }]
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
license = "Apache-2.0"
|
|
13
|
+
keywords = ["ml", "gpu", "observability", "infrastructure"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Topic :: System :: Monitoring",
|
|
19
|
+
]
|
|
20
|
+
dependencies = [
|
|
21
|
+
"click>=8.0", # For the CLI
|
|
22
|
+
"pyyaml>=6.0", # For configuration
|
|
23
|
+
"nvidia-ml-py>=12.535.133",
|
|
24
|
+
"prometheus_client" # To export metrics to Grafana/Prometheus
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest>=7.0"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/bsaptarshi/ladon-ml"
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
ladon = "ladon.cli:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["."]
|
|
38
|
+
include = ["ladon*"]
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from click.testing import CliRunner
|
|
2
|
+
|
|
3
|
+
from ladon.cli import main
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def test_cli_status_runs():
|
|
7
|
+
result = CliRunner().invoke(main, ["status"])
|
|
8
|
+
assert result.exit_code == 0
|
|
9
|
+
assert "not implemented" in result.output
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def test_cli_version():
|
|
13
|
+
result = CliRunner().invoke(main, ["--version"])
|
|
14
|
+
assert result.exit_code == 0
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from ladon.collector.base import BaseCollector, ChipTelemetry
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_chip_telemetry_fields():
|
|
5
|
+
t = ChipTelemetry(
|
|
6
|
+
device_id=0,
|
|
7
|
+
compute_util=100.0,
|
|
8
|
+
memory_util=50.0,
|
|
9
|
+
net_io_speed=0.0,
|
|
10
|
+
power_draw=300.0,
|
|
11
|
+
)
|
|
12
|
+
assert t.device_id == 0
|
|
13
|
+
assert t.compute_util == 100.0
|
|
14
|
+
assert t.memory_util == 50.0
|
|
15
|
+
assert t.net_io_speed == 0.0
|
|
16
|
+
assert t.power_draw == 300.0
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def test_base_collector_is_abstract():
|
|
20
|
+
import pytest
|
|
21
|
+
|
|
22
|
+
with pytest.raises(TypeError):
|
|
23
|
+
BaseCollector()
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from ladon.collector.base import ChipTelemetry
|
|
2
|
+
from ladon.collector.neuron import NeuronCollector
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_neuron_collector_returns_one_chip():
|
|
6
|
+
snapshots = NeuronCollector().collect()
|
|
7
|
+
assert len(snapshots) == 1
|
|
8
|
+
assert isinstance(snapshots[0], ChipTelemetry)
|
|
9
|
+
assert snapshots[0].device_id == 0
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from ladon.collector.nvidia import NvidiaCollector
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
def test_nvidia_collector_disabled_without_driver():
|
|
5
|
+
# In CI / non-GPU environments, NVML init fails and the collector
|
|
6
|
+
# must degrade to an empty, non-crashing collect() rather than
|
|
7
|
+
# raising AttributeError on self.enabled.
|
|
8
|
+
collector = NvidiaCollector()
|
|
9
|
+
assert collector.enabled is False
|
|
10
|
+
assert collector.collect() == []
|