SWDEV-1 fix issues seen due to test sharding (#1134)
This commit is contained in:
@@ -114,6 +114,26 @@ TEST_CASE("Unit_hipDeviceGetUuid_Negative") {
|
||||
}
|
||||
#ifdef __linux__
|
||||
#if HT_AMD
|
||||
|
||||
static inline std::vector<int> parseVisibleDevices() {
|
||||
std::vector<int> res;
|
||||
auto env_res = std::getenv("HIP_VISIBLE_DEVICES");
|
||||
if (env_res == nullptr) {
|
||||
env_res = std::getenv("ROCR_VISIBLE_DEVICES");
|
||||
if (env_res == nullptr) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
std::stringstream ss(std::string{env_res});
|
||||
std::string item;
|
||||
while (std::getline(ss, item, ',')) {
|
||||
res.push_back(std::stoi(item));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Description
|
||||
* ------------------------
|
||||
@@ -161,6 +181,17 @@ TEST_CASE("Unit_hipDeviceGetUuid_From_RocmInfo") {
|
||||
j++;
|
||||
}
|
||||
|
||||
auto visible_devices = parseVisibleDevices();
|
||||
if (visible_devices.size() > 0) {
|
||||
// We have visible devices set, basically parse the visible devices and remove the entries
|
||||
size_t start = 0; // The devices will be reported from 0..
|
||||
std::map<int, std::vector<char>> uuid_map_copy;
|
||||
for (auto device : visible_devices) {
|
||||
uuid_map_copy[start] = uuid_map[device];
|
||||
}
|
||||
uuid_map = uuid_map_copy;
|
||||
}
|
||||
|
||||
for (const auto& i : uuid_map) {
|
||||
if (i.second.size() == 0) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user