Custom Reduction Operator

Custom Reduction Operator#

Rocprofiler SDK Developer API: Custom Reduction Operator
Rocprofiler SDK Developer API 0.5.0
ROCm Profiling API and tools
Custom Reduction Operator

Enumerations

enum  ncclScalarResidence_t {
  ncclScalarDevice = 0 ,
  ncclScalarHostImmediate = 1
}
 Location and dereferencing logic for scalar arguments. More...
 

Functions

ncclResult_t ncclRedOpCreatePreMulSum (ncclRedOp_t *op, void *scalar, ncclDataType_t datatype, ncclScalarResidence_t residence, ncclComm_t comm)
 Create a custom pre-multiplier reduction operator.
 
ncclResult_t ncclRedOpDestroy (ncclRedOp_t op, ncclComm_t comm)
 Destroy custom reduction operator.
 

Detailed Description

API calls relating to creation/destroying custom reduction operator that pre-multiplies local source arrays prior to reduction

Enumeration Type Documentation

◆ ncclScalarResidence_t

Location and dereferencing logic for scalar arguments.

Enumeration specifying memory location of the scalar argument. Based on where the value is stored, the argument will be dereferenced either while the collective is running (if in device memory), or before the ncclRedOpCreate() function returns (if in host memory).

Enumerator
ncclScalarDevice 

Scalar is in device-visible memory

ncclScalarHostImmediate 

Scalar is in host-visible memory

Definition at line 466 of file rccl.h.

467{
468 ncclScalarDevice = 0, /*!< Scalar is in device-visible memory */
469 ncclScalarHostImmediate = 1 /*!< Scalar is in host-visible memory */
ncclScalarResidence_t
Location and dereferencing logic for scalar arguments.
Definition rccl.h:467
@ ncclScalarHostImmediate
Definition rccl.h:469
@ ncclScalarDevice
Definition rccl.h:468

Function Documentation

◆ ncclRedOpCreatePreMulSum()

ncclResult_t ncclRedOpCreatePreMulSum ( ncclRedOp_t op,
void *  scalar,
ncclDataType_t  datatype,
ncclScalarResidence_t  residence,
ncclComm_t  comm 
)

Create a custom pre-multiplier reduction operator.

Creates a new reduction operator which pre-multiplies input values by a given scalar locally before reducing them with peer values via summation. For use only with collectives launched against comm and datatype. The residence* argument indicates how/when the memory pointed to by scalar will be dereferenced. Upon return, the newly created operator's handle is stored in op.

Returns
Result code. See Result Codes for more details.
Parameters
[out]opPointer to where newly created custom reduction operator is to be stored
[in]scalarPointer to scalar value.
[in]datatypeScalar value datatype
[in]residenceMemory type of the scalar value
[in]commCommunicator to associate with this custom reduction operator

◆ ncclRedOpDestroy()

ncclResult_t ncclRedOpDestroy ( ncclRedOp_t  op,
ncclComm_t  comm 
)

Destroy custom reduction operator.

Destroys the reduction operator op. The operator must have been created by ncclRedOpCreatePreMul with the matching communicator comm. An operator may be destroyed as soon as the last RCCL function which is given that operator returns.

Returns
Result code. See Result Codes for more details.
Parameters
[in]opCustom reduction operator is to be destroyed
[in]commCommunicator associated with this reduction operator