Don't require NIC devices to have specific PCI class

If a PCI node is the parent of a NIC, treat it as such, regardless of
the PCI class code for the device. This allows non-traditional devices
to act as NICs via the net plugin mechanism.

For consistency, treat GPUs similarly.
This commit is contained in:
Eric Badger 2020-08-03 12:38:07 -07:00
parent 033d799524
commit 700c0e0f24

View File

@ -317,21 +317,19 @@ ncclResult_t ncclTopoAddPci(struct ncclXmlNode* xmlPci, struct ncclTopoSystem* s
NCCLCHECK(busIdToInt64(str, &busId)); NCCLCHECK(busIdToInt64(str, &busId));
struct ncclTopoNode* node = NULL; struct ncclTopoNode* node = NULL;
if (type == GPU) { struct ncclXmlNode* xmlGpu = NULL;
struct ncclXmlNode* xmlGpu;
NCCLCHECK(xmlGetSub(xmlPci, "gpu", &xmlGpu)); NCCLCHECK(xmlGetSub(xmlPci, "gpu", &xmlGpu));
if (xmlGpu == NULL) return ncclSuccess; if (xmlGpu != NULL) {
int index; int index;
NCCLCHECK(xmlGetAttrIndex(xmlGpu, "rank", &index)); NCCLCHECK(xmlGetAttrIndex(xmlGpu, "rank", &index));
if (index == -1) return ncclSuccess; if (index == -1) return ncclSuccess;
NCCLCHECK(ncclTopoCreateNode(system, &node, type, busId)); NCCLCHECK(ncclTopoCreateNode(system, &node, type, busId));
NCCLCHECK(ncclTopoAddGpu(xmlGpu, system, node)); NCCLCHECK(ncclTopoAddGpu(xmlGpu, system, node));
} }
if (type == NIC) { struct ncclXmlNode* xmlNic = NULL;
struct ncclXmlNode* xmlNic;
NCCLCHECK(xmlGetSub(xmlPci, "nic", &xmlNic)); NCCLCHECK(xmlGetSub(xmlPci, "nic", &xmlNic));
if (xmlNic == NULL) return ncclSuccess; if (xmlNic != NULL) {
type = NIC;
// Ignore sub device ID and merge multi-port NICs into one PCI device. // Ignore sub device ID and merge multi-port NICs into one PCI device.
busId &= 0xfffffffffffffff0; busId &= 0xfffffffffffffff0;
struct ncclTopoNode* nicNode = NULL; struct ncclTopoNode* nicNode = NULL;