计算化学公社

标题: 求助:电脑硬件足够支撑,但双任务比单任务的计算效率大大降低怎么办? [打印本页]

作者
Author:
yihanxu    时间: 2022-11-9 17:44
标题: 求助:电脑硬件足够支撑,但双任务比单任务的计算效率大大降低怎么办?
本帖最后由 yihanxu 于 2022-11-9 21:38 编辑

老师好,我设置了一个任务,原子数共一万七千多个,启用GPU加速,电脑有2个CPU,总共64核128线程,有2张显卡。一次是只运算一个任务,计算效率约是750ns/day,显卡利用率20%多;但是当我尝试同时计算两个任务的时候(两个同样的任务),如果是在同一张显卡上,显卡利用率约40%,如果两个任务是分别在两张显卡上做计算,每个显卡的利用率大概20%,但是不论用几张显卡,每个任务的计算效率都只有250ns/day,比起只计算一个任务大大降低了。我对比了log文件,看起来除了末尾的计算效率数值其他都一模一样,请教老师该怎么使同时进行的两个任务的计算效率都到750ns/day呢?
--------------------------------------
每个任务都是:
1 GPU selected for this run.
Mapping of GPU IDs to the 2 GPU tasks in the 1 rank on this node:
  PP:0,PME:0
PP tasks will do (non-perturbed) short-ranged interactions on the GPU
PP task will update and constrain coordinates on the CPU
PME tasks will do all aspects on the GPU
Using 1 MPI thread
Using 64 OpenMP threads

Pinning threads with an auto-selected logical core stride of 2
System total charge: 0.000
Will do PME sum in reciprocal space for electrostatic interactions.


On 1 MPI rank, each using 64 OpenMP threads

-----------------------------
更新:把两个任务的OpenMP threads都改到60,即-ntomp 60,得到效率分别为500 ns/day和480 ns/day;把两个任务的OpenMP threads都改到63,得到效率分别为517 ns/day和495 ns/day

(注:最初命令为gmx mdrun -v -deffnm md -gpu_id 0若给两个任务命令都加上 -ntomp 63 -nb gpu -pme gpu -bonded cpu,其中一个写-gpu_id 0另一个写-gpu_id 1,则686 ns/day和677 ns/day。     参考了帖子http://bbs.keinsci.com/forum.php ... ighlight=gpu&page=1

加上 -ntomp 63 -nb gpu -pme gpu -bonded cpu后的单显卡单任务(gmx mdrun -v -deffnm md -nb gpu -pme gpu -bonded cpu -gpu_id 1),其GPU利用率52%,727ns/day。
--------------------------------------
更新:(注:最初命令为gmx mdrun -v -deffnm md -gpu_id 0若运行一个单任务时命令加上 -ntomp 50,那么GPU利用率57%,813 ns/day;若-ntomp 40,那么GPU利用率58%,854 ns/day;-ntomp 30,那么GPU利用率60%,859 ns/day;-ntomp 24,那么GPU利用率62%,906 ns/day-ntomp 20,那么GPU利用率62%,866 ns/day-ntomp 10,那么GPU利用率58%,823 ns/day;-ntomp 8,那么GPU利用率57%,757 ns/day若分别在两个显卡同时算两个任务-ntomp 24,那么两个GPU利用率均约62%,938 ns/day882 ns/day(在此基础上若给两个任务命令都加上 -nb gpu -pme gpu -bonded cpu,其中一个写-gpu_id 0另一个写-gpu_id 1,两个GPU利用率均约61%,893 ns/day和842 ns/day参考了帖子中关于“应用多少核心数合适”的部分http://bbs.keinsci.com/forum.php ... ighlight=gpu&page=1


作者
Author:
snljty2    时间: 2022-11-9 19:46
gmx mdrun -pin on -pinoffset 0 -ntmpi 1 -ntomp 32 -gpu_id 0 -deffnm xxx
gmx mdrun -pin on -pinoffset 64 -ntmpi 1 -ntomp 32 -gpu_id 1 -deffnm xxx
试试




欢迎光临 计算化学公社 (http://bbs.keinsci.com/) Powered by Discuz! X3.3