Skip to content

Commit 2db368c

Browse files
Add RPC client
1 parent 736a9df commit 2db368c

File tree

9 files changed

+494
-40
lines changed

9 files changed

+494
-40
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@
1717
*.dylib
1818
*.dll
1919

20-
# Fortran module files
21-
*.mod
22-
*.smod
23-
2420
# Compiled Static libraries
2521
*.lai
2622
*.la

CMakeLists.txt

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ set_target_properties(nn-scaler PROPERTIES
228228
# RPC Server
229229

230230
if (WITH_RPC_SERVICE)
231-
232231
add_library(scaler-proto OBJECT scaler_server.proto)
233232
target_link_libraries(scaler-proto PUBLIC protobuf::libprotobuf gRPC::grpc++)
234233

@@ -266,6 +265,21 @@ if (WITH_RPC_SERVICE)
266265
target_link_libraries(nn-scaler-server PUBLIC _onnx_parser_shim)
267266
endif ()
268267

268+
add_executable(nn-scaler-client scaler_client.cpp)
269+
target_link_libraries(nn-scaler-client PUBLIC
270+
scaler-proto
271+
272+
absl::flags
273+
absl::flags_parse
274+
absl::flags_usage
275+
276+
absl::log
277+
absl::log_flags
278+
absl::log_initialize
279+
)
280+
set_target_properties(nn-scaler-client PROPERTIES
281+
OUTPUT_NAME NNScalerClient
282+
)
269283
endif ()
270284

271285
# Model inspector

cmd_common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "infer_engine.h"
1414
#include "reformat/reformat.h"
1515
#include "image_io.h"
16-
#include "logging.h"
16+
#include "logging_trt.h"
1717

1818
#ifdef _WIN32
1919
#define NOMINMAX

logging.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
#include <filesystem>
44

5-
#include "NvInferRuntimeCommon.h"
6-
75
#include "absl/flags/flag.h"
86
#include "absl/flags/declare.h"
97
#include "absl/log/log.h"
@@ -16,31 +14,6 @@ inline bool should_log_at(int n) {
1614

1715
#define VLOG(n) LOG_IF(INFO, should_log_at(n))
1816

19-
using Severity = nvinfer1::ILogger::Severity;
20-
21-
class Logger : public nvinfer1::ILogger {
22-
public:
23-
void log(Severity severity, const char *msg) noexcept override {
24-
switch (severity) {
25-
case Severity::kINTERNAL_ERROR:
26-
LOG(FATAL) << "[TRT] " << msg;
27-
break;
28-
case Severity::kERROR:
29-
LOG(ERROR) << "[TRT] " << msg;
30-
break;
31-
case Severity::kWARNING:
32-
LOG(WARNING) << "[TRT] " << msg;
33-
break;
34-
case Severity::kINFO:
35-
VLOG(2) << "[TRT] [I] " << msg;
36-
break;
37-
case Severity::kVERBOSE:
38-
VLOG(4) << "[TRT] [V] " << msg;
39-
break;
40-
}
41-
}
42-
};
43-
4417
static std::string u8s(const std::filesystem::path& p) {
4518
#ifdef _WIN32
4619
#ifdef __cpp_lib_char8_t

logging_trt.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#pragma once
2+
3+
#include "logging.h"
4+
5+
#include "NvInferRuntimeCommon.h"
6+
7+
using Severity = nvinfer1::ILogger::Severity;
8+
9+
class Logger : public nvinfer1::ILogger {
10+
public:
11+
void log(Severity severity, const char *msg) noexcept override {
12+
switch (severity) {
13+
case Severity::kINTERNAL_ERROR:
14+
LOG(FATAL) << "[TRT] " << msg;
15+
break;
16+
case Severity::kERROR:
17+
LOG(ERROR) << "[TRT] " << msg;
18+
break;
19+
case Severity::kWARNING:
20+
LOG(WARNING) << "[TRT] " << msg;
21+
break;
22+
case Severity::kINFO:
23+
VLOG(2) << "[TRT] [I] " << msg;
24+
break;
25+
case Severity::kVERBOSE:
26+
VLOG(4) << "[TRT] [V] " << msg;
27+
break;
28+
}
29+
}
30+
};

0 commit comments

Comments
 (0)