Tool:VTune Profiler Object: Lammps 其他工具: perf, gperftools (CPU profiler) Nsight Systems (CPU/GPU profiler) ## 目的 利用Profiler可以分析程式執行效率、硬體利用率,或是代碼個區段運行時間分析。 ## 前置作業 1. basic: ```bash= sudo apt update sudo apt install -y cmake build-essential git mpi-default-bin mpi-default-dev ``` 2. Lammps: ```bash= git clone https://github.com/lammps/lammps.git cd lammps mkdir build && cd build cmake ../cmake -D BUILD_MPI=on make -j$(nproc) ``` 3. Intel Vtune profiler: ```bash= 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 ``` 4. OpenMP ```bash= export OMP_NUM_THREADS=$(nproc) ``` ## 分析 1. Hotspot: 分析各段程式占用CPU的時間多寡,可以用來找出最耗時的區段以利後續優化。 e.g. Lammps/examples/in.melt  ```bash= cd ~/lammps/build vtune -collect hotspots -result-dir vtune.result ./lmp -in ../examples/melt/in.melt ``` (1) 利用mpi跑測試程式,比較兩者運行效率 ```bash= vtune -collect hotspots mpirun -np $(nproc) ./lmp -in ./in.melt ```  上圖為vtune -collect hotspots ./lmp -in ./in.melt 測試結果(未使用mpirun)  上圖為vtune -collect hotspots mpirun -np 4 ./lmp -in ./in.melt 測試結果(使用mpirun) 接下來的研究方向: 1. 分子數或問題參數的差異分析與比較(附圖) 2. 更多的分析output項目認識 3. GUI可以幫助PPT製作
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up