我们写完mpi代码以后需要通过执行命令运行写好的代码,此时在运行命令中加入设置参数可以更好的控制程序的运行,这里就介绍一下自己常用的几种参数设置。

相关资料,参看前文:

https://www.cnblogs.com/devilmaycry812839668/p/15107935.html

 

 

现有硬件:两台装有Ubuntu18.04的操作系统(下面简称A电脑,B电脑)

A电脑: 24物理核心(48逻辑核心)

B电脑:6物理核心(12逻辑核心)

 

网络:

A、B电脑之间使用100M以太网交换机连接(就是TP-Link路由器)。

其中,A电脑IP为 192.168.11.66,   B电脑IP为 192.168.11.206

 

 

本文中的代码   x.py  :

from mpi4py import MPI
import numpy as np


comm = MPI.COMM_WORLD
size = comm.Get_size()
rank = comm.Get_rank()


sendbuf = np.zeros(100*10000, dtype='i') + rank
recvbuf = None
if rank == 0:
    recvbuf = np.empty([size, 100*10000], dtype='i')


print( MPI.Get_processor_name() )


import time
a = time.time()
for _ in range(1):
    comm.Gather(sendbuf, recvbuf, root=0)
b = time.time()
if rank == 0:
    print(b-a)
View Code

相关文章:

  • 2021-09-29
  • 2021-10-07
  • 2021-05-24
  • 2021-12-28
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2022-12-23
  • 2022-02-06
  • 2021-09-21
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2021-05-22
相关资源
相似解决方案