MPI与OpenMP共享内存 [英] MPI vs openMP for a shared memory

查看:114
本文介绍了MPI与OpenMP共享内存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以说有一台计算机,其中有4个CPU,每个CPU有2个内核,因此总共有8个内核.以我有限的理解,我认为在这种情况下所有处理器都共享相同的内存.现在,最好直接使用openMP或使用MPI使其通用,以便代码可以在分布式和共享设置上工作.另外,如果我将MPI用于共享设置,与openMP相比,性能会降低吗?

Lets say there is a computer with 4 CPUs each having 2 cores, so totally 8 cores. With my limited understanding I think that all processors share same memory in this case. Now, is it better to directly use openMP or to use MPI to make it general so that the code could work on both distributed and shared settings. Also, if I use MPI for a shared setting would performance decrease compared with openMP?

推荐答案

如今,对于大多数由SMP或NUMA节点组成的分布式内存平台,不使用OpenMP毫无意义. OpenMP MPI可以完美地协同工作; OpenMP为每个节点上的核心提供数据,MPI在节点之间进行通信.这称为混合编程.它在10年前被认为是奇异的,但现在已成为高性能计算的主流.

With most distributed memory platforms nowadays consisting of SMP or NUMA nodes it just makes no sense to not use OpenMP. OpenMP and MPI can perfectly work together; OpenMP feeds the cores on each node and MPI communicates between the nodes. This is called hybrid programming. It was considered exotic 10 years ago but now it is becoming mainstream in High Performance Computing.

对于问题本身,鉴于提供的信息,正确的答案始终是一成不变的: IT DEPENDS .

As for the question itself, the right answer, given the information provided, has always been one and the same: IT DEPENDS.

这篇关于MPI与OpenMP共享内存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