MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / TEST_F

Function TEST_F

tensorflow/compiler/xrt/client/xrt_client_test.cc:66–97  ·  view source on GitHub ↗

Test some connection basics using XrtGrpcEagerClient directly.

Source from the content-addressed store, hash-verified

64
65// Test some connection basics using XrtGrpcEagerClient directly.
66TEST_F(XrtClientTest, XrtGrpcEagerClientWorks) {
67 ChannelCreationFunction channel_func =
68 ConvertToChannelCreationFunction(NewHostPortGrpcChannel);
69 TF_ASSERT_OK_AND_ASSIGN(std::shared_ptr<GrpcChannelCache> channel_cache,
70 GetGrpcChannelCache(cluster_def_, channel_func));
71 XrtGrpcEagerClientCache client_cache(channel_cache);
72
73 TF_ASSERT_OK_AND_ASSIGN(
74 XrtGrpcEagerClient * client,
75 client_cache.GetClient("/job:localhost/task:0/replica:0"));
76
77 // Create and destroy a context to verify we can make RPCs.
78 eager::CreateContextRequest request;
79 uint64 context_id = random::New64();
80 ServerDef* server_def = request.mutable_server_def();
81 *server_def->mutable_cluster() = cluster_def_;
82 server_def->set_job_name("localhost");
83 server_def->set_protocol("grpc");
84 request.set_keep_alive_secs(60);
85 request.set_context_id(context_id);
86
87 eager::CreateContextResponse create_response;
88 TF_ASSERT_OK(client->SyncCall(&XrtGrpcEagerClient::CreateContextAsync,
89 &request, &create_response));
90
91 eager::CloseContextRequest close_request;
92 close_request.set_context_id(context_id);
93
94 eager::CloseContextResponse close_response;
95 TF_ASSERT_OK(client->SyncCall(&XrtGrpcEagerClient::CloseContextAsync,
96 &close_request, &close_response));
97}
98
99// Tests that we can connect to a server using the higher-level XrtTfClient API,
100// transfer tensors to the device, run an Add operator, and retrieve the result.

Callers 1

MakeContextMethod · 0.70

Calls 15

GetGrpcChannelCacheFunction · 0.85
New64Function · 0.85
MakeAttrValueFunction · 0.85
MakeShapeFunction · 0.85
SyncCallMethod · 0.80
cpu_device_idMethod · 0.80
RecvTensorMethod · 0.80
c_strMethod · 0.80
tuple_shapes_sizeMethod · 0.80
OptionsClass · 0.70
TF_ASSERT_OK_AND_ASSIGNFunction · 0.50

Tested by

no test coverage detected