本文整理汇总了Python中mcni.pyre_support.Instrument.Instrument.main方法的典型用法代码示例。如果您正苦于以下问题:Python Instrument.main方法的具体用法?Python Instrument.main怎么用?Python Instrument.main使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mcni.pyre_support.Instrument.Instrument
的用法示例。
在下文中一共展示了Instrument.main方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from mcni.pyre_support.Instrument import Instrument [as 别名]
# 或者: from mcni.pyre_support.Instrument.Instrument import main [as 别名]
def main(self):
base.main(self)
neutrons = {}
#get neutrons from other nodes
from mcni.neutron_storage import neutrons_from_npyarr as a2n, neutrons_as_npyarr as n2a, ndblsperneutron
from mcni.utils.mpi import rank as mpirank, send, receive, world
tag = 999
if mpirank != 0:
arr = n2a( self.inventory.recorder.neutrons )
print "Node %s: sending array of shape %s" % (mpirank, arr.shape,)
send(arr , 0, tag )
else:
for peer in range(1, world.size):
arr = receive( peer, tag )
arr.shape = -1, ndblsperneutron
neutrons[ peer ] = a2n( arr )
print "Node %s: received array of shape %s" % (mpirank, arr.shape)
continue
neutrons[ 0] = self.inventory.recorder.neutrons
#compare
if mpirank == 0:
for peer in range(1, world.size):
assert neutrons[0][0].state.velocity[2] != neutrons[peer][0].state.velocity[2]
continue
return