gpt4 book ai didi

c - MPI_Bcast : Efficiency advantages?

转载 作者:太空狗 更新时间:2023-10-29 14:50:29 24 4
gpt4 key购买 nike

在 MPI 中,MPI_Bcast 是一个纯粹的便利函数,还是使用它而不是循环遍历所有级别并向所有级别发送相同的消息是否具有效率优势?

理由:MPI_Bcast 将消息发送给所有人(包括 root)的行为对我来说很不方便,所以我宁愿不使用它,除非有充分的理由,或者它可以不向 root 发送消息。

最佳答案

使用 MPI_Bcast 肯定比自己滚动更有效率。在所有 MPI 实现中都做了很多工作,以根据消息大小和通信架构等因素优化集体操作。

例如,MPI_Bcast in MPICH2 would use a different algorithm depending on the size of the message .对于短消息,使用二叉树来最小化处理负载和延迟。对于长消息,它被实现为一个二叉树分散,然后是一个 allgather。

此外,HPC 供应商通常会提供 MPI 实现,以有效利用底层互连,尤其是对于集体操作。例如,可以使用 hardware supported multicast schemeuse bespoke algorithms that can take advantage of the existing interconnects .

关于c - MPI_Bcast : Efficiency advantages?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6959649/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com