Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
LiYuRio committed Jan 10, 2022
1 parent e4b1474 commit a12df98
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 26 deletions.
26 changes: 6 additions & 20 deletions python/paddle/fluid/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,17 +400,6 @@ def _is_enable_standalone_executor():
return flag


def _is_enable_fleet_executor():
"""
Whether to use experimental executor `FleetExecutor`.
"""
flag = False
env_val = os.environ.get('FLAGS_USE_FLEET_EXECUTOR', None)
if env_val in [1, '1', True, 'True', 'true']:
flag = True
return flag


def _prepare_fleet_executor():
from ..distributed.fleet.proto import fleet_executor_desc_pb2
trainer_endpoints_str = os.getenv("PADDLE_TRAINER_ENDPOINTS", "")
Expand Down Expand Up @@ -720,8 +709,6 @@ def __init__(self, place=None):
self._enable_interpreter_core = _is_enable_standalone_executor()
self._executor_cache = _ExecutorCache(self.place)

# NOTE: Whether to use experimental executor `FleetExecutor`.
self._enable_fleet_executor = _is_enable_fleet_executor()
self._fleet_executor = None

def _get_scope_cache(self, program_cache_key):
Expand Down Expand Up @@ -1311,14 +1298,13 @@ def _run_impl(self, program, feed, fetch_list, feed_var_name,

fetch_list = self._check_fetch_list(fetch_list)

if self._enable_fleet_executor:
# Move prepare here for port conflict with nccl in startup program
if self._fleet_executor is None:
self._fleet_executor = _prepare_fleet_executor()
return self._run_using_fleet_executor(
program=program, feed=feed, fetch_list=fetch_list)

if isinstance(program, Program) and program._pipeline_opt:
if "fleet_opt" in program._pipeline_opt:
# Move prepare here for port conflict with nccl in startup program
if self._fleet_executor is None:
self._fleet_executor = _prepare_fleet_executor()
return self._run_using_fleet_executor(
program=program, feed=feed, fetch_list=fetch_list)
if "startup_program" in program._pipeline_opt:
program = program._pipeline_opt["startup_program"]
else:
Expand Down
2 changes: 0 additions & 2 deletions python/paddle/fluid/tests/unittests/test_fleet_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import unittest
import os
import numpy as np
import paddle
import paddle.fluid as fluid
Expand Down Expand Up @@ -73,7 +72,6 @@ def run_fleet_executor(self, place, x_data, y_data):
return res

def test_executor_on_single_device(self):
os.environ["FLAGS_USE_FLEET_EXECUTOR"] = "1"
if fluid.is_compiled_with_cuda():
shape = (10000, 3462)
x_data = np.random.rand(*shape)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import unittest
import os
import numpy as np
import paddle
import paddle.fluid as fluid
Expand Down Expand Up @@ -73,7 +72,6 @@ def run_fleet_executor(self, place, x_data, y_data):
return res

def test_executor_on_single_device(self):
os.environ["FLAGS_USE_FLEET_EXECUTOR"] = "1"
if fluid.is_compiled_with_cuda():
shape = (10000, 3462)
x_data = np.random.rand(*shape)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import unittest
import os
import numpy as np
import paddle
import paddle.fluid as fluid
Expand Down Expand Up @@ -68,7 +67,6 @@ def run_fleet_executor(self, place, x_data, y_data):
return res

def test_executor_on_single_device(self):
os.environ["FLAGS_USE_FLEET_EXECUTOR"] = "1"
if fluid.is_compiled_with_cuda():
shape = (10000, 3462)
x_data = np.random.rand(*shape)
Expand Down

0 comments on commit a12df98

Please sign in to comment.