コード例 #1
0
ファイル: metrics.py プロジェクト: vibhatha/deep500
 def end(self, *args):
     # Import MPI4Py without initializing it
     try:
         import mpi4py.rc
         mpi4py.rc.initialize = False
         from mpi4py import MPI
     except (ImportError, ModuleNotFoundError):
         print('ERROR: mpi4py not available, profiling metric disabled')
         raise
     MPI.Pcontrol(2)  # Flush buffers
     MPI.Pcontrol(0)  # Disable profiling
コード例 #2
0
#!/usr/bin/env python

# If you want MPE to log MPI calls, you have to add the two lines
# below at the very beginning of your main bootstrap script.
import mpi4py
mpi4py.profile('mpe', logfile='cpilog')

# Import the MPI extension module
from mpi4py import MPI
if 0:  # <- use '1' to disable logging of MPI calls
    MPI.Pcontrol(0)

# Import the 'array' module
from array import array

# This is just to make the logging
# output a bit more interesting
from time import sleep

comm = MPI.COMM_WORLD
nprocs = comm.Get_size()
myrank = comm.Get_rank()

n = array('i', [0])
pi = array('d', [0])
mypi = array('d', [0])


def comp_pi(n, myrank=0, nprocs=1):
    h = 1.0 / n
    s = 0.0
コード例 #3
0
ファイル: test_environ.py プロジェクト: xqding/mpi4py
 def testPControl(self):
     for level in (2, 1, 0):
         MPI.Pcontrol(level)
     MPI.Pcontrol(1)