def get_session()

in mpi_utils.py [0:0]


def get_session(mpi=True, disable_swapping=True, log=print):
    config = tf.ConfigProto()
    # if mpi:
    #     log('local rank', local_mpi_rank(), 'rank', mpi_rank())
    #     config.gpu_options.visible_device_list = str(local_mpi_rank())
    config.allow_soft_placement = False
    if disable_swapping:
        # Disables the swapping heuristic used by TF to reduce memory;
        # it is faster to recompute gradients rather than swap out params
        config.graph_options.rewrite_options.memory_optimization = 1

    # Dont need the timeout session if mpi4py is used when invoking mpi
    # sess = TimeoutSession(timeout=timeout, config=config, log=log)
    sess = tf.Session(config=config)
    return sess