From 86a0d096a50db31c482a9e5259a33635f313126f Mon Sep 17 00:00:00 2001 From: Francesco Petrini Date: Mon, 29 Jul 2024 09:15:40 -0700 Subject: [PATCH] Extracted minimum changes from migration branch (#722) Migrate PA Repo w/ Minimum Client changes. --- CMakeLists.txt | 4 ++ src/c++/library/CMakeLists.txt | 106 +++++++++++++++++++++++++++++- src/python/CMakeLists.txt | 4 +- src/python/library/CMakeLists.txt | 4 +- src/python/library/setup.py | 4 +- 5 files changed, 115 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5628f0a27..752dbe79b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,9 @@ option(TRITON_ENABLE_TESTS "Include tests in build" OFF) option(TRITON_ENABLE_GPU "Enable GPU support in libraries" OFF) option(TRITON_ENABLE_ZLIB "Include ZLIB library in build" ON) +# Package Perf Analyzer with the Python Client -- Intended to be used by PA repo +option(TRITON_PACKAGE_PERF_ANALYZER "Include Perf Analyzer in pip wheel" OFF) + set(TRITON_REPO_ORGANIZATION "https://github.com/triton-inference-server" CACHE STRING "Git repository to pull from") set(TRITON_COMMON_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/common repo") set(TRITON_THIRD_PARTY_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/third_party repo") @@ -223,6 +226,7 @@ if(TRITON_ENABLE_PYTHON_HTTP OR TRITON_ENABLE_PYTHON_GRPC) -DTRITON_ENABLE_PERF_ANALYZER_OPENAI:BOOL=${TRITON_ENABLE_PERF_ANALYZER_OPENAI} -DTRITON_ENABLE_EXAMPLES:BOOL=${TRITON_ENABLE_EXAMPLES} -DTRITON_ENABLE_TESTS:BOOL=${TRITON_ENABLE_TESTS} + -DTRITON_PACKAGE_PERF_ANALYZER:BOOL=${TRITON_PACKAGE_PERF_ANALYZER} -DTRITON_ENABLE_GPU:BOOL=${TRITON_ENABLE_GPU} -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${TRITON_INSTALL_PREFIX} diff --git a/src/c++/library/CMakeLists.txt b/src/c++/library/CMakeLists.txt index cdee03e1a..7a62971e5 100644 --- a/src/c++/library/CMakeLists.txt +++ b/src/c++/library/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright (c) 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -60,7 +60,58 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER OR TRITON_ENABLE_EXAMPLE PRIVATE client-common-library ) -endif() + + add_library( + json_utils_static STATIC + $ + ) + + add_library( + TritonClient::json_utils_static ALIAS json_utils_static + ) + + foreach(_json_target json-utils-library json_utils_static) + target_compile_features(${_json_target} PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) + target_compile_options( + ${_json_target} PRIVATE + $<$,$,$>: + -Wall -Wextra -Wno-unused-parameter -Werror> + $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> + ) + + set_target_properties( + ${_json_target} + PROPERTIES + POSITION_INDEPENDENT_CODE ON + ) + + target_include_directories( + ${_json_target} + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/json_utils.h + DESTINATION include + ) + endforeach() + + install( + TARGETS + json_utils_static + EXPORT + triton-client-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + +endif() # TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER OR TRITON_ENABLE_EXAMPLES # # shm_utils @@ -75,6 +126,56 @@ target_link_libraries( client-common-library ) +add_library( + shm_utils_static STATIC + $ +) + +add_library( + TritonClient::shm_utils_static ALIAS shm_utils_static +) + +foreach(_shm_target shm-utils-library shm_utils_static) + target_compile_features(${_shm_target} PRIVATE cxx_std_${TRITON_MIN_CXX_STANDARD}) + target_compile_options( + ${_shm_target} PRIVATE + $<$,$,$>: + -Wall -Wextra -Wno-unused-parameter -Werror> + $<$:/W0 /D_WIN32_WINNT=0x0A00 /EHsc> + ) + + set_target_properties( + ${_shm_target} + PROPERTIES + POSITION_INDEPENDENT_CODE ON + ) + + target_include_directories( + ${_shm_target} + PUBLIC + $ + $ + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + + install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/shm_utils.h + DESTINATION include + ) +endforeach() + +install( + TARGETS + shm_utils_static + EXPORT + triton-client-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) + if(TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER) # # libgrpcclient.so and libgrpcclient_static.a @@ -400,6 +501,7 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER FILES ${CMAKE_CURRENT_SOURCE_DIR}/common.h ${CMAKE_CURRENT_SOURCE_DIR}/ipc.h + ${CMAKE_CURRENT_SOURCE_DIR}/cencode.h DESTINATION include ) diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt index 3725789e0..ecc33b84d 100644 --- a/src/python/CMakeLists.txt +++ b/src/python/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -38,6 +38,8 @@ option(TRITON_ENABLE_PERF_ANALYZER "Enable Performance Analyzer" OFF) option(TRITON_ENABLE_EXAMPLES "Include examples in build" OFF) option(TRITON_ENABLE_TESTS "Include tests in build" OFF) option(TRITON_ENABLE_GPU "Enable GPU support in libraries" OFF) +# Package Perf Analyzer with the Python Client -- Intended to be used by PA repo +option(TRITON_PACKAGE_PERF_ANALYZER "Include Perf Analyzer in pip wheel" OFF) set(TRITON_COMMON_REPO_TAG "main" CACHE STRING "Tag for triton-inference-server/common repo") diff --git a/src/python/library/CMakeLists.txt b/src/python/library/CMakeLists.txt index 87bfd4050..e552ec2f7 100644 --- a/src/python/library/CMakeLists.txt +++ b/src/python/library/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2020-2021, NVIDIA CORPORATION. All rights reserved. +# Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -100,7 +100,7 @@ if (NOT WIN32) ${WHEEL_DEPENDS} ) - if (${TRITON_ENABLE_PERF_ANALYZER}) + if (${TRITON_PACKAGE_PERF_ANALYZER}) set(perf_analyzer_arg --perf-analyzer ${CMAKE_INSTALL_PREFIX}/bin/perf_analyzer) endif() set(linux_wheel_stamp_file "linux_stamp.whl") diff --git a/src/python/library/setup.py b/src/python/library/setup.py index 58cddbecf..e31f5ddc0 100755 --- a/src/python/library/setup.py +++ b/src/python/library/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -82,7 +82,7 @@ def req_file(filename, folder="requirements"): data_files = [ ("", ["LICENSE.txt"]), ] -if (PLATFORM_FLAG != "any") and ("@TRITON_ENABLE_PERF_ANALYZER@" == "ON"): +if (PLATFORM_FLAG != "any") and ("@TRITON_PACKAGE_PERF_ANALYZER@" == "ON"): data_files += [("bin", ["perf_analyzer", "perf_client"])] setup(