Skip to content
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

build: RHEL8 EA2 Backends #7535

Closed
wants to merge 21 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
223 changes: 215 additions & 8 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ def fail_if(p, msg):


def target_platform():
if FLAGS.target_platform is not None:
# When called by compose.py, FLAGS will be None
if FLAGS and FLAGS.target_platform is not None:
return FLAGS.target_platform
platform_string = platform.system().lower()
if platform_string == "linux":
Expand All @@ -132,7 +133,8 @@ def target_platform():


def target_machine():
if FLAGS.target_machine is not None:
# When called by compose.py, FLAGS will be None
if FLAGS and FLAGS.target_machine is not None:
return FLAGS.target_machine
return platform.machine().lower()

Expand Down Expand Up @@ -639,13 +641,16 @@ def pytorch_cmake_args(images):
cmake_backend_arg("pytorch", "TRITON_PYTORCH_DOCKER_IMAGE", None, image),
]

if FLAGS.enable_gpu:
# TODO: TPRD-372 TorchTRT extension is not currently supported by our manylinux build
# TODO: TPRD-373 NVTX extension is not currently supported by our manylinux build
if target_platform() != "rhel":
if FLAGS.enable_gpu:
cargs.append(
cmake_backend_enable("pytorch", "TRITON_PYTORCH_ENABLE_TORCHTRT", True)
)
cargs.append(
cmake_backend_enable("pytorch", "TRITON_PYTORCH_ENABLE_TORCHTRT", True)
cmake_backend_enable("pytorch", "TRITON_ENABLE_NVTX", FLAGS.enable_nvtx)
)
cargs.append(
cmake_backend_enable("pytorch", "TRITON_ENABLE_NVTX", FLAGS.enable_nvtx)
)
return cargs


Expand Down Expand Up @@ -899,6 +904,203 @@ def install_dcgm_libraries(dcgm_version, target_machine):
)


def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
df = """
ARG TRITON_VERSION={}
ARG TRITON_CONTAINER_VERSION={}
ARG BASE_IMAGE={}
""".format(
argmap["TRITON_VERSION"],
argmap["TRITON_CONTAINER_VERSION"],
argmap["BASE_IMAGE"],
)

df += """
FROM ${BASE_IMAGE}

ARG TRITON_VERSION
ARG TRITON_CONTAINER_VERSION
"""

df += """
# Install docker docker buildx
RUN yum install -y ca-certificates curl gnupg yum-utils \\
&& yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo \\
&& yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# && yum install -y docker.io docker-buildx-plugin

# libcurl4-openSSL-dev is needed for GCS
# python3-dev is needed by Torchvision
# python3-pip and libarchive-dev is needed by python backend
# libxml2-dev is needed for Azure Storage
# scons is needed for armnn_tflite backend build dep
RUN yum install -y \\
Comment on lines +927 to +937
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't yum update is required?
Also wondering why yum not dnf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mc-nv ignore these changes for now. There was an issue with the rebasing.

That said, you comments apply to our other RHEL PRs. In general, we can't do yum update because it will update the release version from 8.9 to 8.10, which would differ from the release version of the CUDA base container.

I have no preference for yum vs dnf.

ca-certificates \\
autoconf \\
automake \\
git \\
gperf \\
re2-devel \\
openssl-devel \\
libtool \\
libcurl-devel \\
libb64-devel \\
gperftools-devel \\
patchelf \\
python3.11-devel \\
python3-pip \\
python3-setuptools \\
rapidjson-devel \\
python3-scons \\
pkg-config \\
unzip \\
wget \\
zlib-devel \\
libarchive-devel \\
libxml2-devel \\
numactl-devel \\
wget

RUN pip3 install --upgrade pip \\
&& pip3 install --upgrade \\
wheel \\
setuptools \\
docker \\
virtualenv

# Install boost version >= 1.78 for boost::span
# Current libboost-dev apt packages are < 1.78, so install from tar.gz
RUN wget -O /tmp/boost.tar.gz \\
https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz \\
&& (cd /tmp && tar xzf boost.tar.gz) \\
&& mv /tmp/boost_1_80_0/boost /usr/include/boost

# Server build requires recent version of CMake (FetchContent required)
# Might not need this if the installed version of cmake is high enough for our build.
# RUN apt update -q=2 \\
# && apt install -y gpg wget \\
# && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \\
# && . /etc/os-release \\
# && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \\
# && apt-get update -q=2 \\
# && apt-get install -y --no-install-recommends cmake=3.27.7* cmake-data=3.27.7*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these comments needed?

"""
if FLAGS.enable_gpu:
df += install_dcgm_libraries(argmap["DCGM_VERSION"], target_machine())
df += """
ENV TRITON_SERVER_VERSION ${TRITON_VERSION}
ENV NVIDIA_TRITON_SERVER_VERSION ${TRITON_CONTAINER_VERSION}
"""

