From 178c47c074ba0c1294dd8e0e8f38faa0a5e17ab3 Mon Sep 17 00:00:00 2001 From: dongdaxiang Date: Mon, 17 Dec 2018 00:12:03 +0800 Subject: [PATCH] refine import path for ps_instance.py test=develop --- python/paddle/fluid/distributed/helper.py | 7 ++++--- python/requirements.txt | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/distributed/helper.py b/python/paddle/fluid/distributed/helper.py index ca6dd5dab..999c8d77b 100644 --- a/python/paddle/fluid/distributed/helper.py +++ b/python/paddle/fluid/distributed/helper.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from mpi4py import MPI import ps_pb2 as pslib @@ -59,7 +58,7 @@ class FileSystem(object): class MPIHelper(object): """ - MPIHelper is a wrapper of mpi4py, supprot get_rank get_size etc. + MPIHelper is a wrapper of mpi4py, support get_rank get_size etc. Args: No params Examples: @@ -68,7 +67,9 @@ class MPIHelper(object): """ def __init__(self): + from mpi4py import MPI self.comm = MPI.COMM_WORLD + self.MPI = MPI def get_rank(self): return self.comm.Get_rank() @@ -86,4 +87,4 @@ class MPIHelper(object): return socket.gethostname() def finalize(self): - MPI.Finalize() + self.MPI.Finalize() diff --git a/python/requirements.txt b/python/requirements.txt index 36313333b..2f81d85df 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -9,4 +9,3 @@ Pillow nltk>=3.2.2 graphviz six -mpi4py==3.0.0 -- GitLab