본문 바로가기

LAMMPS

Performance Optimization

MPI task timing breakdown:
Section |  min time  |  avg time  |  max time  |%varavg|  %CPU | %total
-----------------------------------------------------------------------
Pair    | 23.23      | 29.199     | 35.149     |  54.5 | 106.3 |  2.43
Bond    | 0.3972     | 0.41134    | 0.42617    |   1.2 | 100.0 |  0.03
Neigh   | 2.2348     | 3.4266     | 4.8853     |  33.5 | 196.6 |  0.29
Comm    | 383.68     | 490.02     | 619.07     | 457.6 | 179.7 | 40.82
Output  | 0.37603    | 11.582     | 224.97     | 922.6 | 182.3 |  0.96
Modify  | 538        | 662.53     | 769.43     | 401.1 | 180.3 | 55.19
Other   |            | 3.171      |            |       |       |  0.26

Thread timing breakdown (MPI rank 0):
Total threaded time 21.88 / 1.8%
Section |  min time  |  avg time  |  max time  |%varavg| %total
---------------------------------------------------------------
Pair    |     14.889 |     15.294 |       15.7 |  10.4 | 69.89
Bond    |          0 |          0 |          0 |   0.0 |  0.00
Neigh   |     2.3643 |     2.4087 |     2.4532 |   2.9 | 11.01
Reduce  |     3.8137 |     4.1797 |     4.5458 |  17.9 | 19.10

Nlocal:        3406.79 ave        3914 max        2937 min
Histogram: 6 4 3 6 9 4 5 0 6 5
Nghost:        6479.69 ave       10529 max        3331 min
Histogram: 7 1 6 11 3 5 10 1 0 4
Neighs:        24880.4 ave       33088 max       15918 min
Histogram: 3 4 3 4 5 11 5 5 4 4

Total # of neighbors = 1194258
Ave neighs/atom = 7.3031689
Ave special neighs/atom = 0
Neighbor list builds = 500
Dangerous builds = 0
Total wall time: 0:21:54"

 

위는 Run결과에 대한 정리표이다. 효율을 극대화 하기 위해서는 Comm, Modify의 비율을 가능한 줄여야 하며 Pair의 비율이 높아져야 한다.

OMP Theread에서 CPU점유율을 보면, Pair, Neigh, Reduce에 분산되어 자원이 활용됨을 알 수 있다.

 

다음은 neighboring list 부분이다. 조성된 Atoms로 부터, Maximum diameter를 추출해서 neighboring bin의 크기를 결정하고자 한다.

compute         dia     all     property/atom diameter      # 1) Per-atom diameter (already stored for sphere atoms) -> this is vector
compute         maxdia  all     reduce max c_dia            # 2) Reduce vectot to scalar over all atoms and take the maximum 
variable        MaxDia  equal   c_maxdia                    # 3) Store as a global equal-style variable
run 0                                                       # 4) Force evaluation (if needed) and print
print           "Maximum atom diameter = ${MaxDia}"

variable        MaxClumpDia equal 3E-3                           # This should ve check always!!!
variable        atomZthreshold equal v_dimH/2.0+v_MaxClumpDia*2.0

variable        skinD       equal v_MaxDia/10.0
variable        forceCutoff equal v_MaxDia                         # Diameter (Max(R1 + R2))
variable        neighCutoff equal v_forceCutoff+v_skinD          #
variable        commCutoff  equal v_neighCutoff

 

Granular contact model에서 각각의 거리는 다음과 같이 정의된다.

1. forceCutoff : Max(R1 + R2) : 접촉하는 두 입자 중심간의 거리, 그러므로 최대값은 최대 직경의 입자끼리 접촉하는 경우로, 최대 입자의 직경과 동일해 진다.

2. skinD : skin distance : dynamic time step이 진행되면서, 입자의 이동을 고려하여 forceCutoff보다 조금 더 긴 영역을 잡도록 한다. '0'으로 설정하여도 되나, 이럴경우 입자의 움직임으로 인하여 Domain경계에서 입자가 사라질 수도 있다.

3. neighCutoff : neighbor bin의 크기를 결정하는 거리로 대부분의 경우 forceCutoff + skinD로 결정된다.

4. commCutoff : MPI해석에서 Domain경계의 ghost atoms를 어느 거리까지 추적할 것인지를 결정하는 값으로 일반적으로 neighCutoff와 동일하게 결정된다.

 

위의 값들이 해석의 overhead에 큰 영향을 끼치며, 위의 값들 중 실질적인 입력값은 아래로 한정된다.

atom_modify     map array sort 10000 0.0 
neighbor        ${skinD} bin
neigh_modify    delay 0 every 500 check yes once no cluster no exclude molecule/intra all #page 10000000 one 200000
comm_modify     mode single group all vel yes cutoff ${commCutoff}

 

먼저, atom_modify에서 1000은 atom sorting이 이행되는 step이며, 0.0이면, bin size를 neighCutoff로 잡게된다.

다음으로 neighbor 명령어에서는 skinD를 별로도 넣어주며,

neigh_modify에서는 얼마나 자주 neighboring list를 갱신할 지를 결정하게 된다. skinD와 neigh_modify는 trade off관계이다.

every 다음의 숫자는 해석결과로 부터 추정 가능하다.

Neighbor list builds = 500

 

'LAMMPS' 카테고리의 다른 글

Possible Acclerations  (0) 2025.05.16
LAMMPS with AOCC Updated 250502  (0) 2025.05.02
MPI+OMP in AOCC  (0) 2025.04.14
IntelOneAPI command line options for NUMA  (0) 2025.04.03
LAMMPS IntelOneAPI build (2025.5.14)  (0) 2025.03.04