SWDEV-521135 - Remove Unit_UUID_setEnv_Thread_Lock and correct uuidList.cc (#31)
[ROCm/hip-tests commit: 8abcd95564]
Este cometimento está contido em:
cometido por
GitHub
ascendente
9e2a9eba01
cometimento
0a42915f18
@@ -897,7 +897,6 @@
|
|||||||
"Unit_hipExtLaunchKernelGGL_Functional",
|
"Unit_hipExtLaunchKernelGGL_Functional",
|
||||||
"=== Following tests disabled due to SWDEV-483110",
|
"=== Following tests disabled due to SWDEV-483110",
|
||||||
"Unit_UUID_setEnv_Thread",
|
"Unit_UUID_setEnv_Thread",
|
||||||
"Unit_UUID_setEnv_Thread_Lock",
|
|
||||||
"====================================================",
|
"====================================================",
|
||||||
#endif
|
#endif
|
||||||
#if defined gfx1200 || defined gfx1201
|
#if defined gfx1200 || defined gfx1201
|
||||||
|
|||||||
@@ -494,27 +494,6 @@ void setEnv() {
|
|||||||
HipTest::HIP_SKIP_TEST("Skipping because this machine has total GPUs < 2"); // NOLINT
|
HipTest::HIP_SKIP_TEST("Skipping because this machine has total GPUs < 2"); // NOLINT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::mutex setLock;
|
|
||||||
void setEnvLock() {
|
|
||||||
setLock.lock();
|
|
||||||
std::map<int, std::vector<char>> uuid_map;
|
|
||||||
#ifdef __linux__
|
|
||||||
uuid_map = getUUIDlistFromRocmInfo();
|
|
||||||
#else
|
|
||||||
uuid_map = getUUIDlistWithoutRocmInfo();
|
|
||||||
#endif
|
|
||||||
if (uuid_map.size() >= 2) {
|
|
||||||
std::string uuid = uuid_map[1].data();
|
|
||||||
std::string uuidEnv = uuid.substr(0, 20);
|
|
||||||
unsetenv("HIP_VISIBLE_DEVICES");
|
|
||||||
setenv("HIP_VISIBLE_DEVICES", uuidEnv.c_str(), 1);
|
|
||||||
} else {
|
|
||||||
tState = 2;
|
|
||||||
HipTest::HIP_SKIP_TEST("Skipping because this machine has total GPUs < 2"); // NOLINT
|
|
||||||
}
|
|
||||||
setLock.unlock();
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Test Description
|
* Test Description
|
||||||
* ------------------------
|
* ------------------------
|
||||||
@@ -538,35 +517,6 @@ TEST_CASE("Unit_UUID_setEnv_Thread") {
|
|||||||
t2.join();
|
t2.join();
|
||||||
REQUIRE(tState != 0);
|
REQUIRE(tState != 0);
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Test Description
|
|
||||||
* ------------------------
|
|
||||||
* - Multi thread scenario.
|
|
||||||
* - Set Env var HIP_VISIBLE_DEVICES in one thread
|
|
||||||
* - Meanwhile hold the second thread. Release the 2nd thread.
|
|
||||||
* - Verify the followed by functionality in another thread
|
|
||||||
* Test source
|
|
||||||
* ------------------------
|
|
||||||
* - unit/device/hipDeviceGetUuid.cc
|
|
||||||
* Test requirements
|
|
||||||
* ------------------------
|
|
||||||
* - HIP_VERSION >= 6.2
|
|
||||||
*/
|
|
||||||
|
|
||||||
TEST_CASE("Unit_UUID_setEnv_Thread_Lock") {
|
|
||||||
// Create Thread one
|
|
||||||
std::thread t1(setEnvLock);
|
|
||||||
#ifdef __linux__
|
|
||||||
sleep(2);
|
|
||||||
#else
|
|
||||||
_sleep(2);
|
|
||||||
#endif
|
|
||||||
// Create Thread two
|
|
||||||
std::thread t2(ChkUUID);
|
|
||||||
t2.join();
|
|
||||||
t1.join();
|
|
||||||
REQUIRE(tState != 0);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* End doxygen group DriverTest.
|
* End doxygen group DriverTest.
|
||||||
|
|||||||
@@ -23,33 +23,35 @@ THE SOFTWARE.
|
|||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
hipDevice_t device;
|
hipDevice_t device;
|
||||||
int devCount;
|
int devCount = 0;
|
||||||
hipError_t localError;
|
hipError_t localError;
|
||||||
localError = hipGetDeviceCount(&devCount);
|
localError = hipGetDeviceCount(&devCount);
|
||||||
if (localError == hipSuccess) {
|
if (localError != hipSuccess) {
|
||||||
printf("HIP Api returned hipSuccess");
|
printf("hipGetDeviceCount is failed.");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
std::string uuid;
|
std::string uuid = "";
|
||||||
for (int i = 0; i < devCount; i++) {
|
for (int i = 0; i < devCount; i++) {
|
||||||
localError = hipSetDevice(i);
|
localError = hipSetDevice(i);
|
||||||
if (localError == hipSuccess) {
|
if (localError != hipSuccess) {
|
||||||
printf("HIP Api returned hipSuccess");
|
printf("hipSetDevice is failed.");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
localError = hipDeviceGet(&device, i);
|
localError = hipDeviceGet(&device, i);
|
||||||
if (localError == hipSuccess) {
|
if (localError != hipSuccess) {
|
||||||
printf("HIP Api returned hipSuccess");
|
printf("hipDeviceGet is failed.");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
hipUUID d_uuid{0};
|
hipUUID d_uuid{0};
|
||||||
localError = hipDeviceGetUuid(&d_uuid, device);
|
localError = hipDeviceGetUuid(&d_uuid, device);
|
||||||
if (localError == hipSuccess) {
|
if (localError != hipSuccess) {
|
||||||
printf("HIP Api returned hipSuccess");
|
printf("hipDeviceGetUuid is failed.");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
char preStr[16] = "GPU-";
|
|
||||||
strcat(preStr, d_uuid.bytes);
|
|
||||||
if (i == devCount - 1) {
|
if (i == devCount - 1) {
|
||||||
uuid = uuid + preStr;
|
uuid = uuid + "GPU-" + d_uuid.bytes;
|
||||||
} else {
|
} else {
|
||||||
uuid = uuid + preStr + ",";
|
uuid = uuid + "GPU-" + d_uuid.bytes + ",";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout<< uuid;
|
std::cout<< uuid;
|
||||||
|
|||||||
Criar uma nova questão referindo esta
Bloquear um utilizador