0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

NGCで遊んでみよう! -LAMMPS編-

Posted at

NGCで遊んでみた記録。

NGCとは

ディープラーニングやHPCのためにGPUに最適化されたソフトウェアのハブ。最近はディープラーニングのモデルやモデルスクリプトも登場している。

LAMMPSとは

有名な古典MDのソフトウェア。私は第一原理電子状態計算屋さんなので、これ以上の説明は無理。。

環境

最新じゃないけど、遊ぶには十分。なはず。

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 410.66       Driver Version: 410.66       CUDA Version: 10.0     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GTX 1080    Off  | 00000000:02:00.0 Off |                  N/A |
| 29%   44C    P8     5W / 180W |      2MiB /  8119MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

実行モジュールの準備

NGCからコンテナをpullするだけ。

$ docker pull nvcr.io/hpc/lammps:24Oct2018

サンプルの実行

exampleをダウンロードしておく。

$ git clone https://github.com/lammps/lammps

このディレクトリをマウントしてコンテナ起動。今回はインタラクティブで使ってみる。なお、このやり方だとログファイルとかがroot権限で書かれてしまうので注意が必要。避けたい場合は起動時に -u $(id -u):$(id -g) を付けるとか、Singularityを使うとか、何らかの工夫が必要。

$ sudo docker run --runtime=nvidia -v $(pwd):/workspace --rm -it nvcr.io/hpc/lammps:24Oct2018

CPUで実行

# cd /workspace/lammps/examples/accelerate/
# lmp -in in.lj
LAMMPS (24 Oct 2018)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:87)
  using 1 OpenMP thread(s) per MPI task
...
  (1) pair lj/cut, perpetual
      attributes: half, newton on
      pair build: half/bin/atomonly/newton
      stencil: half/bin/3d/newton
      bin: standard
...
MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 1.5477     | 1.5477     | 1.5477     |   0.0 | 86.35
Neigh   | 0.19001    | 0.19001    | 0.19001    |   0.0 | 10.60
Comm    | 0.016558   | 0.016558   | 0.016558   |   0.0 |  0.92
Output  | 0.00013641 | 0.00013641 | 0.00013641 |   0.0 |  0.01
Modify  | 0.031982   | 0.031982   | 0.031982   |   0.0 |  1.78
Other   |            | 0.006075   |            |       |  0.34
...
Total # of neighbors = 1202833
Ave neighs/atom = 37.5885
Neighbor list builds = 5
Dangerous builds not checked
Total wall time: 0:00:01

GPUで実行

# cd /workspace/lammps/examples/accelerate/
# lmp -k on g 1 -sf kk -in in.lj
LAMMPS (24 Oct 2018)
KOKKOS mode is enabled (src/KOKKOS/kokkos.cpp:77)
  will use up to 1 GPU(s) per node
  using 1 OpenMP thread(s) per MPI task
package kokkos
...
  (1) pair lj/cut/kk, perpetual
      attributes: full, newton off, kokkos_device
      pair build: full/bin/kk/device
      stencil: full/bin/3d
      bin: kk/device
...
MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    | 0.0033382  | 0.0033382  | 0.0033382  |   0.0 |  3.03
Neigh   | 0.033471   | 0.033471   | 0.033471   |   0.0 | 30.42
Comm    | 0.011485   | 0.011485   | 0.011485   |   0.0 | 10.44
Output  | 0.00015949 | 0.00015949 | 0.00015949 |   0.0 |  0.14
Modify  | 0.058974   | 0.058974   | 0.058974   |   0.0 | 53.59
Other   |            | 0.00261    |            |       |  2.37
...
Total # of neighbors = 2405666
Ave neighs/atom = 75.1771
Neighbor list builds = 5
Dangerous builds not checked
Total wall time: 0:00:00

よくよく見るとpairの計算方法が揃ってないみたいだけど、ちゃんとGPUで動いててそれなりの速さで動いてるようなので、とりあえずOKってことで。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?