
topologyManagerPolicy: best-effort) to achieve NUMA affinity scheduling.feature.node.kubernetes.io/tke-shared-rdma=true by default:# Replace <nodeName> with the name of the existing node. You can query it by running kubectl get node.kubectl label node <nodeName> feature.node.kubernetes.io/tke-shared-rdma=true
Parameter | Description |
CpuRequest | CPU required by the component when the component is running on each node. Default value: 10m. |
CpuLimit | Maximum CPU occupied by the component when the component is running on each node. Default value: 50m. |
MemoryRequest | Memory required by the component when the component is running on each node. Default value: 100Mi. |
MemoryLimit | Maximum memory occupied by the component when the component is running on each node. Default value: 500Mi. |
KubeletRootDir | Root directory of kubelet on the node where the component runs. Default value: /var/lib/kubelet. If the root directory is changed, update this configuration accordingly. |
NodeSelector | label key-value pair of the node where the component is required to run. The default configuration is feature.node.kubernetes.io/tke-shared-rdma=true. To customize the node label for deployment, modify this configuration. |
tke-rdma-shared-agent components are in the Running state:kubectl -n kube-system get po -o wide -l k8s-app=tke-rdma-shared-agent
tke.cloud.tencent.com/tke-shared-rdma is not 0:kubectl describe node <nodeName> | grep tke-shared-rdma
tke.cloud.tencent.com/tke-shared-rdma: 8
annotations:tke.cloud.tencent.com/networks: "tke-bridge,tke-rdma-macvlan"
annotations:tke.cloud.tencent.com/networks: "tke-route-eni,tke-rdma-macvlan"
kubectl -n kube-system get cm tke-cni-agent-conf -o yaml | grep defaultDelegates
securityContext:capabilities:add: ["IPC_LOCK"]
resources:limits:nvidia.com/gpu: "8"tke.cloud.tencent.com/tke-shared-rdma: "8"
nvidia.com/gpu: The number of requested GPUs.tke.cloud.tencent.com/tke-shared-rdma: The number of requested RDMA devices. It is recommended to be equal to the number of GPUs.apiVersion: apps/v1kind: StatefulSetmetadata:labels:k8s-app: ibv-appname: ibv-appnamespace: defaultspec:replicas: 4selector:matchLabels:k8s-app: ibv-appqcloud-app: ibv-appserviceName: ""template:metadata:annotations:tke.cloud.tencent.com/networks: "tke-route-eni,tke-rdma-macvlan"creationTimestamp: nulllabels:k8s-app: ibv-appqcloud-app: ibv-appspec:containers:- command:- sh- -c- |ls -l /dev/infiniband /sys/class/infiniband /sys/class/netsleep 1000000image: ccr.ccs.tencentyun.com/tke-eni-test/mofed-5.4-3.1.0.0:ubuntu20.04-amd64-testimagePullPolicy: Alwaysname: ibv-app-ctrsecurityContext:capabilities:add: ["IPC_LOCK"]resources:limits:nvidia.com/gpu: "4"tke.cloud.tencent.com/tke-shared-rdma: "4"volumeMounts:- mountPath: /dev/shmname: dshmvolumes:- emptyDir:medium: MemorysizeLimit: 64Giname: dshm
rdma-test.yaml), and then deploy it:kubectl apply -f rdma-test.yaml
kubectl get pods -l k8s-app=ibv-app
kubectl exec -it ibv-app-0 -- bash
ibv_devinfo command to confirm that the RDMA device is functioning properly:# ibv_devinfohca_id: mlx5_bond_0transport: InfiniBand (0)fw_ver: 22.33.1048node_guid: 946d:ae03:00a9:3ed0sys_image_guid: 946d:ae03:00a9:3ed0vendor_id: 0x02c9vendor_part_id: 4125hw_ver: 0x0board_id: MT_0000000359phys_port_cnt: 1port: 1state: PORT_ACTIVE (4)max_mtu: 4096 (5)active_mtu: 4096 (5)sm_lid: 0port_lid: 0port_lmc: 0x00link_layer: Ethernet
show_gids command to obtain the GID. In the TKE RDMA solution, the GID index is uniformly the Host GID Index:# show_gidsDEV PORT INDEX GID IPv4 VER DEV--- ---- ----- --- ------------ --- ---mlx5_bond_0 1 0 fe80:0000:0000:0000:401d:55ff:fe14:6ce8 v1 bond0mlx5_bond_0 1 1 fe80:0000:0000:0000:401d:55ff:fe14:6ce8 v2 bond0mlx5_bond_0 1 2 0000:0000:0000:0000:0000:ffff:1e3d:b4ac 30.61.180.172 v1 bond0mlx5_bond_0 1 3 0000:0000:0000:0000:0000:ffff:1e3d:b4ac 30.61.180.172 v2 bond0
ibv_rc_pingpong command to test RDMA connectivity:# ibv_rc_pingpong -d mlx5_bond_0 -g 3local address: LID 0x0000, QPN 0x003a22, PSN 0xc882ae, GID ::ffff:30.61.130.20remote address: LID 0x0000, QPN 0x001234, PSN 0x58320b, GID ::ffff:30.61.180.1728192000 bytes in 0.01 seconds = 7687.51 Mbit/sec1000 iters in 0.01 seconds = 8.52 usec/iter
# ibv_rc_pingpong -d mlx5_bond_0 -g 3 30.61.130.20local address: LID 0x0000, QPN 0x001234, PSN 0x58320b, GID ::ffff:30.61.180.172remote address: LID 0x0000, QPN 0x003a22, PSN 0xc882ae, GID ::ffff:30.61.130.208192000 bytes in 0.01 seconds = 7924.55 Mbit/sec1000 iters in 0.01 seconds = 8.27 usec/iter
ib_write_bw command to test RDMA write bandwidth:# ib_write_bw -d mlx5_bond_0 -x 3************************************* Waiting for client to connect... *************************************---------------------------------------------------------------------------------------RDMA_Write BW TestDual-port : OFF Device : mlx5_bond_0Number of qps : 1 Transport type : IBConnection type : RC Using SRQ : OFFCQ Moderation : 100Mtu : 4096[B]Link type : EthernetGID index : 3Max inline data : 0[B]rdma_cm QPs : OFFData ex. method : Ethernet---------------------------------------------------------------------------------------local address: LID 0000 QPN 0x3a25 PSN 0x8877cd RKey 0x00ca88 VAddr 0x007fb84630d000GID: 00:00:00:00:00:00:00:00:00:00:255:255:30:61:130:20remote address: LID 0000 QPN 0x1235 PSN 0xe2acbc RKey 0x007c3e VAddr 0x007f8f164b7000GID: 00:00:00:00:00:00:00:00:00:00:255:255:30:61:180:172---------------------------------------------------------------------------------------#bytes #iterations BW peak[MB/sec] BW average[MB/sec] MsgRate[Mpps]65536 5000 97.50 97.49 0.185950---------------------------------------------------------------------------------------
# ib_write_bw -d mlx5_bond_0 -x 3 30.61.130.20 --report_gbits---------------------------------------------------------------------------------------RDMA_Write BW TestDual-port : OFF Device : mlx5_bond_0Number of qps : 1 Transport type : IBConnection type : RC Using SRQ : OFFTX depth : 128CQ Moderation : 100Mtu : 4096[B]Link type : EthernetGID index : 3Max inline data : 0[B]rdma_cm QPs : OFFData ex. method : Ethernet---------------------------------------------------------------------------------------local address: LID 0000 QPN 0x1235 PSN 0xe2acbc RKey 0x007c3e VAddr 0x007f8f164b7000GID: 00:00:00:00:00:00:00:00:00:00:255:255:30:61:180:172remote address: LID 0000 QPN 0x3a25 PSN 0x8877cd RKey 0x00ca88 VAddr 0x007fb84630d000GID: 00:00:00:00:00:00:00:00:00:00:255:255:30:61:130:20---------------------------------------------------------------------------------------#bytes #iterations BW peak[Gb/sec] BW average[Gb/sec] MsgRate[Mpps]65536 5000 97.50 97.49 0.185950---------------------------------------------------------------------------------------
ib_write_lat -d mlx5_bond_0 -x 3
ib_write_lat -d mlx5_bond_0 -x 3 <server-ip>
ib_send_bw -d mlx5_bond_0 -x 3
ib_send_bw -d mlx5_bond_0 -x 3 <server-ip> --report_gbits
ib_send_lat -d mlx5_bond_0 -x 3
ib_send_lat -d mlx5_bond_0 -x 3 <server-ip>
ib_read_bw -d mlx5_bond_0 -x 3
ib_read_bw -d mlx5_bond_0 -x 3 <server-ip> --report_gbits
ib_read_lat -d mlx5_bond_0 -x 3
ib_read_lat -d mlx5_bond_0 -x 3 <server-ip>
apiVersion: apps/v1kind: StatefulSetmetadata:labels:k8s-app: nccl-testname: nccl-testnamespace: defaultspec:replicas: 2selector:matchLabels:k8s-app: nccl-testqcloud-app: nccl-testserviceName: ""template:metadata:annotations:tke.cloud.tencent.com/networks: "tke-route-eni,tke-rdma-macvlan"creationTimestamp: nulllabels:k8s-app: nccl-testqcloud-app: nccl-testspec:containers:- command:- sh- -c- |ls -l /dev/infiniband /sys/class/infiniband /sys/class/netsleep 1000000image: ccr.ccs.tencentyun.com/qcloud-ti-platform/nccl_ofed:cu12.0imagePullPolicy: IfNotPresentname: nccl-testsecurityContext:capabilities:add: ["IPC_LOCK"]resources:limits:nvidia.com/gpu: "8"tke.cloud.tencent.com/tke-shared-rdma: "8"volumeMounts:- mountPath: /dev/shmname: dshmvolumes:- emptyDir:medium: MemorysizeLimit: 64Giname: dshm
nccl-test.yaml), and then deploy it:kubectl apply -f nccl-test.yaml
kubectl get pods -l k8s-app=nccl-test
# Generate a keyssh-keygen# View the public keycat ~/.ssh/id_rsa.pub
# Create the sshd runtime directorymkdir -p /run/sshd# Start sshd/usr/sbin/sshd# Create the .ssh directorymkdir -p ~/.ssh# Add the public key of nccl-test-0 to authorized_keys# <id_rsa.pub> is the content of /root/.ssh/id_rsa.pub in the nccl-test-0 Podecho "<id_rsa.pub>" >> ~/.ssh/authorized_keys
# Run the following on nccl-test-0ssh root@172.21.5.6
mpirun on nccl-test-0 starts the NCCL all_reduce_perf test:mpirun --allow-run-as-root -np 16 \\-npernode 8 -H 172.21.4.8:8,172.21.5.6:8 \\-mca btl_tcp_if_include bond0 \\-x NCCL_IB_DISABLE=0 \\-x NCCL_IB_GID_INDEX=3 \\-x NCCL_DEBUG=INFO \\/root/nccltest/all_reduce_perf -b 1G -e 1G -f 2 -g 1 -n 20
--allow-run-as-root: Allows running as the root user.-np 16: The total number of processes (2 nodes × 8 GPUs).-npernode 8: The number of processes per node.-H 172.21.4.8:8,172.21.5.6:8: Specifies the hosts and the number of processes per host.btl_tcp_if_include: Specifies the network interface used for OpenMPI runtime communication. Because the network environment has multiple network segments (each RDMA has its own segment, and eth0 has one segment), you must specify to use only bond0 or eth0 for communication. If this variable is not set, the following error occurs: Open MPI failed to TCP connect to a peer MPI process.NCCL_IB_DISABLE: 0 indicates that NCCL uses IB/RoCE for transport, and 1 disables IB/RoCE transport for NCCL. In this case, NCCL falls back to IP sockets.NCCL_IB_GID_INDEX: Specifies the global ID index used in RoCE mode. To obtain it, see the Verifying RDMA Devices section in this document. Note: This variable only needs to be set before NCCL 2.21. In NCCL 2.21 and later, the value is set dynamically and does not need to be configured. For details, see the official NCCL documentation.NCCL_DEBUG: Controls the debug information displayed by NCCL.-b 1G: The initial data size is 1 GB.-e 1G: The final data size is 1 GB.-f 2: The growth factor for the data size.-g 1: The number of GPUs used by each process.-n 20: The number of iterations.## out-of-place in-place# size count type redop root time algbw busbw #wrong time algbw busbw #wrong# (B) (elements) (us) (GB/s) (GB/s) (us) (GB/s) (GB/s)1073741824 268435456 float sum -1 6455.8 166.32 311.85 0 6426.3 167.09 313.29 0# Out of bounds values : 0 OK# Avg bus bandwidth : 312.571#
size: Data size in bytes.time: Operation duration in microseconds.algbw: Algorithm bandwidth in GB/s.busbw: Bus bandwidth in GB/s.Avg bus bandwidth: The average bus bandwidth, which is a key metric for measuring RDMA performance.busbw reaches a high value (typically greater than 300 GB/s), the RDMA network is configured successfully and can be used for distributed training tasks.NCCL_IB_GID_INDEX=3 environment variable.Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan