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

Function TEST

tensorflow/core/grappler/clusters/utils_test.cc:29–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27namespace {
28
29TEST(UtilsTest, GetLocalGPUInfo) {
30 GpuIdManager::TestOnlyReset();
31#if GOOGLE_CUDA
32 LOG(INFO) << "CUDA is enabled.";
33 DeviceProperties properties;
34
35 // Invalid platform GPU ID.
36 properties = GetLocalGPUInfo(PlatformGpuId(100));
37 EXPECT_EQ("UNKNOWN", properties.type());
38
39 // Succeed when a valid platform GPU id was inserted.
40 properties = GetLocalGPUInfo(PlatformGpuId(0));
41 EXPECT_EQ("GPU", properties.type());
42 EXPECT_EQ("NVIDIA", properties.vendor());
43#elif TENSORFLOW_USE_ROCM
44 LOG(INFO) << "ROCm is enabled.";
45 DeviceProperties properties;
46
47 // Invalid platform GPU ID.
48 properties = GetLocalGPUInfo(PlatformGpuId(100));
49 EXPECT_EQ("UNKNOWN", properties.type());
50
51 // Succeed when a valid platform GPU id was inserted.
52 properties = GetLocalGPUInfo(PlatformGpuId(0));
53 EXPECT_EQ("GPU", properties.type());
54 EXPECT_EQ("Advanced Micro Devices, Inc", properties.vendor());
55#else
56 LOG(INFO) << "CUDA is not enabled.";
57 DeviceProperties properties;
58
59 properties = GetLocalGPUInfo(PlatformGpuId(0));
60 EXPECT_EQ("GPU", properties.type());
61
62 properties = GetLocalGPUInfo(PlatformGpuId(100));
63 EXPECT_EQ("GPU", properties.type());
64#endif
65}
66
67TEST(UtilsTest, GetDeviceInfo) {
68 GpuIdManager::TestOnlyReset();

Callers

nothing calls this directly

Calls 4

GetLocalGPUInfoFunction · 0.85
vendorMethod · 0.80
GetDeviceInfoFunction · 0.70
typeMethod · 0.65

Tested by

no test coverage detected