Defining Operator APIs

You need to create a header file for defining operator APIs based on the functions of a communication operator. The header file is required for calling the communication operator.

Take the customization of the P2P communication operators Send and Receive as an example. The Send operator sends data from a specified location of the local rank to the remote end, and the Receive operator receives data from the remote end to a specified location at the local end. The two operators must be used in pair. Therefore, in addition to the communicator information and stream information, you also need to pass the data address, data size, data type, and remote rank ID for defining APIs of such operators. The API definition is as follows:

HcclResult HcclSendCustom(void *sendBuf, uint64_t count, HcclDataType dataType, uint32_t destRank, HcclComm comm, aclrtStream stream);
HcclResult HcclRecvCustom(void *recvBuf, uint64_t count, HcclDataType dataType, uint32_t srcRank, HcclComm comm, aclrtStream stream);