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 25, 2023
1 parent 3a3aae3 commit 4430262
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 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,20 @@ 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 4430262

Please sign in to comment.