Skip to content

Commit adabaa2

Browse files
Added changes to add --build_variant flag for cpu only build.
1 parent 7e31829 commit adabaa2

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

build.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,12 +1239,7 @@ def create_dockerfile_linux(
12391239
12401240
WORKDIR /opt/tritonserver
12411241
COPY --chown=1000:1000 NVIDIA_Deep_Learning_Container_License.pdf .
1242-
RUN if [ "$(uname -m)" = "ppc64le" ]; then \
1243-
VARIANT="cpu"; \
1244-
else \
1245-
VARIANT="all"; \
1246-
fi &&\
1247-
find /opt/tritonserver/python -maxdepth 1 -type f -name \
1242+
RUN find /opt/tritonserver/python -maxdepth 1 -type f -name \
12481243
"tritonserver-*.whl" | xargs -I {} pip install --upgrade {}[$VARIANT] && \
12491244
find /opt/tritonserver/python -maxdepth 1 -type f -name \
12501245
"tritonfrontend-*.whl" | xargs -I {} pip install --upgrade {}[$VARIANT];
@@ -1300,6 +1295,7 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
13001295
df = """
13011296
ARG TRITON_VERSION
13021297
ARG TRITON_CONTAINER_VERSION
1298+
ARG VARIANT=all
13031299
13041300
ENV TRITON_SERVER_VERSION ${TRITON_VERSION}
13051301
ENV NVIDIA_TRITON_SERVER_VERSION ${TRITON_CONTAINER_VERSION}
@@ -1453,15 +1449,6 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
14531449
"""
14541450
else:
14551451
df += """
1456-
RUN if [ "$(uname -m)" = "ppc64le" ]; then \
1457-
apt-get update \
1458-
&& apt-get install -y --no-install-recommends \
1459-
clang-15 \
1460-
&& ln -s /usr/bin/clang-15 /usr/bin/clang -f \
1461-
&& ln -s /usr/bin/clang++-15 /usr/bin/clang++ -f \
1462-
&& pip3 install cython ninja; \
1463-
fi
1464-
14651452
# python3, python3-pip and some pip installs required for the python backend
14661453
RUN apt-get update \\
14671454
&& apt-get install -y --no-install-recommends \\
@@ -1913,6 +1900,10 @@ def create_docker_build_script(script_name, container_install_dir, container_ci_
19131900
f"--secret id=NVPL_SLIM_URL",
19141901
f"--build-arg BUILD_PUBLIC_VLLM={build_public_vllm}",
19151902
]
1903+
if FLAGS.build_variant:
1904+
finalargs += [
1905+
"--build-arg VARIANT="+(FLAGS.build_variant),
1906+
]
19161907
finalargs += [
19171908
"-t",
19181909
"tritonserver",
@@ -2778,6 +2769,13 @@ def enable_all():
27782769
default=DEFAULT_TRITON_VERSION_MAP["rhel_py_version"],
27792770
help="This flag sets the Python version for RHEL platform of Triton Inference Server to be built. Default: the latest supported version.",
27802771
)
2772+
parser.add_argument(
2773+
"--build_variant",
2774+
required=False,
2775+
type=str,
2776+
default="all",
2777+
help="Can be set to all or cpu,Default value is all."
2778+
)
27812779
parser.add_argument(
27822780
"--build-secret",
27832781
action="append",
@@ -2817,6 +2815,9 @@ def enable_all():
28172815
FLAGS.extra_backend_cmake_arg = []
28182816
if FLAGS.build_secret is None:
28192817
FLAGS.build_secret = []
2818+
if hasattr(FLAGS, 'build_variant') and FLAGS.build_variant not in ["all", "cpu"]:
2819+
raise ValueError(f"Invalid build_variant value: {FLAGS.build_variant}. Expected 'all' or 'cpu'.")
2820+
28202821

28212822
# if --enable-all is specified, then update FLAGS to enable all
28222823
# settings, backends, repo-agents, caches, file systems, endpoints, etc.

0 commit comments

Comments
 (0)