본문 바로가기

HPC

LAMMPS Process Mapping in OpenMPI - (1) Basic

CPU 코어 구성확인

lstopo --of svg --no-io --no-os numa_simple.svg

 

뒤따라 나오는 에러는 무시해도 된다.

아래는 Threadripper 7995WX Pro

 

Numa Node는 총 4개, L#는 논리코어 넘버, P#는 물리코어 넘버이다.

  1. NUMA Node 0 : [core:0-7,32-39,64-71]
  2. NUMA Node 1 : [core:8-15,40-47,72-79]
  3. NUMA Node 2 : [core:16-23,48-55,80-87]
  4. NUMA Node 3 : [core:24-31,56-63,88-95]

32개 프로세스로 테스트, --report-bindings 옵션을 쓰면 프로세스 배치 결과가 나온다

mpirun -np 32 --report-bindings

 

배치결과, NUMA Node 0을 순서대로 다 채우고 Node 1로 넘어간다.

--report-bindings의 결과로 프린트 되는 core는 물리코어 P#를 나타낸다.

[dell7875:528338] Rank 0 bound to package[0][core:0]
[dell7875:528338] Rank 1 bound to package[0][core:1]
[dell7875:528338] Rank 2 bound to package[0][core:2]
[dell7875:528338] Rank 3 bound to package[0][core:3]
[dell7875:528338] Rank 4 bound to package[0][core:4]
[dell7875:528338] Rank 5 bound to package[0][core:5]
[dell7875:528338] Rank 6 bound to package[0][core:6]
[dell7875:528338] Rank 7 bound to package[0][core:7]

[dell7875:528338] Rank 8 bound to package[0][core:32]
[dell7875:528338] Rank 9 bound to package[0][core:33]
[dell7875:528338] Rank 10 bound to package[0][core:34]
[dell7875:528338] Rank 11 bound to package[0][core:35]
[dell7875:528338] Rank 12 bound to package[0][core:36]
[dell7875:528338] Rank 13 bound to package[0][core:37]
[dell7875:528338] Rank 14 bound to package[0][core:38]
[dell7875:528338] Rank 15 bound to package[0][core:39]

[dell7875:528338] Rank 16 bound to package[0][core:64]
[dell7875:528338] Rank 17 bound to package[0][core:65]
[dell7875:528338] Rank 18 bound to package[0][core:66]
[dell7875:528338] Rank 19 bound to package[0][core:67]
[dell7875:528338] Rank 20 bound to package[0][core:68]
[dell7875:528338] Rank 21 bound to package[0][core:69]
[dell7875:528338] Rank 22 bound to package[0][core:70]
[dell7875:528338] Rank 23 bound to package[0][core:71]

[dell7875:528338] Rank 24 bound to package[0][core:8]
[dell7875:528338] Rank 25 bound to package[0][core:9]
[dell7875:528338] Rank 26 bound to package[0][core:10]
[dell7875:528338] Rank 27 bound to package[0][core:11]
[dell7875:528338] Rank 28 bound to package[0][core:12]
[dell7875:528338] Rank 29 bound to package[0][core:13]
[dell7875:528338] Rank 30 bound to package[0][core:14]
[dell7875:528338] Rank 31 bound to package[0][core:15]

 

LAMMPS Script에서 사용된 명령어는 다음과 같다. 공간 분할은 인위적으로 하지 말고 Lammps에 맡기는게 최선이라고 커뮤니티에서 이야기 하더라.

processors      * * * grid numa numa_nodes 4 file domainDecomp.txt

 

Domain Decomposition된 결과 파일의 양식은 다음과 같다

바닥부터 순차적으로 쌓아올리지 않고, 분할하여 쌓아 올린다

Y축 방향으로 1-2 구역을 쌓아올리고, 그 다음 3-4구역을 쌓아 올린다.

$ cat domainDecomp.txt
LAMMPS mapping of processors to 3d grid
partition = 1
Px Py Pz = 2 4 4
world-ID universe-ID original-ID: I J K: name

0 0 0: 1 1 1: dell7875
1 1 1: 2 1 1: dell7875
2 2 2: 1 2 1: dell7875
3 3 3: 2 2 1: dell7875
4 4 4: 1 1 2: dell7875
5 5 5: 2 1 2: dell7875
6 6 6: 1 2 2: dell7875
7 7 7: 2 2 2: dell7875
8 8 8: 1 1 3: dell7875
9 9 9: 2 1 3: dell7875
10 10 10: 1 2 3: dell7875
11 11 11: 2 2 3: dell7875
12 12 12: 1 1 4: dell7875
13 13 13: 2 1 4: dell7875
14 14 14: 1 2 4: dell7875
15 15 15: 2 2 4: dell7875
16 16 16: 1 3 1: dell7875
17 17 17: 2 3 1: dell7875
18 18 18: 1 4 1: dell7875
19 19 19: 2 4 1: dell7875
20 20 20: 1 3 2: dell7875
21 21 21: 2 3 2: dell7875
22 22 22: 1 4 2: dell7875
23 23 23: 2 4 2: dell7875
24 24 24: 1 3 3: dell7875
25 25 25: 2 3 3: dell7875
26 26 26: 1 4 3: dell7875
27 27 27: 2 4 3: dell7875
28 28 28: 1 3 4: dell7875
29 29 29: 2 3 4: dell7875
30 30 30: 1 4 4: dell7875
31 31 31: 2 4 4: dell7875

 

Rank 15-16 사이의 Ghost는 전혀 발생하지 않는다. 그러므로 Cache를 공유할 필요는 없다

현재 Rank 15-16은 같은 NUma Node이지만 L3 Cache를 공유하지는 않는다.

NUMA Node는 0-1을 사용하여 효율성이 좋지는 않다.

 

--display-map 옵션
$ mpirun -np 32 --map-by ppr:16:numa --report-bindings --display-map lmp -var maxSStrain 1.0 -var period 2.0 -var nCycle 5 -in in.ST3.MSCDSS 2> bindings.log

========================   JOB MAP   ========================
Data for JOB prterun-dell7875-529585@1 offset 0 Total slots allocated 96
    Mapping policy: BYNUMA:NOOVERSUBSCRIBE  Ranking policy: SLOT Binding policy: NUMA:IF-SUPPORTED
    Cpu set: N/A  PPR: 16:numa  Cpus-per-rank: N/A  Cpu Type: CORE