Skip to content

Commit

Permalink
[UR][Tests] Add the pciAddress of the devices to the GetPlatformAndDe…
Browse files Browse the repository at this point in the history
…viceName function. This solves a problem with duplicate parameters in gtest when running the test on multiple devices
  • Loading branch information
szadam committed Oct 24, 2023
1 parent b52bdd4 commit 5cd6bdd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion test/conformance/testing/include/uur/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,18 @@ inline std::string GetDeviceName(ur_device_handle_t device) {
}

inline std::string GetPlatformAndDeviceName(ur_device_handle_t device) {
return GetPlatformName(GetPlatform()) + "__" + GetDeviceName(device);
constexpr int max_address_length = 256;
char pci_address[max_address_length];
char id[max_address_length];
urDeviceGetInfo(device, UR_DEVICE_INFO_PCI_ADDRESS, sizeof(pci_address) , pci_address, nullptr);
int j = 0;
for(int i = 0; i < max_address_length; i++) {
if (pci_address[i] != '.' && pci_address[i] != ':') {
id[j] = pci_address[i];
j++;
}
}
return GetPlatformName(GetPlatform()) + "__" + GetDeviceName(device) + id + "_";
}

ur_result_t GetDeviceType(ur_device_handle_t device,
Expand Down

0 comments on commit 5cd6bdd

Please sign in to comment.