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

[BUG] deepmd/kk can bind Torch to a different GPU than Kokkos

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

メンテナーはふだん 4 日以内に返信

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
cpp, pytorch

調査の方向性

pair_base.cpp:39 と pair_dpa4spin.cpp:234 から始め、DeepPotPTExpt.cc:167-181 と NativeSpinPTExpt.cc:314-326 の初期化を、pair_deepmd_kokkos.cpp と pair_dpa4spin_kokkos.cpp のポインターパスと併せて追跡します。通常のパスと native-spin /kk パスで Kokkos device 1 を選択する 2 GPU のリグレッションを追加します。モデルのロードと raw-pointer tensor wrapper が同じ device を使用するか、不一致時に明確に失敗すれば完了です。

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

説明

bug
Summary

deepmd/kk and dpa4spin/kk can run Kokkos on one GPU while loading the Torch model on another. Raw Kokkos pointers are then wrapped as tensors tagged with the independently selected Torch device, causing invalid or illegal device memory access.

This is present on origin/master at 8cfd46e37448.

Trigger

On a node with at least two visible GPUs, launch one MPI rank while explicitly choosing Kokkos device 1, for example:

lmp -k on g 1 d 1 ...

Kokkos allocates its views on GPU 1. DeePMD passes node-local MPI rank 0 into model initialization (pair_base.cpp:39 and pair_dpa4spin.cpp:234), and the PT-experimental APIs independently choose:

gpu_id = gpu_rank % torch::cuda::device_count();

so the model is loaded on GPU 0 (DeepPotPTExpt.cc:167-181, NativeSpinPTExpt.cc:314-326).

The device path later passes raw Kokkos pointers from pair_deepmd_kokkos.cpp / pair_dpa4spin_kokkos.cpp. DeepPotPTExpt and NativeSpinPTExpt wrap those pointers with TensorOptions().device(cuda:gpu_id), which labels GPU-1 allocations as GPU-0 tensors.

Expected behavior

The model and all raw-pointer tensor wrappers must use Kokkos's actual device. The pair style should pass the selected Kokkos device to model initialization, or initialization should query and validate the active device and fail clearly on a mismatch.

A two-GPU regression should exercise an explicit nonzero Kokkos device for both ordinary and native-spin /kk paths.


Coding agent: Codex
Codex version: codex-cli 0.149.0
Model: gpt-5.6-sol
Reasoning effort: xhigh

主要言語
Python
スター
2.1k
フォーク
661
平均マージ
5日 13時間
マージ済み PR(30日)
11

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

deepmodeling/deepmd-kit のほかの issue

deepmodeling/deepmd-kit の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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