MCPcopy Create free account
hub / github.com/catboost/catboost / RunIBTest

Function RunIBTest

library/cpp/netliba/v6/ib_test.cpp:91–230  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89 }
90
91 void RunIBTest(bool isClient, const char* serverName) {
92 TIntrusivePtr<TIBPort> port = GetIBDevice();
93 if (port.Get() == nullptr) {
94 printf("No IB device found\n");
95 return;
96 }
97
98 const int IP_PORT = 13666;
99 const int WELCOME_QKEY = 0x1113013;
100 const int MAX_SRQ_WORK_REQUESTS = 100;
101 const int MAX_CQ_EVENTS = 1000;
102 const int QP_SEND_QUEUE_SIZE = 3;
103
104 TIntrusivePtr<TComplectionQueue> cq = new TComplectionQueue(port->GetCtx(), MAX_CQ_EVENTS);
105
106 TIBBufferPool bp(port->GetCtx(), MAX_SRQ_WORK_REQUESTS);
107
108 if (!isClient) {
109 // server
110 TIPSocket ipSocket;
111 ipSocket.Init(IP_PORT);
112 if (!ipSocket.IsValid()) {
113 printf("UDP port %d is not available\n", IP_PORT);
114 return;
115 }
116
117 TIntrusivePtr<TComplectionQueue> cqRC = new TComplectionQueue(port->GetCtx(), MAX_CQ_EVENTS);
118
119 TIntrusivePtr<TUDQueuePair> welcomeQP = new TUDQueuePair(port, cq, bp.GetSRQ(), QP_SEND_QUEUE_SIZE);
120 welcomeQP->Init(WELCOME_QKEY);
121
122 TWelcomeSocketAddr info;
123 info.LID = port->GetLID();
124 info.QPN = welcomeQP->GetQPN();
125
126 TIntrusivePtr<TAddressHandle> ahPeer1;
127 for (;;) {
128 ipSocket.Respond(info);
129 // poll srq
130 ibv_wc wc;
131 if (cq->Poll(&wc, 1) == 1 && (wc.opcode & IBV_WC_RECV)) {
132 printf("Got IB handshake\n");
133
134 TRCQueuePairHandshake remoteHandshake;
135 ibv_ah_attr clientAddr;
136 {
137 TIBRecvPacketProcess pkt(bp, wc);
138 remoteHandshake = *(TRCQueuePairHandshake*)pkt.GetUDData();
139 port->GetAHAttr(&wc, pkt.GetGRH(), &clientAddr);
140 }
141
142 TIntrusivePtr<TAddressHandle> ahPeer2;
143 ahPeer2 = new TAddressHandle(port->GetCtx(), &clientAddr);
144
145 TIntrusivePtr<TRCQueuePair> rcTest = new TRCQueuePair(port->GetCtx(), cqRC, bp.GetSRQ(), QP_SEND_QUEUE_SIZE);
146 rcTest->Init(clientAddr, remoteHandshake.QPN, remoteHandshake.PSN);
147
148 TRCQueuePairHandshake handshake;

Callers

nothing calls this directly

Calls 15

GetIBDeviceFunction · 0.70
WaitForRecvFunction · 0.70
GetMethod · 0.45
GetCtxMethod · 0.45
InitMethod · 0.45
IsValidMethod · 0.45
GetSRQMethod · 0.45
GetLIDMethod · 0.45
GetQPNMethod · 0.45
RespondMethod · 0.45
PollMethod · 0.45
GetUDDataMethod · 0.45

Tested by

no test coverage detected