Merge pull request #1072 from kpyzhov/master
Refined hipSetDevice test.
[ROCm/hip commit: fea21dc6d5]
This commit is contained in:
@@ -1,9 +1,19 @@
|
||||
#include "hip/hip_runtime.h"
|
||||
#include "hip/hip_runtime_api.h"
|
||||
#include "hipDeviceUtil.h"
|
||||
#include "test_common.h"
|
||||
|
||||
int main() {
|
||||
HIP_CHECK(hipSetDevice(0), hipSetDevice);
|
||||
HIP_CHECK(hipSetDevice(1026), hipSetDevice);
|
||||
HIP_CHECK(hipSetDevice(-1), hipSetDevice);
|
||||
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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user