【发布时间】:2016-07-03 20:41:01
【问题描述】:
我的 MPI 程序来测量广播时间:
MPI_Barrier(MPI_COMM_WORLD);
total_mpi_bcast_time -= MPI_Wtime();
MPI_Bcast(data, num_elements, MPI_INT, 0, MPI_COMM_WORLD);
MPI_Barrier(MPI_COMM_WORLD);
total_mpi_bcast_time += MPI_Wtime();
我们需要 MPI_Barrier 等待所有进程完成其工作(同步)。但实际上,MPI_Barrier 是一个集体通信(所有进程都报告给根进程以继续程序)。所以我们测量的时间将是 Barrier_time + Broadcast_time .
那么如何仅正确测量广播时间???
这是 Scalasca 的结果:
Estimated aggregate size of event trace: 1165 bytes
Estimated requirements for largest trace buffer (max_buf): 292 bytes
Estimated memory requirements (SCOREP_TOTAL_MEMORY): 4097kB
(hint: When tracing set SCOREP_TOTAL_MEMORY=4097kB to avoid intermediate flushes
or reduce requirements using USR regions filters.)
flt type max_buf[B] visits time[s] time[%] time/visit[us] region
ALL 291 32 0.38 100.0 11930.30 ALL
MPI 267 28 0.38 100.0 13630.27 MPI
COM 24 4 0.00 0.0 30.54 COM
MPI 114 8 0.00 0.1 33.08 MPI_Barrier
MPI 57 4 0.00 0.0 26.53 MPI_Bcast
MPI 24 4 0.00 0.2 148.50 MPI_Finalize
MPI 24 4 0.00 0.0 0.57 MPI_Comm_size
MPI 24 4 0.00 0.0 1.61 MPI_Comm_rank
MPI 24 4 0.38 99.7 95168.50 MPI_Init
COM 24 4 0.00 0.0 30.54 main
但我不知道他们如何衡量它。即使我在单台机器上运行它,MPI_Broadcast 成本真的是 0% 吗?
【问题讨论】:
-
您的意思是我们测量的时间 = 2 *Broadcast 吗?但是从我阅读的一些论文中,MPI_Barrier 实现和广播实现不是同一个算法,因此 MPI_Bcast 时间!= MPI_Barrier。
-
如果您对并行通信的性能感兴趣,我强烈建议您使用适当的性能分析工具。这里是an overview,也可以考虑那里的cmets。
-
@HighPerformanceMark,尽管
MPI_Bcast是一个集体呼吁。唯一的始终同步调用是MPI_Barrier。该标准允许队伍在他们的工作完成后立即退出其他集体呼吁。如果没有第二个障碍,MPI_Bcast在不同等级中测量的时间将因算法而异。 -
我需要直接测量它,所以性能分析工具不是最佳方法。还有其他测量方法吗??
-
从我读过的所有论文中,没有一篇报告使用性能分析工具来测量通信时间。
标签: mpi time-complexity complexity-theory openmpi hpc