-
Notifications
You must be signed in to change notification settings - Fork 256
select_num_devices_per_node #2123
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
Changes from all commits
b7f7451
696a5ab
fa5388d
03b58ba
b8e23f3
79b12b2
bde8160
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,6 +26,14 @@ | |||||||||||||||||||||||||||||
| VALID_CUDA_GRAPH_IMPLS = ["none", "local", "transformer_engine"] | ||||||||||||||||||||||||||||||
| VALID_CUDA_GRAPH_SCOPES = ["full_iteration", "attn", "mlp", "moe", "moe_router", "moe_preprocess", "mamba"] | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| NUM_GPUS_PER_NODE_MAP = { | ||||||||||||||||||||||||||||||
| "h100": 8, | ||||||||||||||||||||||||||||||
| "b200": 8, | ||||||||||||||||||||||||||||||
| "b300": 8, | ||||||||||||||||||||||||||||||
| "gb200": 4, | ||||||||||||||||||||||||||||||
| "gb300": 4, | ||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| def list_of_strings(arg): | ||||||||||||||||||||||||||||||
| """Split a comma-separated string into a list of substrings.""" | ||||||||||||||||||||||||||||||
|
|
@@ -383,8 +391,8 @@ def parse_cli_args(): | |||||||||||||||||||||||||||||
| "-gn", | ||||||||||||||||||||||||||||||
| "--gpus_per_node", | ||||||||||||||||||||||||||||||
| type=int, | ||||||||||||||||||||||||||||||
| help="Number of gpus per node. Defaults to 8", | ||||||||||||||||||||||||||||||
| default=8, | ||||||||||||||||||||||||||||||
| help="Number of gpus per node. Defaults to None. If not provided, will be inferred from the GPU type.", | ||||||||||||||||||||||||||||||
| default=None, | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
Comment on lines
391
to
396
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Validate Line 385 currently accepts 🛠️ Proposed fix def list_of_ints(arg):
@@
return result
+
+
+def positive_int(arg: str) -> int:
+ """Parse a strictly positive integer CLI value."""
+ value = int(arg)
+ if value < 1:
+ raise argparse.ArgumentTypeError("value must be >= 1")
+ return value
@@
slurm_args.add_argument(
"-gn",
"--gpus_per_node",
- type=int,
+ type=positive_int,
help="Number of gpus per node. Defaults to None. If not provided, will be inferred from the GPU type.",
default=None,
)📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||
| slurm_args.add_argument( | ||||||||||||||||||||||||||||||
| "-i", | ||||||||||||||||||||||||||||||
|
|
@@ -500,7 +508,7 @@ def parse_cli_args(): | |||||||||||||||||||||||||||||
| "-g", | ||||||||||||||||||||||||||||||
| "--gpu", | ||||||||||||||||||||||||||||||
| type=str, | ||||||||||||||||||||||||||||||
| choices=["h100", "b200", "gb200", "gb300", "b300"], | ||||||||||||||||||||||||||||||
| choices=NUM_GPUS_PER_NODE_MAP.keys(), | ||||||||||||||||||||||||||||||
| help="Target gpu type.", | ||||||||||||||||||||||||||||||
| required=True, | ||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate
--gpus_per_nodeas a positive integer.Line 385 currently accepts any integer.
0can trigger division by zero in downstream node calculation, and negative values can produce invalid node counts.🛠️ Proposed fix
🤖 Prompt for AI Agents