Test that a graph with no constraints will successfully assign nodes to the "best available" device (i.e. prefer GPU over CPU).
| 395 | // Test that a graph with no constraints will successfully assign nodes to the |
| 396 | // "best available" device (i.e. prefer GPU over CPU). |
| 397 | TEST_F(PlacerTest, TestNoConstraints) { |
| 398 | Graph g(OpRegistry::Global()); |
| 399 | { // Scope for temporary variables used to construct g. |
| 400 | GraphDefBuilder b(GraphDefBuilder::kFailImmediately); |
| 401 | Node* input = ops::SourceOp("TestInput", b.opts().WithName("in")); |
| 402 | ops::UnaryOp("TestRelu", ops::NodeOut(input, 0), b.opts().WithName("n1")); |
| 403 | ops::UnaryOp("TestRelu", ops::NodeOut(input, 1), b.opts().WithName("n2")); |
| 404 | TF_EXPECT_OK(BuildGraph(b, &g)); |
| 405 | } |
| 406 | |
| 407 | TF_EXPECT_OK(Place(&g)); |
| 408 | EXPECT_DEVICE_TYPE(g, "in", "FakeCPU"); |
| 409 | EXPECT_DEVICE_TYPE(g, "n1", "FakeGPU"); |
| 410 | EXPECT_DEVICE_TYPE(g, "n2", "FakeGPU"); |
| 411 | } |
| 412 | |
| 413 | // Test that a graph with no constraints but using kernels that have a specified |
| 414 | // device priority will successfully assign nodes to the device with higher |
nothing calls this directly
no test coverage detected