Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#5,994 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 4 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp, pytorch
Lĩnh vực
machine-learning

Hướng nghiên cứu

Bắt đầu với pair_base.cpp:39 và pair_dpa4spin.cpp:234, sau đó lần theo quá trình khởi tạo trong DeepPotPTExpt.cc:167-181 và NativeSpinPTExpt.cc:314-326 cùng với các đường dẫn con trỏ trong pair_deepmd_kokkos.cpp và pair_dpa4spin_kokkos.cpp. Thêm một hồi quy hai GPU chọn Kokkos device 1 cho các đường dẫn ordinary và native-spin /kk; hoàn tất khi việc tải mô hình và các tensor wrapper dùng raw pointer sử dụng cùng một device hoặc thất bại rõ ràng khi không khớp.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Python
Star
2.1k
Fork
662
Merge trung bình
5 ngày 13 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của deepmodeling/deepmd-kit

Tất cả issue của deepmodeling/deepmd-kit

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.