Skip to content

[espresso] QE GPU(CUDA/OpenACC)ビルドモード追加(kugui A100 検証済み) - #201

Open
k-yoshimi wants to merge 2 commits into
developfrom
feat/espresso-gpu
Open

[espresso] QE GPU(CUDA/OpenACC)ビルドモード追加(kugui A100 検証済み)#201
k-yoshimi wants to merge 2 commits into
developfrom
feat/espresso-gpu

Conversation

@k-yoshimi

Copy link
Copy Markdown
Collaborator

概要

apps/espresso(QE 7.3, CMake)に GPU ビルドモード config/gpu を追加します。QE の first-class な GPU 対応(-DQE_ENABLE_CUDA=ON)を使い、NVHPC コンパイラ(nvfortran/nvc)+ CUDA-aware MPI で GPU 版 pw.x 等をビルドします。

追加内容

  • config/gpu/preprocess.sh: -DQE_ENABLE_CUDA=ON -DQE_ENABLE_OPENACC=ON -DQE_ENABLE_OPENMP=ON -DQE_ENABLE_MPI=ON -DQE_ENABLE_SCALAPACK=OFFCC=nvc/FC=nvfortran。build/install は既存の default にフォールバック。
  • test/scf.in を CRLF → LF に変換: DOS 改行は CPU 版 QE(gfortran/ifort)では許容されるが、nvfortran ビルドの pw.x は入力カードを弾くATOMIC_SPECIES ignored)。LF なら CPU/GPU 双方で動作。
  • README(en/ja)に GPU モードの前提(NVHPC/CUDA、MA_EXTRA_FLAGS="-gpu=ccXX" での arch 指定、CI 対象外)を明記。

GPU arch について

nvfortran は既定でビルドノードの GPU を対象にするため、MateriApps の「対象マシンでビルド」フローでは追加設定不要です。対象 GPU の無いノードでビルドする場合のみ MA_EXTRA_FLAGS="-gpu=cc80"(A100)等で指定します。

検証(物性研 kugui, NVIDIA A100, PBS GPU ノード)

  • NVHPC 24.5 + CUDA 12.4 + openmpi_nvhpc で configure/build 成功、pw.x が CUDA ライブラリにリンク。
  • 実 GPU 実行(Si scf): GPU acceleration is ACTIVE. 1 visible GPUs per MPI rank / JOB DONE.pw.x exit 0)。

CI について

本モードは NVIDIA GPU + NVHPC/CUDA が必要なため GitHub CI では検証不可(ランナーに GPU/NVHPC 無し)。既存の CPU モード(default/intel/amd)の CI はそのままです。kugui GPU ノードでの実機検証が検証手段です。

🤖 Generated with Claude Code

New config/gpu mode builds the NVIDIA GPU port of Quantum ESPRESSO with the
NVHPC compilers (nvfortran/nvc) via -DQE_ENABLE_CUDA=ON (OpenACC + OpenMP +
MPI, ScaLAPACK off). Requires an NVHPC/CUDA toolchain and a CUDA-aware MPI;
nvfortran targets the build node's GPU by default, overridable with
MA_EXTRA_FLAGS="-gpu=ccXX". This mode needs a GPU and is not covered by CI.

Also convert test/scf.in from CRLF to LF: the DOS line endings are tolerated
by CPU QE (gfortran/ifort) but make nvfortran-built pw.x reject the input
cards ("ATOMIC_SPECIES ignored"). LF works for both.

Verified on ISSP kugui (A100, PBS GPU node): the build links CUDA and pw.x
reports "GPU acceleration is ACTIVE. 1 visible GPUs per MPI rank" / JOB DONE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaWKJsSQqCakkMEKZpJcvP
make_rst.py mirrors apps/espresso/README.md into the Sphinx appendix stub;
add the same GPU build section to the en/ja appendix so they stay in sync.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QaWKJsSQqCakkMEKZpJcvP
@k-yoshimi

Copy link
Copy Markdown
Collaborator Author

AI レビューサイクル結果(Codex + Antigravity)

Phase 1 — Codex(コード correctness)

  • must_fix / should_fix / optional: なし。GPU モードの CMake フラグ(QE_ENABLE_CUDA/OPENACC/OPENMP/MPI, ScaLAPACK off)、CC=nvc/FC=nvfortran(ユーザ指定があれば優先)、default への build/install フォールバック、set -u の安全性、scf.in の LF 化が数値内容を変えていないこと、を確認。

Phase 2 — Antigravity(ドキュメント / ワークフロー)

  • must_fix_docs(対応済み): apps README に追記した GPU セクションが Sphinx appendix stub(README_espresso.rst en/ja)に未反映 → appendix を同期make_rst.py が README を appendix に反映する設計のため)。
  • 補足(対応不要と判断): misc/make_readme*.py は HDF5 カタログから README を再生成し得るが、実運用では README は手編集(PR docs: appendix をアプリ README から全再生成(陳腐化解消) #192 で dcore/triqs README を手動追加した実績)なので低リスク。optional の「runtest は GPU ノードで」は CI 非対象・GPU 必須の記載で実質伝わるため省略。

検証

物性研 kugui(A100)で pw.x"GPU acceleration is ACTIVE. 1 visible GPUs per MPI rank" / JOB DONE(exit 0)を実機確認済み。本モードは GPU/NVHPC が必要で CI 非対象(既存 CPU モードの CI は不変)。

must_fix 系は無し/指摘は対応済み。収束と判断します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants