2018-09-24 16:06:59 -07:00
|
|
|
/*************************************************************************
|
2020-05-12 14:40:18 -07:00
|
|
|
* Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved.
|
2018-09-24 16:06:59 -07:00
|
|
|
*
|
|
|
|
|
* See LICENSE.txt for license information
|
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef NCCL_TRANSPORT_H_
|
|
|
|
|
#define NCCL_TRANSPORT_H_
|
|
|
|
|
|
2019-03-14 19:39:20 -07:00
|
|
|
#include "devcomm.h"
|
2019-11-19 14:57:39 -08:00
|
|
|
#include "graph.h"
|
2018-12-13 15:56:12 -08:00
|
|
|
#include "nvmlwrap.h"
|
2019-11-19 14:57:39 -08:00
|
|
|
#include "core.h"
|
2020-05-12 14:40:18 -07:00
|
|
|
#include "proxy.h"
|
2018-09-24 16:06:59 -07:00
|
|
|
|
|
|
|
|
#define NTRANSPORTS 3
|
2019-11-19 14:57:39 -08:00
|
|
|
#define TRANSPORT_P2P 0
|
|
|
|
|
#define TRANSPORT_SHM 1
|
|
|
|
|
#define TRANSPORT_NET 2
|
2018-09-24 16:06:59 -07:00
|
|
|
|
|
|
|
|
extern struct ncclTransport ncclTransports[];
|
|
|
|
|
|
|
|
|
|
// Forward declarations
|
|
|
|
|
struct ncclRing;
|
|
|
|
|
struct ncclConnector;
|
|
|
|
|
struct ncclComm;
|
|
|
|
|
|
2018-12-13 15:56:12 -08:00
|
|
|
struct ncclPeerInfo {
|
|
|
|
|
int rank;
|
|
|
|
|
int cudaDev;
|
2019-11-19 14:57:39 -08:00
|
|
|
int gdrSupport;
|
2018-12-13 15:56:12 -08:00
|
|
|
uint64_t hostHash;
|
|
|
|
|
uint64_t pidHash;
|
2019-11-19 14:57:39 -08:00
|
|
|
dev_t shmDev;
|
|
|
|
|
int64_t busId;
|
2018-09-24 16:06:59 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define CONNECT_SIZE 128
|
|
|
|
|
struct ncclConnect {
|
|
|
|
|
char data[CONNECT_SIZE];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ncclTransportComm {
|
2020-05-12 14:40:18 -07:00
|
|
|
ncclResult_t (*setup)(struct ncclTopoSystem* topo, struct ncclTopoGraph* graph, struct ncclPeerInfo*, struct ncclPeerInfo*, struct ncclConnect*, struct ncclConnector*, int channelId);
|
2020-01-16 16:02:42 -08:00
|
|
|
ncclResult_t (*connect)(struct ncclConnect*, int nranks, int rank, struct ncclConnector*);
|
2018-09-24 16:06:59 -07:00
|
|
|
ncclResult_t (*free)(void*);
|
|
|
|
|
ncclResult_t (*proxy)(struct ncclProxyArgs*);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ncclTransport {
|
|
|
|
|
const char name[4];
|
2019-11-19 14:57:39 -08:00
|
|
|
ncclResult_t (*canConnect)(int*, struct ncclTopoSystem* topo, struct ncclTopoGraph* graph, struct ncclPeerInfo*, struct ncclPeerInfo*);
|
2018-09-24 16:06:59 -07:00
|
|
|
struct ncclTransportComm send;
|
|
|
|
|
struct ncclTransportComm recv;
|
|
|
|
|
};
|
|
|
|
|
|
2020-05-12 14:40:18 -07:00
|
|
|
ncclResult_t ncclTransportP2pSetup(struct ncclComm* comm, struct ncclTopoGraph* graph, struct ncclChannel* channel, int nrecv, int* peerRecv, int nsend, int* peerSend);
|
2018-09-24 16:06:59 -07:00
|
|
|
|
|
|
|
|
#endif
|