SWDEV-521135 - Remove Unit_UUID_setEnv_Thread_Lock and correct uuidList.cc (#31)
[ROCm/hip-tests commit: 8abcd95564]
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
9e2a9eba01
Коммит
0a42915f18
@@ -897,7 +897,6 @@
|
||||
"Unit_hipExtLaunchKernelGGL_Functional",
|
||||
"=== Following tests disabled due to SWDEV-483110",
|
||||
"Unit_UUID_setEnv_Thread",
|
||||
"Unit_UUID_setEnv_Thread_Lock",
|
||||
"====================================================",
|
||||
#endif
|
||||
#if defined gfx1200 || defined gfx1201
|
||||
|
||||
@@ -494,27 +494,6 @@ void setEnv() {
|
||||
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
|
||||
* ------------------------
|
||||
@@ -538,35 +517,6 @@ TEST_CASE("Unit_UUID_setEnv_Thread") {
|
||||
t2.join();
|
||||
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
|
||||
/**
|
||||
* End doxygen group DriverTest.
|
||||
|
||||
@@ -23,33 +23,35 @@ THE SOFTWARE.
|
||||
|
||||
int main() {
|
||||
hipDevice_t device;
|
||||
int devCount;
|
||||
int devCount = 0;
|
||||
hipError_t localError;
|
||||
localError = hipGetDeviceCount(&devCount);
|
||||
if (localError == hipSuccess) {
|
||||
printf("HIP Api returned hipSuccess");
|
||||
if (localError != hipSuccess) {
|
||||
printf("hipGetDeviceCount is failed.");
|
||||
return 1;
|
||||
}
|
||||
std::string uuid;
|
||||
std::string uuid = "";
|
||||
for (int i = 0; i < devCount; i++) {
|
||||
localError = hipSetDevice(i);
|
||||
if (localError == hipSuccess) {
|
||||
printf("HIP Api returned hipSuccess");
|
||||
if (localError != hipSuccess) {
|
||||
printf("hipSetDevice is failed.");
|
||||
return 1;
|
||||
}
|
||||
localError = hipDeviceGet(&device, i);
|
||||
if (localError == hipSuccess) {
|
||||
printf("HIP Api returned hipSuccess");
|
||||
if (localError != hipSuccess) {
|
||||
printf("hipDeviceGet is failed.");
|
||||
return 1;
|
||||
}
|
||||
hipUUID d_uuid{0};
|
||||
localError = hipDeviceGetUuid(&d_uuid, device);
|
||||
if (localError == hipSuccess) {
|
||||
printf("HIP Api returned hipSuccess");
|
||||
if (localError != hipSuccess) {
|
||||
printf("hipDeviceGetUuid is failed.");
|
||||
return 1;
|
||||
}
|
||||
char preStr[16] = "GPU-";
|
||||
strcat(preStr, d_uuid.bytes);
|
||||
if (i == devCount - 1) {
|
||||
uuid = uuid + preStr;
|
||||
uuid = uuid + "GPU-" + d_uuid.bytes;
|
||||
} else {
|
||||
uuid = uuid + preStr + ",";
|
||||
uuid = uuid + "GPU-" + d_uuid.bytes + ",";
|
||||
}
|
||||
}
|
||||
std::cout<< uuid;
|
||||
|
||||
Ссылка в новой задаче
Block a user