|
<!DOCTYPE html> |
|
<html lang="en"> |
|
<head> |
|
<meta charset="UTF-8"> |
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|
<title>Megatron Memory Estimator</title> |
|
<link rel="stylesheet" href="style.css"> |
|
</head> |
|
<body> |
|
<div class="container"> |
|
<h1>Megatron Memory Estimator</h1> |
|
<div class="disclaimer-banner"> |
|
Note: This estimator only measures the GPU memory directly managed by PyTorch when running Megatron. It does not include extra consumption from NCCL communication buffers, kernel fusion, overlap optimizations, CUDA Graphs, etc. Please use the "Overhead per GPU" option below to account for these additional costs. |
|
</div> |
|
|
|
<div class="main-layout"> |
|
<div class="top-section"> |
|
<div class="config-column"> |
|
<form id="config-form"> |
|
<h2>Configuration</h2> |
|
<div class="form-group"> |
|
<label for="model-select">Select a Local Config:</label> |
|
<select id="model-select" name="model"> |
|
<option value="">Loading...</option> |
|
</select> |
|
</div> |
|
|
|
|
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="num-gpus">Total GPUs:</label> |
|
<input type="number" id="num-gpus" name="num_gpus" value="8" step="8" min="8"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="mbs">micro batch size:</label> |
|
<input type="number" id="mbs" name="mbs" value="1" min="1"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="seq-len">SeqLen:</label> |
|
<input type="number"id="seq-len" name="seq-len" value="4096" min="1"> |
|
</div> |
|
</div> |
|
|
|
<div class="form-group"> |
|
<input type="checkbox" id="use-distributed-optimizer" name="use_distributed_optimizer" checked> |
|
<label for="use-distributed-optimizer" class="inline-label">Use Distributed Optimizer</label> |
|
</div> |
|
|
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="recompute-granularity">Recomputation:</label> |
|
<select id="recompute-granularity" name="recompute_granularity"> |
|
<option value="none">None</option> |
|
<option value="selective">Selective</option> |
|
<option value="full">Full</option> |
|
</select> |
|
</div> |
|
<div class="form-group recompute-options" style="display: none;"> |
|
<label for="recompute-method">Method:</label> |
|
<select id="recompute-method" name="recompute_method"> |
|
<option value="uniform">Uniform</option> |
|
<option value="block">Block</option> |
|
</select> |
|
</div> |
|
<div class="form-group recompute-options" style="display: none;"> |
|
<label for="recompute-num-layers">Layers:</label> |
|
<input type="number" id="recompute-num-layers" name="recompute_num_layers" value="1" min="1"> |
|
</div> |
|
</div> |
|
|
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="tp">TP:</label> |
|
<select id="tp" name="tp"></select> |
|
</div> |
|
<div class="form-group"> |
|
<label for="pp">PP:</label> |
|
<input type="number" id="pp" name="pp" value="1" min="1"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="ep">EP:</label> |
|
<select id="ep" name="ep"></select> |
|
</div> |
|
<div class="form-group"> |
|
<label for="cp">CP:</label> |
|
<select id="cp" name="cp"></select> |
|
</div> |
|
</div> |
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="vpp">VPP:</label> |
|
<input type="number" id="vpp" name="vpp" placeholder="None" min="1"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="etp">ETP:</label> |
|
<input type="number" id="etp" name="etp" placeholder="None" min="1"> |
|
</div> |
|
</div> |
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="num_layers_in_first_pipeline_stage">First Stage Layers:</label> |
|
<input type="number" id="num_layers_in_first_pipeline_stage" name="num_layers_in_first_pipeline_stage" placeholder="None" min="0"> |
|
</div> |
|
<div class="form-group"> |
|
<label for="num_layers_in_last_pipeline_stage">Last Stage Layers:</label> |
|
<input type="number" id="num_layers_in_last_pipeline_stage" name="num_layers_in_last_pipeline_stage" placeholder="None" min="0"> |
|
</div> |
|
</div> |
|
<div class="form-row"> |
|
<div class="form-group"> |
|
<label for="overhead">Overhead per GPU:</label> |
|
<select id="overhead" name="overhead"> |
|
<option value="5">5GB</option> |
|
<option value="10" selected>10GB</option> |
|
</select> |
|
</div> |
|
</div> |
|
|
|
<div id="validation-message" class="error-message" style="display: none;"></div> |
|
<div class="button-container"> |
|
<button type="submit">Estimate</button> |
|
</div> |
|
</form> |
|
</div> |
|
|
|
<div class="output-column"> |
|
<div class="config-editor-wrapper"> |
|
<h2>Model Config (Editable)</h2> |
|
<textarea id="config-editor" rows="20"></textarea> |
|
</div> |
|
</div> |
|
</div> |
|
|
|
<div class="bottom-section"> |
|
<div id="output-container"> |
|
<div id="loading" style="display: none;">Calculating...</div> |
|
<div id="history-wrapper"> |
|
<h3>History</h3> |
|
<table id="history-table"> |
|
<thead> |
|
<tr> |
|
<th>Model</th> |
|
<th>Weight Optimizer (GB)</th> |
|
<th>Activation (GB)</th> |
|
<th>Total (GB/GPU)</th> |
|
<th>Actions</th> |
|
</tr> |
|
</thead> |
|
<tbody> |
|
</tbody> |
|
</table> |
|
<button id="clear-history" style="margin-top: 1em;">Clear History</button> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
</div> |
|
<script src="script.js"></script> |
|
<footer class="footer"> |
|
<p>© 2025 <a href="https://github.com/ISEEKYAN" target="_blank">ISEEKYAN</a>. Developed at NVIDIA. | <a href="https://github.com/ISEEKYAN/mbridge/tree/main/memory_estimator" target="_blank">Source Code</a></p> |
|
</footer> |
|
</body> |
|
</html> |