Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
216 commits
Select commit Hold shift + click to select a range
6043492
Add readme
wphicks Sep 7, 2021
fde4f80
Add README
wphicks Sep 7, 2021
b4fb8da
Move basic parts into new repo
wphicks Aug 17, 2021
124b192
Add license and readme
wphicks Aug 17, 2021
f0e1691
Add Triton ModelState interface
wphicks Aug 17, 2021
c20fa75
Provide API interface for everything except execution
wphicks Aug 18, 2021
c340158
Begin batch implementation
wphicks Aug 18, 2021
f4afbbb
Use collector and responder for Batch
wphicks Aug 18, 2021
ce34244
Add configuration reading to shared state
wphicks Aug 24, 2021
7369b4e
Provide basics of API functions for models
wphicks Aug 25, 2021
995b70b
Set up output synchronization
wphicks Aug 26, 2021
27e9b8a
Set up CMake infrastructure
wphicks Aug 26, 2021
4f29cc7
Add basic test
wphicks Aug 26, 2021
6581f45
Add build control test
wphicks Aug 26, 2021
347fb1d
Bring in Triton dependencies
wphicks Aug 26, 2021
58ab757
Add tests for exceptions
wphicks Aug 27, 2021
2e318df
Test narrow
wphicks Aug 27, 2021
ee6c09e
Test memory allocation functions
wphicks Aug 27, 2021
f05351f
Test memory copy functions
wphicks Aug 27, 2021
28cccdd
Add buffer tests
wphicks Aug 27, 2021
b3300f6
Test dtype
wphicks Aug 27, 2021
a46a503
Test Tensor objects
wphicks Aug 30, 2021
56de966
Add test skeleton for all Triton headers
wphicks Aug 30, 2021
c0a4023
Add tests for logging
wphicks Aug 30, 2021
d8177cd
Add tests for Batch
wphicks Aug 30, 2021
23041d8
Properly encapsulate state types in Batch
wphicks Aug 30, 2021
2933d20
Begin adding statistics reporting
wphicks Aug 31, 2021
ec7c42f
Refactor API logic into library
wphicks Aug 31, 2021
b8178dc
Correct batch statistics reporting call
wphicks Aug 31, 2021
af258c9
Add Triton API tests
wphicks Aug 31, 2021
e70732a
Re-enable execute tests
wphicks Aug 31, 2021
75295c3
Correctly handle const in input types
wphicks Aug 31, 2021
f561f4c
Clean up log message construction
wphicks Aug 31, 2021
541d682
Reorganize and simplify example backend
wphicks Sep 1, 2021
b951775
Add complete compilation of backend library
wphicks Sep 2, 2021
5927547
Do not access moved-from object
wphicks Sep 2, 2021
d0ecbc9
Improve logging for type mismatches
wphicks Sep 2, 2021
abd6e9e
Redo output shape determination code
wphicks Sep 3, 2021
75e55d8
Default to running example server in Dockerfile
wphicks Sep 7, 2021
482b157
Begin filling out docs
wphicks Sep 7, 2021
ddcd1c0
Add basics from identity example
wphicks Sep 7, 2021
c256fe1
Correct parameter fetching logic
wphicks Sep 8, 2021
78b0777
Add stream interface for logging
wphicks Sep 8, 2021
ed47a54
Clean up const declarations in logging
wphicks Sep 8, 2021
ff2032a
Provide shared state example docs
wphicks Sep 8, 2021
c91cd94
Add missing load in instance initialization
wphicks Sep 8, 2021
17e9024
Add move assignment operator to Buffer
wphicks Sep 8, 2021
78dcb56
Add Buffer move assignment test
wphicks Sep 8, 2021
95f2068
Fill out model loading implementation
wphicks Sep 9, 2021
2d6d53c
Use default move operators for Buffer
wphicks Sep 10, 2021
7f67234
Add full prediction logic
wphicks Sep 10, 2021
6d42da2
Add Python testing package
wphicks Sep 10, 2021
19fa354
Remove circular import
wphicks Sep 10, 2021
15b36ed
Use find_packages correctly
wphicks Sep 10, 2021
720c64f
Add example models
wphicks Sep 10, 2021
74adfe5
Add conclusion
wphicks Sep 10, 2021
deaa77f
Correct logging message in get_random_seed
wphicks Sep 10, 2021
7f5533d
Add links to Triton docs
wphicks Sep 10, 2021
c29835f
Add E2E tests
wphicks Sep 10, 2021
2d97788
Remove copied comments
wphicks Sep 10, 2021
0a6e939
Add contributing and usage docs
wphicks Sep 10, 2021
1241f0b
Fix style
wphicks Sep 10, 2021
cf75925
Use remove_const_t where useful
wphicks Sep 20, 2021
dc6f4fe
Use is_same_v where useful
wphicks Sep 20, 2021
a83f136
Use is_same_v where useful
wphicks Sep 20, 2021
4fc3028
Use braced initialization more consistently
wphicks Sep 20, 2021
17b8499
Add C++ linting infrastructure
wphicks Sep 20, 2021
31d60fc
Use braced initialization where possible
wphicks Sep 20, 2021
b7787c1
Correct copyright year in cpp/CMakeLists.txt
wphicks Sep 20, 2021
78f219c
Make use of rapids_cmake_install_lib_dir
wphicks Sep 20, 2021
b746943
Add comment on thrust inclusion
wphicks Sep 20, 2021
467360e
Make use of rapids-cmake for gtest and rmm
wphicks Sep 20, 2021
bb73c2a
Eliminate unnecessary Thrust inclusion
wphicks Sep 20, 2021
d1c29ec
Link to Triton from README
wphicks Sep 20, 2021
39d5e5d
Add logging of Triton-specific build options
wphicks Sep 20, 2021
b7e0abc
Correct copyright year range
wphicks Sep 20, 2021
4b3d857
Add CUDA 11.2 development environment
wphicks Sep 20, 2021
0859765
Force double linebreak with spaces in DCO
wphicks Sep 20, 2021
1b83010
Correct mismatched copyright headers
wphicks Sep 20, 2021
0b6d1d3
Add missing client definition in README code
wphicks Sep 21, 2021
e0aa081
Pass optional by reference
wphicks Sep 22, 2021
8a2e3c3
Pass optionals by reference
wphicks Sep 22, 2021
207d154
Correct typo in Tensor documentation
wphicks Sep 22, 2021
7ddc0af
Explicitly label auto pointers
wphicks Sep 22, 2021
9786d1a
Explicitly label auto pointer
wphicks Sep 22, 2021
07ea40b
Explicitly label auto pointer
wphicks Sep 22, 2021
e2d3026
Allow modifications on state in get_stream
wphicks Sep 22, 2021
05b50b2
Construct closures for Batch separately
wphicks Sep 23, 2021
b9a9ef6
Change const model to allow for stream-related state
wphicks Sep 23, 2021
e3803c2
Revert "Change const model to allow for stream-related state"
wphicks Sep 27, 2021
37f9879
Make get_stream a const function for Model
wphicks Sep 27, 2021
35a1266
Allow construction of Buffer<T const> from Buffer<T const>
wphicks Sep 27, 2021
0a533f1
Fix syntax error
wphicks Sep 27, 2021
e8e4032
Update Greek characters for MD rendering
wphicks Sep 28, 2021
420f621
Add option to squeeze output shape
wphicks Sep 28, 2021
11ff73b
Actually erase elements during squeeze
wphicks Sep 28, 2021
9480c1b
Appropriately handle null response pointer
wphicks Oct 4, 2021
a048a72
Correct syntax error in log statement
wphicks Oct 4, 2021
3f6c0cc
Check for issues with input/output collation
wphicks Oct 4, 2021
edad156
Add warning about shared memory
wphicks Oct 5, 2021
ac4b36c
Move to RMM for device memory management
wphicks Oct 7, 2021
d7f26d4
Remove unused allocation code
wphicks Oct 7, 2021
db791de
Add code for handling memory managers
wphicks Oct 7, 2021
43d89c6
Rename header for memory management
wphicks Oct 7, 2021
7e21f78
Adjust naming convention for memory management
wphicks Oct 7, 2021
b523ee4
Refactor owned device pointer implementation
wphicks Oct 8, 2021
1688563
Introduce triton_memory_resource for management
wphicks Oct 8, 2021
e8f0dd3
Correct move implementations for owned_d_buffer
wphicks Oct 8, 2021
def5d86
Update memory resource tests
wphicks Oct 8, 2021
d81e6ef
Update behavior of do_get_mem_info
wphicks Oct 8, 2021
a08afc6
Update to Triton 21.09
wphicks Oct 11, 2021
b4cd889
Update Triton bug warning
wphicks Oct 11, 2021
334b504
Update rapids::copy to allow template param omission
wphicks Oct 11, 2021
54f1815
Fix style
wphicks Oct 11, 2021
c6c2aa7
Provide complete initial implementation of RAPIDS-Triton
wphicks Oct 11, 2021
2c4c1d1
Provide basic usage information
wphicks Oct 12, 2021
5421381
Provide basic usage information
wphicks Oct 12, 2021
6ba3e8e
Update default install prefix
wphicks Oct 12, 2021
9cbfe04
Upgrade to Triton 21.09
wphicks Oct 12, 2021
b7b5165
Use AAA style in loop
wphicks Oct 12, 2021
81846b0
Disable shared memory tests until after 21.10
wphicks Oct 12, 2021
eba3429
Specify Triton repo versions in Dockerfile
wphicks Oct 12, 2021
8c67ff4
Correct stream handling
wphicks Oct 12, 2021
c04d920
Always set device for execution and initialization
wphicks Oct 12, 2021
1fe80cb
Revert "Update to Triton 21.09"
wphicks Oct 12, 2021
6e3d231
Revert to Triton 21.08
wphicks Oct 12, 2021
9086c34
Revert to Triton 21.08 and pin RAPIDS-Triton to main
wphicks Oct 13, 2021
1a0c2b7
Update docs based on RAPIDS-Triton main
wphicks Oct 13, 2021
9956c9f
Provide initial implementation of full example
wphicks Oct 13, 2021
f963b46
Update batch logic for new pinned memory default
wphicks Oct 19, 2021
5419f29
Update batch logic for new pinned memory default
wphicks Oct 19, 2021
dd2b509
Pin to RAPIDS-Triton 21.10
wphicks Oct 21, 2021
4dfe79e
Merge pull request #2 from rapidsai/fea-pin_2110
wphicks Oct 22, 2021
6d3d7cc
Remove unnecessary cudaSetDevice calls
wphicks Oct 26, 2021
bb89a57
Merge pull request #3 from rapidsai/fea-unnecessary_set_device
wphicks Oct 27, 2021
6522ce6
Provide initial CPU-only implementation
wphicks Nov 15, 2021
c43b35f
Update unit tests for CPU-only build
wphicks Nov 16, 2021
394e2a7
Add usage information on CPU-only helpers
wphicks Nov 16, 2021
e9cf10d
Add build script
wphicks Nov 16, 2021
5b87634
Provide working build/tests for CPU-only mode
wphicks Nov 18, 2021
30bb810
Remove logs directory
wphicks Nov 18, 2021
f6b02cd
Enable ccache
wphicks Nov 18, 2021
f01823c
Make cleaner use of cmake generator expressions
wphicks Nov 22, 2021
2aed622
Remove debug ccache reporting
wphicks Nov 22, 2021
47c808d
Remove GPU restriction on C++ standard
wphicks Nov 23, 2021
4d01da3
Remove old commented-out code
wphicks Dec 1, 2021
2009803
Remove unnecessary capture from lambda
wphicks Dec 1, 2021
4efd4de
Enable CPU-only build
wphicks Dec 2, 2021
5a7f8f6
Do not require nvcc in CPU-only environments
wphicks Dec 8, 2021
60fe5e8
Appropriately guard cuda_std command in CPU-only build
wphicks Dec 8, 2021
beb5526
Correct CMake generator expression
wphicks Dec 8, 2021
75f9b22
Disable cuda build standard differently
wphicks Dec 8, 2021
6f915e6
Correct generator expression
wphicks Dec 8, 2021
47782dc
Guard against CUDA shared memory import on CPU-only machine
wphicks Dec 9, 2021
03a5977
Guard against missed cuda_shared_memory import
wphicks Dec 9, 2021
3a05c3b
Provide better error messages for import failures
wphicks Dec 10, 2021
51bb797
Merge pull request #11 from rapidsai/bug-cpu_cmake
wphicks Dec 13, 2021
ec154f1
Update version numbers for 21.12 release
wphicks Dec 13, 2021
ff82f51
Merge pull request #12 from rapidsai/fea-2112_version_bumps
wphicks Dec 17, 2021
1b953ba
Update versions of upstream RAPIDS libraries
wphicks Jan 21, 2022
4aac005
Remove no-cache debug lines
wphicks Jan 21, 2022
8ff2a8d
Merge pull request #14 from rapidsai/fea-2202_version_bump
wphicks Jan 24, 2022
c77b633
Add asynchronous prediction to RAPIDS-Triton client
wphicks Jan 27, 2022
0817313
Add multimodel evaluation helper
wphicks Feb 2, 2022
037770e
Add multimodel tests
wphicks Feb 2, 2022
c44ff36
Add placeholder files for model directories
wphicks Feb 2, 2022
af10cf7
Remove unused parameter
wphicks Feb 2, 2022
5bc5164
Remove unused device_id parameters
wphicks Feb 2, 2022
34c9def
Only add callback when necessary to release I/O
wphicks Feb 4, 2022
775eadc
Fix syntax error
wphicks Feb 4, 2022
44c57a8
Update python/rapids_triton/utils/safe_import.py
wphicks Feb 7, 2022
301cdd5
Update function name to reflect asynchronicity
wphicks Feb 7, 2022
43771e9
Initial code
divyegala Feb 9, 2022
8631a18
Apply suggestions from code review
divyegala Feb 22, 2022
60f5e8b
name check in get output shape
divyegala Feb 22, 2022
f6eb932
Merge branch 'input-by-name' of github.com:divyegala/rapids-triton in…
divyegala Feb 22, 2022
e18e9f4
temporarily using lower bound instead of binary search
divyegala Feb 22, 2022
3bd5f1e
review comments
divyegala Feb 24, 2022
a2a6413
Merge pull request #18 from divyegala/input-by-name
wphicks Feb 24, 2022
7c4592e
Merge pull request #15 from rapidsai/fea-async
wphicks Mar 10, 2022
3f61d1a
Upstream rapid-json
GuanLuo Aug 31, 2022
2861873
Replace RAPIDS keyword with developer_tools::backend
GuanLuo Oct 5, 2022
ebbb073
Add CI test for backend unit test
GuanLuo Oct 5, 2022
4b7cd17
Merge RAPIDS-Triton project into developer_tools
wphicks Oct 7, 2022
f7ebb6a
Add initial group of codeowners
wphicks Oct 7, 2022
c9d8cdd
Merge branch 'gluo-backend' into fea-backend
wphicks Oct 7, 2022
5654d51
Remove incorrectly-moved files
wphicks Oct 7, 2022
5720f30
Remove redundant test script
wphicks Oct 7, 2022
2aa2d12
Merge remote-tracking branch 'rapids-triton-le/main' into fea-backend
wphicks Oct 7, 2022
0ee9531
Move linear example to examples directory
wphicks Oct 7, 2022
b497f91
Restore README
wphicks Oct 7, 2022
fb5a3db
Correct global CODEOWNER configuration
wphicks Oct 7, 2022
cb46f12
Replace rapids_triton with triton_backend
wphicks Oct 10, 2022
15a690d
Replace rapids namespace with dev_tools
wphicks Oct 10, 2022
0abaca1
Replace Rapids template names with Backend
wphicks Oct 10, 2022
da604ca
Rewrite comments referencing RAPIDS
wphicks Oct 10, 2022
d476da9
Revert "Replace Rapids template names with Backend"
wphicks Oct 10, 2022
17bebde
Replace Rapids with DevTools in template names
wphicks Oct 10, 2022
e69a803
Update include path for dev_tools
wphicks Oct 10, 2022
399fe74
Update template names to DevTools in identity
wphicks Oct 10, 2022
fa82f5b
Update name of identity backend
wphicks Oct 10, 2022
aff27a0
Update rapids namespace to dev_tools in identity
wphicks Oct 10, 2022
f86e69b
Update CMake variable names
wphicks Oct 10, 2022
386a8eb
Update include path in tests
wphicks Oct 10, 2022
c6da4f2
Update remaining names in tests
wphicks Oct 10, 2022
3143d9a
Update names in cmake
wphicks Oct 10, 2022
793b57d
Update names in Dockerfile and CMakeLists
wphicks Oct 10, 2022
fad694a
Update naming in build scripts
wphicks Oct 10, 2022
47a83f6
Update conda names
wphicks Oct 10, 2022
3fa14a7
Bring in updates from post 22.08 RAPIDS-Triton
wphicks Oct 10, 2022
2dbff7e
Begin filling out top-level README
wphicks Oct 10, 2022
a039d7a
Update conda dependencies
wphicks Dec 15, 2022
b618621
Correctly fetch backend dependencies
wphicks Dec 15, 2022
3d2cf74
Update include paths
wphicks Dec 15, 2022
507e44e
Update namespace for developer_tools
wphicks Dec 15, 2022
1d95ae2
Bump version numbers
wphicks Jan 17, 2023
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
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* @tanmayv25 @GuanLuo
/backend @wphicks @dantegd @divyegala
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/build
/.vscode
*.so
backend/cpp/build
backend/qa/logs
47 changes: 46 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,46 @@
# triton_developer_tools
# Triton Developer Tools
This repository contains tools to make it easier to develop custom C++ backends
for NVIDIA's Triton Inference Server and to use Triton as a library within an
existing C++ project. It consists of two sub-projects:
- [Triton Backend Developer Tools](https://github.com/triton-inference-server/developer_tools/tree/main/backend): A header-only library to make it quick and easy to add high-performance custom functionality to Triton at the C++ level
- Triton Library Developer Tools: Coming soon, this library will allow easy
integration of Triton as a library within other C++ projects

## Backend Developer Tools

### Why might I want to use Triton's Backend Developer Tools?
- You have an inference model which you wish to serve in Triton, but Triton
does not currently support your model type
- You want to add specialized data manipulation logic to Triton and require
performance beyond what the Python backend can provide
- You want to ensure that your custom C++ backend stays up-to-date with the
latest Triton performance features

### Why might I _not_ want to use Triton's Backend Developer Tools?
- The functionality you're looking for is already provided by an existing
Triton backend
- You want to write your additional logic in Python rather than C++

### Example
To create a custom backend with Triton's Backend Developer Tools, you can
make use of the Backend Template (TODO(wphicks): link) and have a working
Triton backend in minutes. For example, consider a simple example of a backend
that simply returns any array of floats provided as input. In order to create
such a backend, the only code we would have to write would be the
following `predict` method:
```
void predict(dev_tools::Batch& batch) const {
dev_tools::Tensor<float> input = get_input<float>(batch, "input__0");
dev_tools::Tensor<float> output = get_output<float>(batch, "output__0");

dev_tools::copy(output, input);

output.finalize();
}
```
For a complete walkthrough of this example and much more detail on how to add
your own functionality to Triton, check out the Backend Developer Tools docs
TODO(wphicks): Link.

## Library Developer Tools
TODO(wphicks)
1 change: 1 addition & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cpp/build
93 changes: 93 additions & 0 deletions backend/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<!--
Copyright (c) 2021, NVIDIA CORPORATION.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- TODO(wphicks): Add more detail -->
# Contributing to RAPIDS-Triton

You can help improve RAPIDS-Triton in any of the following ways:
- Submitting a bug report, feature request or documentation issue
- Proposing and implementing a new feature
- Implementing a feature or bug-fix for an outstanding issue

## Bug reports
When submitting a bug report, please include a *minimum* *reproducible*
example. Ideally, this should be a snippet of code that other developers can
copy, paste, and immediately run to try to reproduce the error. Please:
- Do include import statements and any other code necessary to immediately run
your example
- Avoid examples that require other developers to download models or data
unless you cannot reproduce the problem with synthetically-generated data

## Code Contributions
To contribute code to this project, please follow these steps:
1. Find an issue to work on or submit an issue documenting the problem you
would like to work on.
2. Comment on the issue saying that you plan to work on it.
3. Review the conventions below for information to help you make your changes
in a way that is consistent with the rest of the codebase.
4. Code!
5. Create your pull request.
6. Wait for other developers to review your code and update your PR as needed.
7. Once a PR is approved, it will be merged into the main branch.

### Coding Conventions
* RAPIDS-Triton follows [Almost Always Auto
(AAA)](https://herbsutter.com/2013/08/12/gotw-94-solution-aaa-style-almost-always-auto/)
style. Please maintain this style in any contributions, with the possible
exception of some docs, where type information may be helpful for new users
trying to understand a snippet in isolation.
* Avoid raw loops where possible.
* C++ versions of types should be used instead of C versions except when
interfacing with C code (e.g. use `std::size_t` instead of `size_t`).
* Avoid using output pointers in function signatures. Prefer instead to
actually return the value computed by the function and take advantage of
return value optimization and move semantics.

### Signing Your Work
* We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
* Any contribution which contains commits that are not Signed-Off will not be accepted.
* To sign off on a commit you simply use the `--signoff` (or `-s`) option when committing your changes:
```bash
$ git commit -s -m "Add cool feature."
```
This will append the following to your commit message:
```
Signed-off-by: Your Name <your@email.com>
```
* Full text of the DCO:
```
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.

(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
```
128 changes: 128 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

###########################################################################################
# Arguments for controlling build details
###########################################################################################
# Version of Triton to use
ARG TRITON_VERSION=22.12
# Base container image
ARG BASE_IMAGE=nvcr.io/nvidia/tritonserver:${TRITON_VERSION}-py3
# Whether or not to build indicated components
ARG BUILD_TESTS=OFF
ARG BUILD_EXAMPLE=ON
# Whether or not to enable GPU build
ARG TRITON_ENABLE_GPU=ON

FROM ${BASE_IMAGE} as base

ENV PATH="/root/miniconda3/bin:${PATH}"

RUN apt-get update \
&& apt-get install --no-install-recommends -y wget patchelf \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*

ENV PYTHONDONTWRITEBYTECODE=true

RUN wget \
https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \
&& mkdir /root/.conda \
&& bash Miniconda3-latest-Linux-x86_64.sh -b \
&& rm -f Miniconda3-latest-Linux-x86_64.sh

COPY ./conda/environments/triton_backend.yml /environment.yml

RUN conda env update -f /environment.yml \
&& rm /environment.yml \
&& conda clean -afy \
&& find /root/miniconda3/ -follow -type f -name '*.pyc' -delete \
&& find /root/miniconda3/ -follow -type f -name '*.js.map' -delete

ENV PYTHONDONTWRITEBYTECODE=false

SHELL ["conda", "run", "--no-capture-output", "-n", "triton_backend_dev", "/bin/bash", "-c"]

FROM base as build-stage

COPY ./cpp /triton_backend

ARG TRITON_VERSION
ENV TRITON_VERSION=$TRITON_VERSION

ARG BUILD_TYPE=Release
ENV BUILD_TYPE=$BUILD_TYPE
ARG BUILD_TESTS
ENV BUILD_TESTS=$BUILD_TESTS
ARG BUILD_EXAMPLE
ENV BUILD_EXAMPLE=$BUILD_EXAMPLE
ARG TRITON_ENABLE_GPU
ENV TRITON_ENABLE_GPU=$TRITON_ENABLE_GPU

RUN mkdir /triton_backend/build

WORKDIR /triton_backend/build

RUN cmake \
-GNinja \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS="${BUILD_TESTS}" \
-DBUILD_EXAMPLE="${BUILD_EXAMPLE}" \
-DTRITON_ENABLE_GPU="${TRITON_ENABLE_GPU}" \
..

ENV CCACHE_DIR=/ccache

RUN --mount=type=cache,target=/ccache/ ninja install

FROM base as test-install

COPY ./conda/environments/triton_backend_test.yml /environment.yml

RUN conda env update -f /environment.yml \
&& rm /environment.yml \
&& conda clean -afy \
&& find /root/miniconda3/ -follow -type f -name '*.pyc' -delete \
&& find /root/miniconda3/ -follow -type f -name '*.js.map' -delete

COPY ./python /triton_backend

RUN conda run -n triton_backend_test pip install /triton_backend \
&& rm -rf /triton_backend

FROM build-stage as test-stage

COPY --from=test-install /root/miniconda3 /root/miniconda3

ENV TEST_EXE=/triton_backend/build/test_triton_backend

COPY qa /qa

ENTRYPOINT ["conda", "run", "--no-capture-output", "-n", "triton_backend_test", "/bin/bash", "/qa/entrypoint.sh"]

FROM ${BASE_IMAGE}

RUN mkdir /models

# Remove existing backend install
RUN if [ -d /opt/tritonserver/backends/dev_tools-identity ]; \
then \
rm -rf /opt/tritonserver/backends/dev_tools-identity/*; \
fi

COPY --from=build-stage \
/opt/tritonserver/backends/dev_tools-identity \
/opt/tritonserver/backends/dev_tools-identity

ENTRYPOINT ["tritonserver", "--model-repository=/models"]
Loading