| 319 | class DeviceKernelOpTest : public OpsTestBase { |
| 320 | protected: |
| 321 | void SetupOp(const char* op_name, const char* kernel_name, |
| 322 | void (*compute_func)(void*, TF_OpKernelContext*)) { |
| 323 | TF_KernelBuilder* builder = TF_NewKernelBuilder( |
| 324 | op_name, device_name_, nullptr, compute_func, nullptr); |
| 325 | TF_Status* status = TF_NewStatus(); |
| 326 | TF_RegisterKernelBuilder(kernel_name, builder, status); |
| 327 | EXPECT_EQ(TF_OK, TF_GetCode(status)); |
| 328 | TF_DeleteStatus(status); |
| 329 | |
| 330 | #if GOOGLE_CUDA |
| 331 | std::unique_ptr<Device> device( |
| 332 | DeviceFactory::NewDevice(device_name_, {}, "/job:a/replica:0/task:0")); |
| 333 | OpsTestBase::SetDevice(DEVICE_GPU, std::move(device)); |
| 334 | #endif |
| 335 | TF_ASSERT_OK(NodeDefBuilder(op_name, op_name).Finalize(node_def())); |
| 336 | TF_ASSERT_OK(InitOp()); |
| 337 | } |
| 338 | |
| 339 | #if GOOGLE_CUDA |
| 340 | const char* device_name_ = tensorflow::DEVICE_GPU; |
nothing calls this directly
no test coverage detected