Datatypes

oneCCL specification defines the following datatypes that may be used for communication operations:

enum class datatype : int
{
    int8            = /* unspecified */,
    uint8           = /* unspecified */,
    int16           = /* unspecified */,
    uint16          = /* unspecified */,
    int32           = /* unspecified */,
    uint32          = /* unspecified */,
    int64           = /* unspecified */,
    uint64          = /* unspecified */,

    float16         = /* unspecified */,
    float32         = /* unspecified */,
    float64         = /* unspecified */,
    bfloat16        = /* unspecified */,

    last_predefined = /* unspecified, equal to the largest of all the values above */
};
datatype::int8

8 bits signed integer

datatype::uint8

8 bits unsigned integer

datatype::int16

16 bits signed integer

datatype::uint16

16 bits unsigned integer

datatype::int32

32 bits signed integer

datatype::uint32

32 bits unsigned integer

datatype::int64

64 bits signed integer

datatype::uint64

64 bits unsigned integer

datatype::float16

16-bit/half-precision floating point

datatype::float32

32-bit/single-precision floating point

datatype::float64

64-bit/double-precision floating point

datatype::bfloat16

non-standard 16-bit floating point with 7-bit mantissa

Custom Datatypes

oneCCL specification defines the way to register and deregister a custom datatype using the datatype_attr attribute object.

The list of identifiers that may be used to fill an attribute object:

enum class datatype_attr_id {
    size = /* unspecified */
};
datatype_attr_id::size

the size of the datatype in bytes

The environment class shall provide the ability to create a datatype attribute object, to register the datatype based on an attribute object, and to deregister the datatype.

Creating a datatype attribute object, which may used to register custom datatype:

using datatype_attr_t = unique_ptr_class<datatype_attr>;
datatype_attr_t environment::create_datatype_attr() const;
return datatype_attr_t

an object containing attributes for the custom datatype

Registering a custom datatype to be used in communication operations:

datatype environment::register_datatype(const datatype_attr_t& attr);
attr

the datatype’s attributes

return datatype

the handle for the custom datatype

Deregistering a custom datatype:

void environment::deregister_datatype(datatype dtype);
dtype

the handle for the custom datatype

Retrieving a datatype size in bytes:

size_t environment::get_datatype_size(datatype dtype) const;
dtype

the datatype’s handle

return size_t

datatype size in bytes