@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 3059b9cc6b
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 14, 05:30 UTC

[Doc] Add --force-overwrite option to generate_cmake_presets.py (#24375)

Signed-off-by: elvischenv <219235043+elvischenv@users.noreply.github.com>

elvischenv committed Sep 17, 2025 at 09:45 UTC 3059b9cc6bf7772ac53389e01c53e583e4dea0d0
2 files changed +31 -8
docs/contributing/incremental_build.md
+10
@@ -40,6 +40,16 @@ python tools/generate_cmake_presets.py
40
41 The script will prompt you if it cannot automatically determine certain paths (e.g., `nvcc` or a specific Python executable for your vLLM development environment). Follow the on-screen prompts. If an existing `CMakeUserPresets.json` is found, the script will ask for confirmation before overwriting it.
42
43 +**Force overwrite existing file:**
44 +
45 +To automatically overwrite an existing `CMakeUserPresets.json` without prompting, use the `--force-overwrite` flag:
46 +
47 +```console
48 +python tools/generate_cmake_presets.py --force-overwrite
49 +```
50 +
51 +This is particularly useful in automated scripts or CI/CD environments where interactive prompts are not desired.
52 +
53 After running the script, a `CMakeUserPresets.json` file will be created in the root of your vLLM repository.
54
55 ### Example `CMakeUserPresets.json`
tools/generate_cmake_presets.py
+21 -8
@@ -1,5 +1,6 @@
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +import argparse
4 import json
5 import multiprocessing
6 import os
@@ -26,7 +27,8 @@ def get_cpu_cores():
27 return multiprocessing.cpu_count()
28
29
29 -def generate_presets(output_path="CMakeUserPresets.json"):
30 +def generate_presets(output_path="CMakeUserPresets.json",
31 + force_overwrite=False):
32 """Generates the CMakeUserPresets.json file."""
33
34 print("Attempting to detect your system configuration...")
@@ -143,12 +145,15 @@ def generate_presets(output_path="CMakeUserPresets.json"):
145 output_file_path = os.path.join(project_root, output_path)
146
147 if os.path.exists(output_file_path):
146 - overwrite = input(
147 - f"'{output_file_path}' already exists. Overwrite? (y/N): ").strip(
148 - ).lower()
149 - if overwrite != 'y':
150 - print("Generation cancelled.")
151 - return
148 + if force_overwrite:
149 + print(f"Overwriting existing file '{output_file_path}'")
150 + else:
151 + overwrite = input(
152 + f"'{output_file_path}' already exists. Overwrite? (y/N): "
153 + ).strip().lower()
154 + if overwrite != 'y':
155 + print("Generation cancelled.")
156 + return
157
158 try:
159 with open(output_file_path, "w") as f:
@@ -166,4 +171,12 @@ def generate_presets(output_path="CMakeUserPresets.json"):
171
172
173 if __name__ == "__main__":
169 - generate_presets()
174 + parser = argparse.ArgumentParser()
175 + parser.add_argument(
176 + "--force-overwrite",
177 + action="store_true",
178 + help="Force overwrite existing CMakeUserPresets.json without prompting"
179 + )
180 +
181 + args = parser.parse_args()
182 + generate_presets(force_overwrite=args.force_overwrite)