@@ -139,18 +139,23 @@ INSTANTIATE_TEST_SUITE_P(
139
139
140
140
struct TestGetNumDevicesForDTy : public ::testing::TestWithParam<int >
141
141
{
142
- size_t nDevices = 0 ;
142
+ int param;
143
+ sycl::info::device_type sycl_dty;
144
+
143
145
TestGetNumDevicesForDTy ()
144
146
{
145
- cl::sycl::info::device_type sycl_dty =
146
- DPCTL_DPCTLDeviceTypeToSyclDeviceType (
147
- DPCTLSyclDeviceType (GetParam ()));
148
-
149
- auto devices = cl::sycl::device::get_devices (sycl_dty);
150
- EXPECT_TRUE (devices.size () == DPCTLDeviceMgr_GetNumDevices (GetParam ()));
147
+ param = GetParam ();
148
+ DPCTLSyclDeviceType DTy = DPCTLSyclDeviceType (param);
149
+ sycl_dty = DPCTL_DPCTLDeviceTypeToSyclDeviceType (DTy);
151
150
}
152
151
};
153
152
153
+ TEST_P (TestGetNumDevicesForDTy, ChkGetNumDevices)
154
+ {
155
+ auto devices = sycl::device::get_devices (sycl_dty);
156
+ EXPECT_TRUE (devices.size () == DPCTLDeviceMgr_GetNumDevices (param));
157
+ }
158
+
154
159
INSTANTIATE_TEST_SUITE_P (
155
160
GetDevices,
156
161
TestGetNumDevicesForDTy,
@@ -162,23 +167,29 @@ INSTANTIATE_TEST_SUITE_P(
162
167
163
168
struct TestGetNumDevicesForBTy : public ::testing::TestWithParam<int >
164
169
{
165
- size_t nDevices = 0 ;
170
+ int param;
171
+ sycl::backend sycl_bty;
166
172
TestGetNumDevicesForBTy ()
167
173
{
168
- cl::sycl::backend sycl_bty = DPCTL_DPCTLBackendTypeToSyclBackend (
169
- DPCTLSyclBackendType (GetParam ()));
170
-
171
- auto platforms = cl::sycl::platform::get_platforms ();
172
- for (const auto &P : platforms) {
173
- if (P.get_backend () == sycl_bty) {
174
- auto devices = P.get_devices ();
175
- EXPECT_TRUE (devices.size () ==
176
- DPCTLDeviceMgr_GetNumDevices (GetParam ()));
177
- }
178
- }
174
+ param = GetParam ();
175
+ sycl_bty =
176
+ DPCTL_DPCTLBackendTypeToSyclBackend (DPCTLSyclBackendType (param));
179
177
}
180
178
};
181
179
180
+ TEST_P (TestGetNumDevicesForBTy, ChkGetNumDevices)
181
+ {
182
+ auto platforms = cl::sycl::platform::get_platforms ();
183
+ size_t nDevices = 0 ;
184
+ for (const auto &P : platforms) {
185
+ if ((P.get_backend () == sycl_bty) || (sycl_bty == sycl::backend::all)) {
186
+ auto devices = P.get_devices ();
187
+ nDevices += devices.size ();
188
+ }
189
+ }
190
+ EXPECT_TRUE (nDevices == DPCTLDeviceMgr_GetNumDevices (param));
191
+ }
192
+
182
193
INSTANTIATE_TEST_SUITE_P (
183
194
GetDevices,
184
195
TestGetNumDevicesForBTy,
0 commit comments