Skip to content

Commit

Permalink
Undo C++ client checks and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yinggeh committed Jul 31, 2024
1 parent 60f3f52 commit 2a5c507
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 355 deletions.
12 changes: 0 additions & 12 deletions src/c++/library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,6 @@ if(TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER)
grpcclient_static
PRIVATE gRPC::grpc++
PRIVATE gRPC::grpc
PRIVATE triton-common-model-config
PUBLIC protobuf::libprotobuf
PUBLIC Threads::Threads
)
Expand Down Expand Up @@ -252,7 +251,6 @@ if(TRITON_ENABLE_CC_GRPC OR TRITON_ENABLE_PERF_ANALYZER)
grpcclient
PRIVATE gRPC::grpc++
PRIVATE gRPC::grpc
PRIVATE triton-common-model-config
PUBLIC protobuf::libprotobuf
PUBLIC Threads::Threads
)
Expand Down Expand Up @@ -378,10 +376,6 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
http-client-library EXCLUDE_FROM_ALL OBJECT
${REQUEST_SRCS} ${REQUEST_HDRS}
)
add_dependencies(
http-client-library
proto-library
)

if (NOT WIN32)
set_property(
Expand All @@ -394,14 +388,12 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
http-client-library
PUBLIC
triton-common-json # from repo-common
triton-common-model-config
)

# libhttpclient_static.a
add_library(
httpclient_static STATIC
$<TARGET_OBJECTS:http-client-library>
$<TARGET_OBJECTS:proto-library>
)
add_library(
TritonClient::httpclient_static ALIAS httpclient_static
Expand All @@ -410,7 +402,6 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
target_link_libraries(
httpclient_static
PRIVATE triton-common-json
PRIVATE triton-common-model-config
PUBLIC CURL::libcurl
PUBLIC Threads::Threads
)
Expand All @@ -426,7 +417,6 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
add_library(
httpclient SHARED
$<TARGET_OBJECTS:http-client-library>
$<TARGET_OBJECTS:proto-library>
)
add_library(
TritonClient::httpclient ALIAS httpclient
Expand All @@ -444,7 +434,6 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
target_link_libraries(
httpclient
PRIVATE triton-common-json
PRIVATE triton-common-model-config
PUBLIC CURL::libcurl
PUBLIC Threads::Threads
)
Expand All @@ -470,7 +459,6 @@ if(TRITON_ENABLE_CC_HTTP OR TRITON_ENABLE_PERF_ANALYZER)
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<TARGET_PROPERTY:CURL::libcurl,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:proto-library,INCLUDE_DIRECTORIES>
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
Expand Down
26 changes: 1 addition & 25 deletions src/c++/library/common.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2020-2023, 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 @@ -26,10 +26,6 @@

#include "common.h"

#include <numeric>

#include "triton/common/model_config.h"

namespace triton { namespace client {

//==============================================================================
Expand Down Expand Up @@ -236,26 +232,6 @@ InferInput::SetBinaryData(const bool binary_data)
return Error::Success;
}

Error
InferInput::ValidateData() const
{
inference::DataType datatype =
triton::common::ProtocolStringToDataType(datatype_);
// String inputs will be checked at core and backend to reduce overhead.
if (datatype == inference::DataType::TYPE_STRING) {
return Error::Success;
}

int64_t expected_byte_size = triton::common::GetByteSize(datatype, shape_);
if ((int64_t)byte_size_ != expected_byte_size) {
return Error(
"input '" + name_ + "' got unexpected byte size " +
std::to_string(byte_size_) + ", expected " +
std::to_string(expected_byte_size));
}
return Error::Success;
}

Error
InferInput::PrepareForRequest()
{
Expand Down
6 changes: 1 addition & 5 deletions src/c++/library/common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2020-2023, 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 @@ -354,10 +354,6 @@ class InferInput {
/// \return Error object indicating success or failure.
Error SetBinaryData(const bool binary_data);

/// Validate input has data and input shape matches input data.
/// \return Error object indicating success of failure.
Error ValidateData() const;

private:
#ifdef TRITON_INFERENCE_SERVER_CLIENT_CLASS
friend class TRITON_INFERENCE_SERVER_CLIENT_CLASS;
Expand Down
8 changes: 1 addition & 7 deletions src/c++/library/grpc_client.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2020-2023, 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 @@ -1470,13 +1470,7 @@ InferenceServerGrpcClient::PreRunProcessing(

int index = 0;
infer_request_.mutable_raw_input_contents()->Clear();
Error err;
for (const auto input : inputs) {
err = input->ValidateData();
if (!err.IsOk()) {
return err;
}

// Add new InferInputTensor submessages only if required, otherwise
// reuse the submessages already available.
auto grpc_input = (infer_request_.inputs().size() <= index)
Expand Down
7 changes: 1 addition & 6 deletions src/c++/library/http_client.cc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// Copyright 2020-2023, 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 @@ -2116,11 +2116,6 @@ InferenceServerHttpClient::PreRunProcessing(
// Add the buffers holding input tensor data
bool all_inputs_are_json{true};
for (const auto this_input : inputs) {
err = this_input->ValidateData();
if (!err.IsOk()) {
return err;
}

if (this_input->BinaryData()) {
all_inputs_are_json = false;
}
Expand Down
33 changes: 1 addition & 32 deletions src/c++/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2020-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2020-2022, 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 @@ -70,9 +70,6 @@ install(
RUNTIME DESTINATION bin
)

#
# cc_client_test
#
add_executable(
cc_client_test
cc_client_test.cc
Expand All @@ -92,34 +89,6 @@ install(
RUNTIME DESTINATION bin
)

#
# client_input_test
#
add_executable(
client_input_test
client_input_test.cc
$<TARGET_OBJECTS:shm-utils-library>
)
target_include_directories(
client_input_test
PRIVATE
${GTEST_INCLUDE_DIRS}
)
target_link_libraries(
client_input_test
PRIVATE
grpcclient_static
httpclient_static
gtest
${GTEST_LIBRARY}
${GTEST_MAIN_LIBRARY}
GTest::gmock
)
install(
TARGETS client_input_test
RUNTIME DESTINATION bin
)

endif() # TRITON_ENABLE_CC_HTTP AND TRITON_ENABLE_CC_GRPC

endif()
Loading

0 comments on commit 2a5c507

Please sign in to comment.