Mpi4py的运行速度不比串行代码快

时间:2018-12-09 21:57:55

标签: python-2.7 networkx igraph mpi4py

当我尝试计算具有10,000个节点的图的中间性以进行测试时。看来mpi并行版本与串行版本一样快。而且我真的不知道问题出在哪里。这是MPI代码:

from igraph import *
from pyunicorn import Network,mpi
import time
def master():
    ig = Graph.Lattice([100, 100], 1, False, False, True)
    bt = Network.FromIGraph(ig, silence_level=0).betweenness()
    mpi.info()

start=time.time()
mpi.run()
print "Time is %.4F seconds"% (time.time()-start)

此外,序列号如下:

from igraph import *
from pyunicorn import Network
import time
ig = Graph.Lattice([100,100],1,False,False,True)
bt1=ig.betweenness(directed=False,cutoff=None)

start=time.time()
bt=Network.FromIGraph(ig,silence_level=0).betweenness()
end=time.time()
print "Time is %.4F seconds"% (end-start)

0 个答案:

没有答案