コード例 #1
0
ファイル: mpi.py プロジェクト: deneick/pymor
def _setup_worker():
    # ensure that each worker starts with a different RandomState
    if not mpi.rank0:
        from pymor.tools import random
        import numpy as np
        state = random.default_random_state()
        new_state = np.random.RandomState(state.randint(0, 2**16) + mpi.rank)
        random._default_random_state = new_state
    return [None]
コード例 #2
0
def _setup_worker(worker_id):
    global _remote_objects
    _remote_objects = {}
    # ensure that each worker starts with a different RandomState
    from pymor.tools import random
    import numpy as np
    state = random.default_random_state()
    new_state = np.random.RandomState(state.randint(0, 2**16) + worker_id)
    random._default_random_state = new_state