コード例 #1
0
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
print 'rank=', rank

# # common_object=dict()
# common_object['ES']       = mf.EasyScanInput()
# common_object['Programs'] ={}
# common_object['CS']       = mf.constraint()
# common_object['Ploter']   = mf.plot()
# common_object['ProgID']   = readin.ReadIn(sys.argv[1],common_object['ES'],common_object['Programs'],common_object['CS'],common_object['Ploter'])
# print 'Broad Casting ...'
# comm.bcast(common_object,root=0)

# define basic class object
ES = mf.EasyScanInput()
Programs = {}
CS = mf.constraint()
Ploter = mf.plot()
ProgID = readin.ReadIn(sys.argv[1], ES, Programs, CS, Ploter)
log_zero = -1e+100
print 'main: programs=', Programs
print 'main:ProgID=', ProgID


def LogLikelihood(cube, ndim, nparams):
    for i, name in enumerate(ES.InPar):
        ES.InPar[name] = cube[i]
        ES.AllPar[name] = cube[i]
        # Run each programs
コード例 #2
0
        "Tools"))
import manfun as mf
import readin
import PyPolyChord
from scanmanner import PolyChordrun
from mpi4py import MPI

comm = MPI.COMM_WORLD
rank = comm.Get_rank()
common_object = dict()

my_root = rank - 1
# read in ini file
if rank == my_root:
    # common_object=dict()
    common_object['ES'] = mf.EasyScanInput()
    common_object['Programs'] = {}
    common_object['CS'] = mf.constraint()
    common_object['Ploter'] = mf.plot()
    common_object['ProgID'] = readin.ReadIn(sys.argv[1], common_object['ES'],
                                            common_object['Programs'],
                                            common_object['CS'],
                                            common_object['Ploter'])
    print 'Broad Casting ...'
    comm.bcast(common_object, root=my_rank)
elif rank != 0:

    def LogLikelihood(cube, ndim, nparams):
        for i, name in enumerate(ES.InPar):
            ES.InPar[name] = cube[i]
            ES.AllPar[name] = cube[i]