提交 9450048a 编写于 作者: Q Qiao Longfei

add PADDLE_ENABLE_REMOTE_PREFETCH to enable remote prefetch

test=develop
上级 3e45a5a5
...@@ -50,7 +50,7 @@ paddle.fluid.initializer.MSRAInitializer.__init__ ArgSpec(args=['self', 'uniform ...@@ -50,7 +50,7 @@ paddle.fluid.initializer.MSRAInitializer.__init__ ArgSpec(args=['self', 'uniform
paddle.fluid.initializer.force_init_on_cpu ArgSpec(args=[], varargs=None, keywords=None, defaults=None) paddle.fluid.initializer.force_init_on_cpu ArgSpec(args=[], varargs=None, keywords=None, defaults=None)
paddle.fluid.initializer.init_on_cpu ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None) paddle.fluid.initializer.init_on_cpu ArgSpec(args=[], varargs='args', keywords='kwds', defaults=None)
paddle.fluid.layers.fc ArgSpec(args=['input', 'size', 'num_flatten_dims', 'param_attr', 'bias_attr', 'act', 'is_test', 'name'], varargs=None, keywords=None, defaults=(1, None, None, None, False, None)) paddle.fluid.layers.fc ArgSpec(args=['input', 'size', 'num_flatten_dims', 'param_attr', 'bias_attr', 'act', 'is_test', 'name'], varargs=None, keywords=None, defaults=(1, None, None, None, False, None))
paddle.fluid.layers.embedding ArgSpec(args=['input', 'size', 'is_sparse', 'is_distributed', 'padding_idx', 'param_attr', 'dtype', 'remote_prefetch'], varargs=None, keywords=None, defaults=(False, False, None, None, 'float32', False)) paddle.fluid.layers.embedding ArgSpec(args=['input', 'size', 'is_sparse', 'is_distributed', 'padding_idx', 'param_attr', 'dtype'], varargs=None, keywords=None, defaults=(False, False, None, None, 'float32'))
paddle.fluid.layers.dynamic_lstm ArgSpec(args=['input', 'size', 'h_0', 'c_0', 'param_attr', 'bias_attr', 'use_peepholes', 'is_reverse', 'gate_activation', 'cell_activation', 'candidate_activation', 'dtype', 'name'], varargs=None, keywords=None, defaults=(None, None, None, None, True, False, 'sigmoid', 'tanh', 'tanh', 'float32', None)) paddle.fluid.layers.dynamic_lstm ArgSpec(args=['input', 'size', 'h_0', 'c_0', 'param_attr', 'bias_attr', 'use_peepholes', 'is_reverse', 'gate_activation', 'cell_activation', 'candidate_activation', 'dtype', 'name'], varargs=None, keywords=None, defaults=(None, None, None, None, True, False, 'sigmoid', 'tanh', 'tanh', 'float32', None))
paddle.fluid.layers.dynamic_lstmp ArgSpec(args=['input', 'size', 'proj_size', 'param_attr', 'bias_attr', 'use_peepholes', 'is_reverse', 'gate_activation', 'cell_activation', 'candidate_activation', 'proj_activation', 'dtype', 'name'], varargs=None, keywords=None, defaults=(None, None, True, False, 'sigmoid', 'tanh', 'tanh', 'tanh', 'float32', None)) paddle.fluid.layers.dynamic_lstmp ArgSpec(args=['input', 'size', 'proj_size', 'param_attr', 'bias_attr', 'use_peepholes', 'is_reverse', 'gate_activation', 'cell_activation', 'candidate_activation', 'proj_activation', 'dtype', 'name'], varargs=None, keywords=None, defaults=(None, None, True, False, 'sigmoid', 'tanh', 'tanh', 'tanh', 'float32', None))
paddle.fluid.layers.dynamic_gru ArgSpec(args=['input', 'size', 'param_attr', 'bias_attr', 'is_reverse', 'gate_activation', 'candidate_activation', 'h_0'], varargs=None, keywords=None, defaults=(None, None, False, 'sigmoid', 'tanh', None)) paddle.fluid.layers.dynamic_gru ArgSpec(args=['input', 'size', 'param_attr', 'bias_attr', 'is_reverse', 'gate_activation', 'candidate_activation', 'h_0'], varargs=None, keywords=None, defaults=(None, None, False, 'sigmoid', 'tanh', None))
......
...@@ -287,8 +287,7 @@ def embedding(input, ...@@ -287,8 +287,7 @@ def embedding(input,
is_distributed=False, is_distributed=False,
padding_idx=None, padding_idx=None,
param_attr=None, param_attr=None,
dtype='float32', dtype='float32'):
remote_prefetch=False):
""" """
**Embedding Layer** **Embedding Layer**
...@@ -327,6 +326,9 @@ def embedding(input, ...@@ -327,6 +326,9 @@ def embedding(input,
""" """
helper = LayerHelper('embedding', **locals()) helper = LayerHelper('embedding', **locals())
remote_prefetch = False
if os.environ.get('PADDLE_ENABLE_REMOTE_PREFETCH'):
remote_prefetch = True
if remote_prefetch: if remote_prefetch:
assert is_sparse is True and is_distributed is False assert is_sparse is True and is_distributed is False
w = helper.create_parameter( w = helper.create_parameter(
......
...@@ -16,11 +16,13 @@ from __future__ import print_function ...@@ -16,11 +16,13 @@ from __future__ import print_function
import paddle import paddle
import paddle.fluid as fluid import paddle.fluid as fluid
import os
import dist_ctr_reader import dist_ctr_reader
from test_dist_base import TestDistRunnerBase, runtime_main from test_dist_base import TestDistRunnerBase, runtime_main
IS_SPARSE = True IS_SPARSE = True
os.environ['PADDLE_ENABLE_REMOTE_PREFETCH'] = "1"
# Fix seed for test # Fix seed for test
fluid.default_startup_program().random_seed = 1 fluid.default_startup_program().random_seed = 1
......
...@@ -792,6 +792,8 @@ class TestNCCL2Transpile(TranspilerTest): ...@@ -792,6 +792,8 @@ class TestNCCL2Transpile(TranspilerTest):
# test for remote prefetch # test for remote prefetch
class TestRemoteLookupTable(TestDistLookupTableBase): class TestRemoteLookupTable(TestDistLookupTableBase):
def net_conf(self): def net_conf(self):
import os
os.environ['PADDLE_ENABLE_REMOTE_PREFETCH'] = "1"
self.network_with_table( self.network_with_table(
is_sparse=True, is_distributed=False, remote_prefetch=True) is_sparse=True, is_distributed=False, remote_prefetch=True)
......
...@@ -174,6 +174,7 @@ class TestListenAndServOp(unittest.TestCase): ...@@ -174,6 +174,7 @@ class TestListenAndServOp(unittest.TestCase):
self.assertTrue((result_array[i] == id).all()) self.assertTrue((result_array[i] == id).all())
def test_lookup_remote_table(self): def test_lookup_remote_table(self):
os.environ['PADDLE_ENABLE_REMOTE_PREFETCH'] = "1"
# run pserver on CPU in sync mode # run pserver on CPU in sync mode
p0 = self._start_pserver(0, False, True, run_pserver) p0 = self._start_pserver(0, False, True, run_pserver)
self._wait_ps_ready(p0.pid) self._wait_ps_ready(p0.pid)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册