|
1 | 1 | #!/usr/bin/env python3
|
2 |
| -# Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. |
| 2 | +# Copyright (c) 2020-2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. |
3 | 3 | #
|
4 | 4 | # Redistribution and use in source and binary forms, with or without
|
5 | 5 | # modification, are permitted provided that the following conditions
|
@@ -477,10 +477,21 @@ def dali_cmake_args():
|
477 | 477 | ]
|
478 | 478 |
|
479 | 479 |
|
| 480 | +def install_dcgm_libraries(): |
| 481 | + return ''' |
| 482 | +# Install DCGM |
| 483 | +RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common |
| 484 | +RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin \ |
| 485 | +&& mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 \ |
| 486 | +&& apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub \ |
| 487 | +&& add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" |
| 488 | +RUN apt-get update \ |
| 489 | +&& apt-get install -y datacenter-gpu-manager |
| 490 | +''' |
| 491 | + |
| 492 | + |
480 | 493 | def fil_cmake_args(images):
|
481 |
| - cargs = [ |
482 |
| - '-DTRITON_FIL_DOCKER_BUILD=ON' |
483 |
| - ] |
| 494 | + cargs = ['-DTRITON_FIL_DOCKER_BUILD=ON'] |
484 | 495 | if 'base' in images:
|
485 | 496 | cargs.append('-DTRITON_BUILD_CONTAINER={}'.format(images['base']))
|
486 | 497 | else:
|
@@ -572,12 +583,17 @@ def create_dockerfile_buildbase(ddir, dockerfile_name, argmap, backends):
|
572 | 583 | RUN rm -fr *
|
573 | 584 | COPY . .
|
574 | 585 | ENTRYPOINT []
|
| 586 | +''' |
| 587 | + df += install_dcgm_libraries() |
| 588 | + df += ''' |
| 589 | +RUN patch -ruN -d /usr/include/ < /workspace/build/libdcgm/dcgm_api_export.patch |
575 | 590 | '''
|
576 | 591 |
|
577 | 592 | df += '''
|
578 | 593 | ENV TRITON_SERVER_VERSION ${TRITON_VERSION}
|
579 | 594 | ENV NVIDIA_TRITON_SERVER_VERSION ${TRITON_CONTAINER_VERSION}
|
580 | 595 | '''
|
| 596 | + |
581 | 597 | mkdir(ddir)
|
582 | 598 | with open(os.path.join(ddir, dockerfile_name), "w") as dfile:
|
583 | 599 | dfile.write(df)
|
@@ -668,6 +684,7 @@ def create_dockerfile_linux(ddir, dockerfile_name, argmap, backends, repoagents,
|
668 | 684 | libre2-5 && \
|
669 | 685 | rm -rf /var/lib/apt/lists/*
|
670 | 686 | '''
|
| 687 | + df += install_dcgm_libraries() |
671 | 688 | # Add dependencies needed for python backend
|
672 | 689 | if 'python' in backends:
|
673 | 690 | df += '''
|
@@ -736,7 +753,8 @@ def create_dockerfile_linux(ddir, dockerfile_name, argmap, backends, repoagents,
|
736 | 753 | dfile.write(df)
|
737 | 754 |
|
738 | 755 |
|
739 |
| -def create_dockerfile_windows(ddir, dockerfile_name, argmap, backends, repoagents): |
| 756 | +def create_dockerfile_windows(ddir, dockerfile_name, argmap, backends, |
| 757 | + repoagents): |
740 | 758 | df = '''
|
741 | 759 | #
|
742 | 760 | # Multistage build.
|
@@ -976,15 +994,16 @@ def container_build(images, backends, repoagents, endpoints):
|
976 | 994 | # the install artifacts from the tritonserver_build
|
977 | 995 | # container.
|
978 | 996 | if target_platform() == 'windows':
|
979 |
| - create_dockerfile_windows(FLAGS.build_dir, 'Dockerfile', dockerfileargmap, |
980 |
| - backends, repoagents) |
| 997 | + create_dockerfile_windows(FLAGS.build_dir, 'Dockerfile', |
| 998 | + dockerfileargmap, backends, repoagents) |
981 | 999 | else:
|
982 |
| - create_dockerfile_linux(FLAGS.build_dir, 'Dockerfile', dockerfileargmap, |
983 |
| - backends, repoagents, endpoints) |
| 1000 | + create_dockerfile_linux(FLAGS.build_dir, 'Dockerfile', |
| 1001 | + dockerfileargmap, backends, repoagents, |
| 1002 | + endpoints) |
984 | 1003 | p = subprocess.Popen([
|
985 |
| - 'docker', 'build', '-f', |
986 |
| - os.path.join(FLAGS.build_dir, 'Dockerfile') |
987 |
| - ] + ['-t', 'tritonserver', '.']) |
| 1004 | + 'docker', 'build', '-f', |
| 1005 | + os.path.join(FLAGS.build_dir, 'Dockerfile') |
| 1006 | + ] + ['-t', 'tritonserver', '.']) |
988 | 1007 | p.wait()
|
989 | 1008 | fail_if(p.returncode != 0, 'docker build tritonserver failed')
|
990 | 1009 |
|
|
0 commit comments