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

Function BM_Execute

tensorflow/c/eager/c_api_test.cc:62–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60BENCHMARK(BM_InitOp);
61
62void BM_Execute(int iters, int async) {
63 tensorflow::testing::StopTiming();
64 tensorflow::testing::SetLabel(async ? "ExecuteAsync" : "Execute");
65 TF_Status* status = TF_NewStatus();
66 TFE_ContextOptions* opts = TFE_NewContextOptions();
67 TFE_ContextOptionsSetAsync(opts, static_cast<unsigned char>(async));
68 TFE_Context* ctx = TFE_NewContext(opts, status);
69 CHECK_EQ(TF_OK, TF_GetCode(status)) << TF_Message(status);
70 TFE_DeleteContextOptions(opts);
71
72 TFE_TensorHandle* m = TestMatrixTensorHandle();
73 TFE_Op* matmul = MatMulOp(ctx, m, m);
74 TFE_TensorHandle* retvals[1];
75 int num_retvals = 1;
76 tensorflow::testing::StartTiming();
77 for (int i = 0; i < iters; ++i) {
78 TFE_Execute(matmul, &retvals[0], &num_retvals, status);
79 CHECK_EQ(TF_OK, TF_GetCode(status)) << TF_Message(status);
80 }
81 if (async) {
82 TFE_Executor* executor = TFE_ContextGetExecutorForThread(ctx);
83 TFE_ExecutorWaitForAllPendingNodes(executor, status);
84 ASSERT_EQ(TF_OK, TF_GetCode(status)) << TF_Message(status);
85 TFE_DeleteExecutor(executor);
86 }
87 tensorflow::testing::StopTiming();
88 TFE_DeleteOp(matmul);
89 TFE_DeleteTensorHandle(m);
90 TFE_DeleteContext(ctx);
91 CHECK_EQ(TF_OK, TF_GetCode(status)) << TF_Message(status);
92 TF_DeleteStatus(status);
93}
94BENCHMARK(BM_Execute)->Arg(0)->Arg(1);
95
96void BM_Execute_Identity(int iters, int async) {

Callers

nothing calls this directly

Calls 15

StopTimingFunction · 0.85
SetLabelFunction · 0.85
TF_NewStatusFunction · 0.85
TFE_NewContextOptionsFunction · 0.85
TFE_NewContextFunction · 0.85
TF_GetCodeFunction · 0.85
TF_MessageFunction · 0.85
TFE_DeleteContextOptionsFunction · 0.85
TestMatrixTensorHandleFunction · 0.85
StartTimingFunction · 0.85
TFE_ExecuteFunction · 0.85

Tested by

no test coverage detected