Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

possible bug in python/fedml/core/distributed/communication/trpc/utils.py

オープン
#2,002 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python, pytorch

調査の方向性

python/fedml/core/distributed/communication/trpc/utils.py と federate/cross_silo/cuda_rpc_fedavg_mnist_lr_example エントリポイントから始めます。1 台の GPU、1 台のサーバー、2 台のクライアントでの起動を再現し、その後、set_device_map が device_list のマッピングをどのように処理するかを調べます。例が無効なデバイスインデックスエラーなしで起動し、デバイスマップが設定された GPU 値を使用すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Hi,

I was trying to launch federate/cross_silo/cuda_rpc_fedavg_mnist_lr_example, mapping all processes (1 server and 2 clients) to a single gpu.

it ended with error

File "/home/myhome/.local/lib/python3.10/site-packages/torch/distributed/rpc/backend_registry.py", line 235, in _validate_device_maps
    raise ValueError(
ValueError: Node worker0 has target devices with invalid indices in its device map for worker2
device map = {device(type='cuda', index=0): device(type='cuda', index=2)}
device count = 1

I suspect there is a bug in python/fedml/core/distributed/communication/trpc/utils.py

# Generate Device Map for Cuda RPC
def set_device_map(options, worker_idx, device_list):
    local_device = device_list[worker_idx]
    for index, remote_device in enumerate(device_list):
        logging.warn(f"Setting device map for client {index} as {remote_device}")
        if index != worker_idx:
            options.set_device_map(WORKER_NAME.format(index), {local_device: remote_device})

here device_list is a dict {0:0, 1:0, 2:0}, but enumerate iterates over its keys and then assigns the key (0,1,2) as local_device.

I tried to correct this as

    for index, remote_device in enumerate(device_list):
        logging.warn(f"Setting device map for client {index} as {device_list[remote_device]}")
        if index != worker_idx:
            options.set_device_map(WORKER_NAME.format(index), {local_device: device_list[remote_device]})

and the example worked ok.

主要言語
Python
スター
4.1k
フォーク
770
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

FedML-AI/FedML のほかの issue

FedML-AI/FedML の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。