| 154 | #define BOB "/job:j/replica:0/task:0/device:GPU:0" |
| 155 | |
| 156 | TEST_F(ExecutorTest, SimpleAdd) { |
| 157 | // c = a + b |
| 158 | auto g = absl::make_unique<Graph>(OpRegistry::Global()); |
| 159 | auto in0 = test::graph::Recv(g.get(), "a", "float", ALICE, 1, BOB); |
| 160 | auto in1 = test::graph::Recv(g.get(), "b", "float", ALICE, 1, BOB); |
| 161 | auto tmp = test::graph::Add(g.get(), in0, in1); |
| 162 | test::graph::Send(g.get(), tmp, "c", BOB, 1, ALICE); |
| 163 | Create(std::move(g)); |
| 164 | Rendezvous::Args args; |
| 165 | TF_ASSERT_OK(rendez_->Send(Key(ALICE, kIncarnation, BOB, "a"), args, V(1.0), |
| 166 | false)); // in0 = 1.0 |
| 167 | TF_ASSERT_OK(rendez_->Send(Key(ALICE, kIncarnation, BOB, "b"), args, V(1.0), |
| 168 | false)); // in1 = 1.0 |
| 169 | TF_ASSERT_OK(Run(rendez_)); |
| 170 | Tensor out = V(-1); |
| 171 | bool is_dead = false; |
| 172 | TF_ASSERT_OK( |
| 173 | rendez_->Recv(Key(BOB, kIncarnation, ALICE, "c"), args, &out, &is_dead)); |
| 174 | EXPECT_EQ(2.0, V(out)); // out = 1.0 + 1.0 = 2.0 |
| 175 | } |
| 176 | |
| 177 | TEST_F(ExecutorTest, SelfAdd) { |
| 178 | // v0 <- a |
nothing calls this directly
no test coverage detected