Try   HackMD

Tool:VTune Profiler
Object: Lammps

其他工具:
perf, gperftools (CPU profiler)
Nsight Systems (CPU/GPU profiler)

目的

利用Profiler可以分析程式執行效率、硬體利用率,或是代碼個區段運行時間分析。

前置作業

  1. basic:
sudo apt update sudo apt install -y cmake build-essential git mpi-default-bin mpi-default-dev
  1. Lammps:
git clone https://github.com/lammps/lammps.git cd lammps mkdir build && cd build cmake ../cmake -D BUILD_MPI=on make -j$(nproc)
  1. Intel Vtune profiler:
wget https://registrationcenter-download.intel.com/akdlm/IRC_NAS/740981cd-e6af-4eb6-b147-c7912fadfb84/intel-vtune-2025.3.0.18.sh sudo sh ./intel-vtune-2025.3.0.18.sh source /opt/intel/oneapi/setvars.sh
  1. OpenMP
export OMP_NUM_THREADS=$(nproc)

分析

  1. Hotspot:
    分析各段程式占用CPU的時間多寡,可以用來找出最耗時的區段以利後續優化。

    e.g. Lammps/examples/in.melt

    1

cd ~/lammps/build vtune -collect hotspots -result-dir vtune.result ./lmp -in ../examples/melt/in.melt

(1) 利用mpi跑測試程式,比較兩者運行效率

vtune -collect hotspots mpirun -np $(nproc) ./lmp -in ./in.melt

2
上圖為vtune -collect hotspots ./lmp -in ./in.melt 測試結果(未使用mpirun)

1
上圖為vtune -collect hotspots mpirun -np 4 ./lmp -in ./in.melt 測試結果(使用mpirun)

接下來的研究方向:

  1. 分子數或問題參數的差異分析與比較(附圖)
  2. 更多的分析output項目認識
  3. GUI可以幫助PPT製作