Skip to content

Commit 59d91b8

Browse files
authored
[None][chore] add online help to build_wheel.py and fix a doc link (#6391)
Signed-off-by: Zhenhua Wang <[email protected]>
1 parent 2279cec commit 59d91b8

File tree

2 files changed

+72
-43
lines changed

2 files changed

+72
-43
lines changed

docs/source/performance/perf-analysis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Append “python-gil” to Nsys “-t” option.
5252
2. Set environment variable `TLLM_TORCH_PROFILE_TRACE=<path>`, and the results will be saved to `<path>`.
5353

5454
### Visualize the PyTorch profiler results
55-
Use [chrome://tracing/](chrome://tracing/) to inspect the saved profile.
55+
Use <chrome://tracing/> to inspect the saved profile.
5656

5757

5858
## Examples
@@ -88,4 +88,4 @@ TLLM_PROFILE_START_STOP=100-150 nsys profile \
8888

8989
The Nsight Systems reports will be saved to `trace.nsys-rep`. Use NVIDIA Nsight Systems application to open it.
9090

91-
The PyTorch profiler results will be saved to `trace.json`. Use [chrome://tracing/](chrome://tracing/) to inspect the saved profile.
91+
The PyTorch profiler results will be saved to `trace.json`. Use <chrome://tracing/> to inspect the saved profile.

scripts/build_wheel.py

Lines changed: 70 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -784,25 +784,45 @@ def get_binding_lib(subdirectory, name):
784784

785785

786786
def add_arguments(parser: ArgumentParser):
787-
parser.add_argument("--build_type",
788-
"-b",
789-
default="Release",
790-
choices=["Release", "RelWithDebInfo", "Debug"])
791-
parser.add_argument("--generator", "-G", default="")
792-
parser.add_argument("--cuda_architectures", "-a")
793-
parser.add_argument("--install", "-i", action="store_true")
794-
parser.add_argument("--clean", "-c", action="store_true")
795-
parser.add_argument("--clean_wheel",
787+
parser.add_argument(
788+
"--build_type",
789+
"-b",
790+
default="Release",
791+
choices=["Release", "RelWithDebInfo", "Debug"],
792+
help="Build type, will be passed to cmake `CMAKE_BUILD_TYPE` variable")
793+
parser.add_argument(
794+
"--generator",
795+
"-G",
796+
default="",
797+
help="CMake generator to use (e.g., 'Ninja', 'Unix Makefiles')")
798+
parser.add_argument(
799+
"--cuda_architectures",
800+
"-a",
801+
help=
802+
"CUDA architectures to build for, will be passed to cmake `CUDA_ARCHITECTURES` variable. Example: `--cuda_architectures=90-real;100-real`"
803+
)
804+
parser.add_argument("--install",
805+
"-i",
796806
action="store_true",
797-
help="Clear dist_dir folder creating wheel")
807+
help="Install the built python package after building")
808+
parser.add_argument("--clean",
809+
"-c",
810+
action="store_true",
811+
help="Clean the build directory before building")
812+
parser.add_argument(
813+
"--clean_wheel",
814+
action="store_true",
815+
help=
816+
"Clear dist_dir folder when creating wheel. Will be set to `true` if `--clean` is set"
817+
)
798818
parser.add_argument("--configure_cmake",
799819
action="store_true",
800820
help="Always configure cmake before building")
801821
parser.add_argument("--use_ccache",
802822
"-ccache",
803823
default=False,
804824
action="store_true",
805-
help="Use ccache compiler driver")
825+
help="Use ccache compiler driver for faster rebuilds")
806826
parser.add_argument(
807827
"--fast_build",
808828
"-f",
@@ -811,11 +831,14 @@ def add_arguments(parser: ArgumentParser):
811831
help=
812832
"Skip compiling some kernels to accelerate compilation -- for development only"
813833
)
814-
parser.add_argument("--job_count",
815-
"-j",
816-
const=cpu_count(),
817-
nargs="?",
818-
help="Parallel job count")
834+
parser.add_argument(
835+
"--job_count",
836+
"-j",
837+
const=cpu_count(),
838+
nargs="?",
839+
help=
840+
"Number of parallel jobs for compilation (default: number of CPU cores)"
841+
)
819842
parser.add_argument(
820843
"--cpp_only",
821844
"-l",
@@ -826,72 +849,78 @@ def add_arguments(parser: ArgumentParser):
826849
"-D",
827850
action="append",
828851
help=
829-
"Extra cmake variable definition which can be specified multiple times, example: -D \"key1=value1\" -D \"key2=value2\"",
852+
"Extra cmake variable definitions which can be specified multiple times. Example: -D \"key1=value1\" -D \"key2=value2\"",
830853
default=[])
831854
parser.add_argument(
832855
"--extra-make-targets",
833-
help="A list of additional make targets, example: \"target_1 target_2\"",
856+
help="Additional make targets to build. Example: \"target_1 target_2\"",
834857
nargs="+",
835858
default=[])
836-
parser.add_argument("--trt_root",
837-
default="/usr/local/tensorrt",
838-
help="Directory to find TensorRT headers/libs")
859+
parser.add_argument(
860+
"--trt_root",
861+
default="/usr/local/tensorrt",
862+
help="Directory containing TensorRT headers and libraries")
839863
parser.add_argument("--nccl_root",
840-
help="Directory to find NCCL headers/libs")
864+
help="Directory containing NCCL headers and libraries")
841865
parser.add_argument("--nixl_root",
842-
help="Directory to find NIXL headers/libs")
866+
help="Directory containing NIXL headers and libraries")
843867
parser.add_argument(
844868
"--internal-cutlass-kernels-root",
845869
default="",
846870
help=
847-
"Directory to the internal_cutlass_kernels sources. If specified, the internal_cutlass_kernels and NVRTC wrapper libraries will be built from source."
871+
"Directory containing internal_cutlass_kernels sources. If specified, the internal_cutlass_kernels and NVRTC wrapper libraries will be built from source."
848872
)
849-
parser.add_argument("--build_dir",
850-
type=Path,
851-
help="Directory where cpp sources are built")
852-
parser.add_argument("--dist_dir",
853-
type=Path,
854-
help="Directory where python wheels are built")
873+
parser.add_argument(
874+
"--build_dir",
875+
type=Path,
876+
help=
877+
"Directory where C++ sources are built (default: cpp/build or cpp/build_<build_type>)"
878+
)
879+
parser.add_argument(
880+
"--dist_dir",
881+
type=Path,
882+
help="Directory where Python wheels are built (default: build/)")
855883
parser.add_argument(
856884
"--skip_building_wheel",
857885
"-s",
858886
action="store_true",
859887
help=
860-
"Do not build the *.whl files (they are only needed for distribution).")
888+
"Skip building the *.whl files (they are only needed for distribution)")
861889
parser.add_argument(
862890
"--linking_install_binary",
863891
action="store_true",
864-
help="Install the built binary by symbolic linking instead of copying.")
892+
help=
893+
"Install the built binary by creating symbolic links instead of copying files"
894+
)
865895
parser.add_argument("--binding_type",
866896
choices=["pybind", "nanobind"],
867897
default="pybind",
868-
help="Which binding type to build: pybind, nanobind")
898+
help="Which binding type to build: pybind or nanobind")
869899
parser.add_argument("--benchmarks",
870900
action="store_true",
871-
help="Build the benchmarks for the C++ runtime.")
901+
help="Build the benchmarks for the C++ runtime")
872902
parser.add_argument("--micro_benchmarks",
873903
action="store_true",
874-
help="Build the micro benchmarks for C++ components.")
904+
help="Build the micro benchmarks for C++ components")
875905
parser.add_argument("--nvtx",
876906
action="store_true",
877-
help="Enable NVTX features.")
907+
help="Enable NVTX profiling features")
878908
parser.add_argument("--skip-stubs",
879909
action="store_true",
880-
help="Skip building python stubs")
910+
help="Skip building Python type stubs")
881911
parser.add_argument("--generate_fmha",
882912
action="store_true",
883-
help="Generate the FMHA cu files.")
913+
help="Generate the FMHA CUDA files")
884914
parser.add_argument(
885915
"--no-venv",
886916
action="store_true",
887917
help=
888-
"Use the current Python interpreter without creating a virtual environment."
918+
"Use the current Python interpreter without creating a virtual environment"
889919
)
890920
parser.add_argument(
891921
"--nvrtc_dynamic_linking",
892922
action="store_true",
893-
help="Link against the dynamic NVRTC libraries and not the static ones."
894-
)
923+
help="Link against dynamic NVRTC libraries instead of static ones")
895924

896925

897926
if __name__ == "__main__":

0 commit comments

Comments
 (0)