Files
rocm-systems/tests/src/Negative/Device/hipSetDevice.cpp
T

20 строки
531 B
C++
Исходник Обычный вид История

2019-05-03 05:39:45 -04:00
#include "test_common.h"
2016-09-27 11:38:31 -05:00
2018-03-12 11:29:03 +05:30
int main() {
2019-05-03 05:39:45 -04:00
int numDevices = 0;
HIPCHECK_API(hipGetDeviceCount(&numDevices), hipSuccess);
if (numDevices > 0) {
for (int deviceId = 0; deviceId < numDevices; deviceId++) {
HIPCHECK_API(hipSetDevice(deviceId), hipSuccess);
}
HIPCHECK_API(hipSetDevice(numDevices), hipErrorInvalidDevice);
HIPCHECK_API(hipSetDevice(-1), hipErrorInvalidDevice);
}
else {
failed("Error: failed to find any compatible devices.");
}
passed();
2016-09-27 11:38:31 -05:00
}