LAMMPS環境構築 | MPI並列対応 | Docker | MacOS | 24/9/27, 24/10/2

参照先

  • DockerでLAMMPSが簡単に動かせる!
https://home.tech-office-mori.com/blog/lammps-docker-nvidia
  • LAMMPSのDockerイメージを自分でビルドしてみる
https://home.tech-office-mori.com/blog/lammps-docker

実行環境

  • MacBook Pro(2018)
  • プロセッサ:2.3 GHz クアッドコアIntel Core i5
  • グラフィックス:Intel Iris Plus Graphics 655 1536 MB
  • メモリ:16 GB 2133 MHz LPDDR3
  • OS:macOS Sequoia バージョン15.0(24A335)

Docker Desktopのインストール

Docker Desktop
Docker Desktop is collaborative containerization software for developers. Get started and download Docker Desktop today ...

以下では,このDockerDesktopを立ち上げた状態で作業を進める必要がある.

Docker imageをダウンロードする

好きなディレクトリで以下を実行.

docker image pull lammps/lammps:stable_29Sep2021_ubuntu20.04_openmpi_py3

以下が標準出力された.筆者の環境では,10分弱要した.

stable_29Sep2021_ubuntu20.04_openmpi_py3: Pulling from lammps/lammps
9e3347dcfa46: Download complete 
d72a1af5d27c: Download complete 
44aef09d03e8: Download complete 
88aa8dc198ce: Download complete 
269f7a444e6c: Download complete 
71e1dfb54de9: Download complete 
8bf3818eb044: Download complete 
1fe15817a8de: Download complete 
0f0d244c8479: Download complete 
298ab4780037: Download complete 
d8fad826592b: Download complete 
08c01a0ec47e: Download complete 
3ed986367839: Download complete 
22594cd36fe0: Download complete 
Digest: sha256:4ce3adcff72f6a4d3d4feeddb032d0e0781be70fa35273bad01a7dec21214d20
Status: Downloaded newer image for lammps/lammps:stable_29Sep2021_ubuntu20.04_openmpi_py3
docker.io/lammps/lammps:stable_29Sep2021_ubuntu20.04_openmpi_py3

確認のため,

docker image ls

標準出力:

REPOSITORY      TAG                                        IMAGE ID       CREATED       SIZE
lammps/lammps   stable_29Sep2021_ubuntu20.04_openmpi_py3   4ce3adcff72f   2 years ago   1.85GB

Docker imageからcontainerを作成し起動

以下を実行.

docker container run lammps/lammps

標準出力:

Unable to find image 'lammps/lammps:latest' locally
latest: Pulling from lammps/lammps
456877644a46: Download complete 
634f8c1c838b: Download complete 
ce72d9827afe: Download complete 
d4b7ec39014f: Download complete 
18e5b6bdb774: Download complete 
e995c13f1467: Download complete 
1ea75b14c185: Download complete 
22887bef8ee2: Download complete 
7957b2fc972d: Download complete 
d434f5770241: Download complete 
59cfb1df68b5: Download complete 
16ec32c2132b: Download complete 
2f0077a81bf5: Download complete 
c1b1499b48b8: Download complete 
Digest: sha256:1aceb06072dad66be526619e3a36c22827858c457c0fee4b99defcb185c8a1ef
Status: Downloaded newer image for lammps/lammps:latest
LAMMPS (30 Jul 2021)
OMP_NUM_THREADS environment is not set. Defaulting to 1 thread. (src/comm.cpp:98)
  using 1 OpenMP thread(s) per MPI task
Total wall time: 0:00:00

コンテナが起動できているか確認.

docker container ls

stdout:

CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

コンテナが起動できているか全ての状態のものを確認.

docker container ls -a

stdout:

CONTAINER ID   IMAGE           COMMAND                   CREATED         STATUS                     PORTS     NAMES
5f755fb99077   lammps/lammps   "/bin/sh -c /usr/bin…"   4 minutes ago   Exited (0) 4 minutes ago             sad_hawking

Docker上でLAMMPSの計算実行

gitのインストール

参照先

【Mac】Gitの環境構築をしよう!
Progateはオンラインでプログラミングを学べるサービスです。プログラミングを学んでWEBアプリケーションを作ろう。
git --version

stdout:

git version 2.39.3 (Apple Git-146)

Githubから入力ファイルダウンロード

pwd
/Users/li/Documents

mkdir Research
cd Research 

git clone https://github.com/k-morii-toridai/argon_melt_ini_coords_240808_414.git
Cloning into 'argon_melt_ini_coords_240808_414'...
Username for 'https://github.com': k-morii-toridai
Password for 'https://k-morii-toridai@github.com': 

remote: Enumerating objects: 68, done.
remote: Counting objects: 100% (68/68), done.
remote: Compressing objects: 100% (50/50), done.
remote: Total 68 (delta 26), reused 54 (delta 17), pack-reused 0 (from 0)
Receiving objects: 100% (68/68), 1.16 MiB | 1000.00 KiB/s, done.
Resolving deltas: 100% (26/26), done.
cd argon_melt_ini_coords_240808_414 
git branch -r
  origin/HEAD -> origin/main
  origin/dev
  origin/main
  origin/temperature/40K
  origin/temperature/50K
  origin/temperature/60K
  origin/temperature/70K
git checkout -b temperature/50K origin/temperature/50K  

stdout:

branch 'temperature/50K' set up to track 'origin/temperature/50K'.
Switched to a new branch 'temperature/50K'

Docker上でLAMMPSの計算実行

docker imageのIDを確認.

docker image ls

stdout:

REPOSITORY      TAG                                        IMAGE ID       CREATED       SIZE
lammps/lammps   stable_29Sep2021_ubuntu20.04_openmpi_py3   4ce3adcff72f   2 years ago   1.85GB
lammps/lammps   latest                                     1aceb06072da   3 years ago   1.85GB

今回は,IMAGE IDが4ce3adcff72fのものを使用する.

以下のように,LAMMPSのコマンドを実行.

docker container run --volume $(pwd):/home/lammps -it 4ce3adcff72f mpirun -np 2 lmp_mpi -i Ar_npt.in

計算が実行された.

コメント

タイトルとURLをコピーしました