Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into yinggeh-DLIS-6657-client-input-byte-size-check
  • Loading branch information
yinggeh committed Jul 31, 2024
2 parents 8b699c0 + 86a0d09 commit 60f3f52
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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}
Expand Down
104 changes: 103 additions & 1 deletion src/c++/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
$<TARGET_OBJECTS:json-utils-library>
)

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
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/W0 /D_WIN32_WINNT=0x0A00 /EHsc>
)

set_target_properties(
${_json_target}
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

target_include_directories(
${_json_target}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
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
Expand All @@ -75,6 +126,56 @@ target_link_libraries(
client-common-library
)

add_library(
shm_utils_static STATIC
$<TARGET_OBJECTS:shm-utils-library>
)

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
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
-Wall -Wextra -Wno-unused-parameter -Werror>
$<$<CXX_COMPILER_ID:MSVC>:/W0 /D_WIN32_WINNT=0x0A00 /EHsc>
)

set_target_properties(
${_shm_target}
PROPERTIES
POSITION_INDEPENDENT_CODE ON
)

target_include_directories(
${_shm_target}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
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
Expand Down Expand Up @@ -412,6 +513,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
)

Expand Down
4 changes: 3 additions & 1 deletion src/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")

Expand Down
4 changes: 2 additions & 2 deletions src/python/library/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 2 additions & 2 deletions src/python/library/setup.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 60f3f52

Please sign in to comment.