Topology (TorchRec)

This API is an open-source API of the TorchRec and is not an external API of the Rec SDK Torch. This section describes the parameter ranges supported by the TorchRec APIs called when the Rec SDK Torch is used.

Function

Saves parameters of the distributed environment.

Prototype

1
2
class Topology:
    def __init__(**kwargs):

Parameters

Parameter

Data Type

Mandatory/Optional

Description

world_size

int

Mandatory

Number of used devices. Value range: [1, 8]

compute_device

str

Mandatory

Device name.

When NPU devices are used, the value is "npu".

hbm_cap

int

Optional

When an NPU is used, the value can only be the default value None and cannot be customized.

ddr_cap

int

Optional

When an NPU is used, the value can only be the default value None and cannot be customized.

local_world_size

int

Optional

When an NPU is used, the value can only be the default value None and cannot be customized.

hbm_mem_bw

float

Optional

When an NPU is used, the value can only be the default value (897 x 1024 x 1024 x 1024/1000) and cannot be customized.

ddr_mem_bw

float

Optional

When an NPU is used, the value can only be the default value (51 x 1024 x 1024 x 1024/1000) and cannot be customized.

hbm_to_ddr_mem_bw

float

Optional

When an NPU is used, the value can only be the default value (32 x 1024 x 1024 x 1024/1000) and cannot be customized.

intra_host_bw

float

Optional

When an NPU is used, the value can only be the default value (600 x 1024 x 1024 x 1024/1000) and cannot be customized.

inter_host_bw

float

Optional

When an NPU is used, the value can only be the default value (12.5 x 1024 x 1024 x 1024/1000) and cannot be customized.

bwd_compute_multiplier

float

Optional

When an NPU is used, the value can only be the default value 2 and cannot be customized.

custom_topology_data

torchrec.distribute.planner.types.CustomTopologyData

Optional

When an NPU is used, the value can only be the default value None and cannot be customized.

weighted_feature_bwd_compute_multiplier

float

Optional

When an NPU is used, the value can only be the default value 1 and cannot be customized.

uneven_sharding_perf_multiplier

float

Optional

When an NPU is used, the value can only be the default value 1 and cannot be customized.

Sample

1
2
from torchrec.distributed.planner import Topology
topo = Topology(world_size=world_size, compute_device="npu")

See Also

For details about the API call sequence and example, see Porting and Training.