/* * Copyright (c) 2017-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2022 Amazon.com, Inc. or its affiliates. All rights reserved. */ #ifndef NCCL_HEADERS_NET_V2_H_ #define NCCL_HEADERS_NET_V2_H_ #ifdef _cplusplus extern "C" { #endif typedef struct { // Name of the network (mainly for logs) const char* name; // Initialize the network. ncclResult_t (*init)(ncclDebugLogger_t logFunction); // Return the number of adapters. ncclResult_t (*devices)(int* ndev); // Return the device path in /sys. NCCL will call free on this path. ncclResult_t (*pciPath)(int dev, char** path); // Return whether this device supports host pointers and/or CUDA pointers // as data from the current GPU. Supported types should be composed with // NCCL_PTR_HOST and NCCL_PTR_CUDA. ncclResult_t (*ptrSupport)(int dev, int* supportedTypes); // Create a receiving object and provide a handle to connect to it. The // handle can be up to NCCL_NET_HANDLE_MAXSIZE bytes and will be exchanged // between ranks to create a connection. ncclResult_t (*listen)(int dev, void* handle, void** listenComm); // Connect to a handle and return a sending comm object for that peer. ncclResult_t (*connect)(int dev, void* handle, void** sendComm); // Finalize connection establishment after remote peer has called connectHandle ncclResult_t (*accept)(void* listenComm, void** recvComm); // Register/Deregister memory. Comm can be either a sendComm or a recvComm. ncclResult_t (*regMr)(void* comm, void* data, int size, int type, void** mhandle); ncclResult_t (*deregMr)(void* comm, void* mhandle); // Asynchronous send to a peer. Type is either NCCL_PTR_HOST or NCCL_PTR_CUDA. // May return request == NULL if the call cannot be performed (or would block) ncclResult_t (*isend)(void* sendComm, void* data, int size, void* mhandle, void** request); // Asynchronous recv from a peer. Type is either NCCL_PTR_HOST or NCCL_PTR_CUDA. // May return request == NULL if the call cannot be performed (or would block) ncclResult_t (*irecv)(void* recvComm, void* data, int size, void* mhandle, void** request); // Perform a flush/fence to make sure all data received with NCCL_PTR_CUDA is // visible to the GPU ncclResult_t (*flush)(void* recvComm, void* data, int size, void* mhandle); // Test whether a request is complete. If size is not NULL, it returns the // number of bytes sent/received. ncclResult_t (*test)(void* request, int* done, int* size); // Close and free send/recv comm objects ncclResult_t (*closeSend)(void* sendComm); ncclResult_t (*closeRecv)(void* recvComm); ncclResult_t (*closeListen)(void* listenComm); } ncclNet_v2_t; #ifdef _cplusplus } #endif // End extern "C" #endif // End NCCL_HEADERS_NET_V2_H_