# Path: blond/utils/bmath.py
# def use_mpi():
# def mpiMode():
# def use_fftw():
# def use_precision(_precision='double'):
# def update_active_dict(new_dict):


import sys
import os
import numpy as np
import logging
from functools import wraps
from ..utils import bmath as bm
from mpi4py import MPI
                op = add_op_int32
            elif dtype == 'int64':
                op = add_op_int64
            elif dtype == 'uint16':
                op = add_op_uint16
            elif dtype == 'uint32':
                op = add_op_uint32
            elif dtype == 'uint64':
                op = add_op_uint64
            elif dtype == 'float32':
                op = add_op_float32
            elif dtype == 'float64':
                op = add_op_float64
            else:
                print('Error: Not recognized dtype:{}'.format(dtype))
                exit(-1)
        elif operator == 'sum':
            op = MPI.SUM
        elif operator == 'max':
            op = MPI.MAX
        elif operator == 'min':
            op = MPI.MIN
        elif operator == 'prod':
            op = MPI.PROD
        elif operator in ['mean', 'avg']:
            op = MPI.SUM
        elif operator == 'std':
            recvbuf = self.allgather(sendbuf)
            assert len(recvbuf) == 3 * self.workers
            totals = np.sum((recvbuf[2::3] - 1) * recvbuf[1::3]**2 +

# Path: blond/utils/bmath.py
# def use_mpi():
# def mpiMode():
# def use_fftw():
# def use_precision(_precision='double'):
# def update_active_dict(new_dict):


# Path: blond/utils/mpi_config.py
import sys
import os
import numpy as np
import logging
from functools import wraps
from ..utils import bmath as bm
from mpi4py import MPI

                op = add_op_int32
            elif dtype == 'int64':
                op = add_op_int64
            elif dtype == 'uint16':
                op = add_op_uint16
            elif dtype == 'uint32':
                op = add_op_uint32
            elif dtype == 'uint64':
                op = add_op_uint64
            elif dtype == 'float32':
                op = add_op_float32
            elif dtype == 'float64':
                op = add_op_float64
            else:
                print('Error: Not recognized dtype:{}'.format(dtype))
                exit(-1)
        elif operator == 'sum':
            op = MPI.SUM
        elif operator == 'max':
            op = MPI.MAX
        elif operator == 'min':
            op = MPI.MIN
        elif operator == 'prod':
            op = MPI.PROD
        elif operator in ['mean', 'avg']:
            op = MPI.SUM
        elif operator == 'std':
            recvbuf = self.allgather(sendbuf)
            assert len(recvbuf) == 3 * self.workers
            totals = np.sum((recvbuf[2::3] - 1) * recvbuf[1::3]**2 +

                            recvbuf[2::3] * (recvbuf[1::3] - bm.mean(recvbuf[::3]))**2)