df += """
WORKDIR /workspace
RUN rm -fr *
COPY . .
ENTRYPOINT []
"""

with open(os.path.join(ddir, dockerfile_name), "w") as dfile:
dfile.write(df)


def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
df = """
ARG TRITON_VERSION={}
ARG TRITON_CONTAINER_VERSION={}
ARG BASE_IMAGE={}
""".format(
argmap["TRITON_VERSION"],
argmap["TRITON_CONTAINER_VERSION"],
argmap["BASE_IMAGE"],
)

df += """
FROM ${BASE_IMAGE}

ARG TRITON_VERSION
ARG TRITON_CONTAINER_VERSION
"""
df += """
# Install docker docker buildx
RUN yum install -y ca-certificates curl gnupg yum-utils \\
&& yum-config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo \\
&& yum install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
# && yum install -y docker.io docker-buildx-plugin

# libcurl4-openSSL-dev is needed for GCS
# python3-dev is needed by Torchvision
# python3-pip and libarchive-dev is needed by python backend
# libxml2-dev is needed for Azure Storage
# scons is needed for armnn_tflite backend build dep
RUN yum install -y \\
ca-certificates \\
autoconf \\
automake \\
git \\
gperf \\
re2-devel \\
openssl-devel \\
libtool \\
libcurl-devel \\
libb64-devel \\
gperftools-devel \\
patchelf \\
python3.11-devel \\
python3-pip \\
python3-setuptools \\
rapidjson-devel \\
python3-scons \\
pkg-config \\
unzip \\
wget \\
zlib-devel \\
libarchive-devel \\
libxml2-devel \\
numactl-devel \\
wget

RUN pip3 install --upgrade pip \\
&& pip3 install --upgrade \\
wheel \\
setuptools \\
docker \\
virtualenv

# Install boost version >= 1.78 for boost::span
# Current libboost-dev apt packages are < 1.78, so install from tar.gz
RUN wget -O /tmp/boost.tar.gz \\
https://archives.boost.io/release/1.80.0/source/boost_1_80_0.tar.gz \\
&& (cd /tmp && tar xzf boost.tar.gz) \\
&& mv /tmp/boost_1_80_0/boost /usr/include/boost

# Server build requires recent version of CMake (FetchContent required)
# Might not need this if the installed version of cmake is high enough for our build.
# RUN apt update -q=2 \\
# && apt install -y gpg wget \\
# && wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null \\
# && . /etc/os-release \\
# && echo "deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ $UBUNTU_CODENAME main" | tee /etc/apt/sources.list.d/kitware.list >/dev/null \\
# && apt-get update -q=2 \\
# && apt-get install -y --no-install-recommends cmake=3.27.7* cmake-data=3.27.7*
"""
if FLAGS.enable_gpu:
df += install_dcgm_libraries(argmap["DCGM_VERSION"], target_machine())
df += """
ENV TRITON_SERVER_VERSION ${TRITON_VERSION}
ENV NVIDIA_TRITON_SERVER_VERSION ${TRITON_CONTAINER_VERSION}
"""

df += """
WORKDIR /workspace
RUN rm -fr *
COPY . .
ENTRYPOINT []
"""

with open(os.path.join(ddir, dockerfile_name), "w") as dfile:
dfile.write(df)


def create_dockerfile_buildbase_rhel(ddir, dockerfile_name, argmap):
df = """
ARG TRITON_VERSION={}
Expand Down Expand Up @@ -1301,7 +1503,6 @@ def dockerfile_prepare_container_linux(argmap, backends, enable_gpu, target_mach
gpu_enabled=gpu_enabled
)

# This
if target_platform() == "rhel":
df += """
# Common dpeendencies.
Expand Down Expand Up @@ -1816,6 +2017,12 @@ def core_build(
os.path.join(repo_install_dir, "lib", "tritonserver.lib"),
os.path.join(install_dir, "bin"),
)
elif target_platform() == "rhel":
cmake_script.mkdir(os.path.join(install_dir, "bin"))
cmake_script.cp(
os.path.join(repo_install_dir, "bin", "tritonserver"),
os.path.join(install_dir, "bin"),
)
elif target_platform() == "rhel":
cmake_script.mkdir(os.path.join(install_dir, "bin"))
cmake_script.cp(
Expand Down
Loading