@@ -374,41 +374,53 @@ struct Device {
374374 int id;
375375};
376376
377- // / Used to configure an endpoint .
377+ // / Configuration for creating communication endpoints .
378378struct EndpointConfig {
379- static const int DefaultMaxCqSize = 1024 ;
380- static const int DefaultMaxCqPollNum = 1 ;
381- static const int DefaultMaxSendWr = 8192 ;
382- static const int DefaultMaxWrPerSend = 64 ;
383-
379+ // / InfiniBand-specific configuration options that control queue pair behavior and performance characteristics.
380+ // / These settings are only used when the transport is an InfiniBand type (IB0-IB7); they are ignored for other
381+ // / transports.
382+ struct Ib {
383+ static const int DefaultMaxCqSize = 1024 ;
384+ static const int DefaultMaxCqPollNum = 1 ;
385+ static const int DefaultMaxSendWr = 8192 ;
386+ static const int DefaultMaxWrPerSend = 64 ;
387+
388+ // / Maximum size of the completion queue.
389+ int maxCqSize;
390+ // / Maximum number of completion queue polls per operation.
391+ int maxCqPollNum;
392+ // / Maximum number of outstanding send work requests.
393+ int maxSendWr;
394+ // / Maximum number of work requests per send operation.
395+ int maxWrPerSend;
396+
397+ // / Constructor.
398+ // / @param maxCqSize Maximum completion queue size.
399+ // / @param maxCqPollNum Maximum completion queue poll count.
400+ // / @param maxSendWr Maximum outstanding send work requests.
401+ // / @param maxWrPerSend Maximum work requests per send operation.
402+ Ib (int maxCqSize = DefaultMaxCqSize, int maxCqPollNum = DefaultMaxCqPollNum, int maxSendWr = DefaultMaxSendWr,
403+ int maxWrPerSend = DefaultMaxWrPerSend)
404+ : maxCqSize(maxCqSize), maxCqPollNum(maxCqPollNum), maxSendWr(maxSendWr), maxWrPerSend(maxWrPerSend) {}
405+ };
406+
407+ // / Communication transport type (e.g., CudaIpc, IB0-IB7, Ethernet).
384408 Transport transport;
409+ // / Target device for the endpoint (GPU or CPU with optional device ID).
385410 Device device;
386- int ibMaxCqSize;
387- int ibMaxCqPollNum;
388- int ibMaxSendWr;
389- int ibMaxWrPerSend;
411+ // / Maximum number of write requests that can be queued (-1 for default).
390412 int maxWriteQueueSize;
391-
392- // / Constructor that takes a transport and sets the other fields to their default values.
393- // /
394- // / @param transport The transport to use.
395- // / @param device The device to use.
396- // / @param ibMaxCqSize The maximum completion queue size.
397- // / @param ibMaxCqPollNum The maximum completion queue poll number.
398- // / @param ibMaxSendWr The maximum send work requests.
399- // / @param ibMaxWrPerSend The maximum work requests per send.
400- // / @param maxWriteQueueSize The maximum write queue size.
401- EndpointConfig (Transport transport = Transport::Unknown, Device device = DeviceType::GPU,
402- int ibMaxCqSize = DefaultMaxCqSize, int ibMaxCqPollNum = DefaultMaxCqPollNum,
403- int ibMaxSendWr = DefaultMaxSendWr, int ibMaxWrPerSend = DefaultMaxWrPerSend,
404- int maxWriteQueueSize = -1 )
405- : transport(transport),
406- device (device),
407- ibMaxCqSize(ibMaxCqSize),
408- ibMaxCqPollNum(ibMaxCqPollNum),
409- ibMaxSendWr(ibMaxSendWr),
410- ibMaxWrPerSend(ibMaxWrPerSend),
411- maxWriteQueueSize(maxWriteQueueSize) {}
413+ // / InfiniBand-specific options (used only for Transport::IBx).
414+ Ib ib;
415+
416+ // / Constructs endpoint configuration with specified transport, device, and optional settings.
417+ // / @param transport Communication transport to use.
418+ // / @param device Target device for the endpoint.
419+ // / @param maxWriteQueueSize Maximum write queue size (-1 for system default).
420+ // / @param ib IB-specific configuration.
421+ EndpointConfig (Transport transport = Transport::Unknown, Device device = DeviceType::GPU, int maxWriteQueueSize = -1 ,
422+ Ib ib = {})
423+ : transport(transport), device(device), maxWriteQueueSize(maxWriteQueueSize), ib(ib) {}
412424};
413425
414426class Context ;
@@ -423,6 +435,10 @@ class Endpoint {
423435 // / Constructor.
424436 Endpoint () = default ;
425437
438+ // / Get the configuration used to create the endpoint.
439+ // / @return The configuration used to create the endpoint.
440+ const EndpointConfig& config () const ;
441+
426442 // / Get the transport used.
427443 // / @return The transport used.
428444 Transport transport () const ;
@@ -685,9 +701,9 @@ class Semaphore {
685701 std::shared_ptr<Impl> pimpl_;
686702};
687703
704+ // / Deprecated.
688705template <typename T>
689- using NonblockingFuture [[deprecated(" Use std::shared_future instead. This will be removed in a future release." )]] =
690- std::shared_future<T>;
706+ using NonblockingFuture = std::shared_future<T>;
691707
692708// / A class that sets up all registered memories and connections between processes.
693709// /
@@ -853,12 +869,20 @@ class Communicator {
853869 // / on the last future, it will start receiving the five RegisteredMemory or Connection objects in order,
854870 // / back to back.
855871 // /
856- // / @param localConfig The configuration for the local endpoint.
872+ // / @param localEndpoint The local endpoint.
857873 // / @param remoteRank The rank of the remote process.
858874 // / @param tag The tag to use for identifying the send and receive.
859875 // / @return A future of shared pointer to the connection.
860876 // /
861- std::shared_future<std::shared_ptr<Connection>> connect (EndpointConfig localConfig, int remoteRank, int tag = 0 );
877+ std::shared_future<std::shared_ptr<Connection>> connect (const Endpoint& localEndpoint, int remoteRank, int tag = 0 );
878+
879+ // / Connect to a remote rank. Wrapper of `connect(localEndpoint, remoteRank, tag)`.
880+ // / @param localConfig The configuration for the local endpoint.
881+ // / @param remoteRank The rank of the remote process.
882+ // / @param tag The tag to use for identifying the send and receive.
883+ // / @return A future of shared pointer to the connection.
884+ std::shared_future<std::shared_ptr<Connection>> connect (const EndpointConfig& localConfig, int remoteRank,
885+ int tag = 0 );
862886
863887 [[deprecated(" Use connect(localConfig, remoteRank, tag) instead. This will be removed in a future release." )]] std::
864888 shared_future<std::shared_ptr<Connection>>
0 commit comments