Test device_count() works in both CPU and CUDA builds
| 88 | |
| 89 | // Test device_count() works in both CPU and CUDA builds |
| 90 | TEST(StreamTest, DeviceCount) { |
| 91 | c10::DeviceIndex count = c10::cuda::device_count(); |
| 92 | #if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP) |
| 93 | // In CUDA builds, should return actual device count (>= 0) |
| 94 | EXPECT_GE(count, 0); |
| 95 | #else |
| 96 | // In CPU-only builds, should return 0 |
| 97 | EXPECT_EQ(count, 0); |
| 98 | #endif |
| 99 | } |
| 100 | |
| 101 | // ==================== native_handle ==================== |
| 102 |
nothing calls this directly
no test coverage detected