-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathall_gather.py
37 lines (29 loc) · 1.09 KB
/
all_gather.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
import os
import logging.handlers
from mpi4py import MPI
from gather import gather
from diffusion_hypercube import diffusion
from mpi_obj import MPIObj
PYTHON_LOGGER = logging.getLogger(__name__)
if not os.path.exists("log"):
os.mkdir("log")
HDLR = logging.handlers.TimedRotatingFileHandler("log/all_gather.log",
when="midnight", backupCount=60)
STREAM_HDLR = logging.StreamHandler()
FORMATTER = logging.Formatter("%(asctime)s %(filename)s [%(levelname)s] %(message)s")
HDLR.setFormatter(FORMATTER)
STREAM_HDLR.setFormatter(FORMATTER)
PYTHON_LOGGER.addHandler(HDLR)
PYTHON_LOGGER.addHandler(STREAM_HDLR)
PYTHON_LOGGER.setLevel(logging.DEBUG)
# Absolute path to the folder location of this python file
FOLDER_ABSOLUTE_PATH = os.path.normpath(os.path.dirname(os.path.abspath(__file__)))
def all_gather(tab, mpi_obj):
big_tab = gather(0, tab, mpi_obj)
diffusion(0, big_tab, mpi_obj)
if __name__ == "__main__":
mpi_obj = MPIObj()
all_gather([mpi_obj.me], mpi_obj)