未验证 提交 64cdcd52 编写于 作者: W wanghuancoder 提交者: GitHub

cherry-pick _cuda_synchronize to 1.8, test=develop (#27803)

上级 11c9169f
...@@ -1497,6 +1497,10 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -1497,6 +1497,10 @@ All parameter, weight, gradient are variables in Paddle.
m.def("is_compiled_with_mkldnn", IsCompiledWithMKLDNN); m.def("is_compiled_with_mkldnn", IsCompiledWithMKLDNN);
m.def("is_compiled_with_brpc", IsCompiledWithBrpc); m.def("is_compiled_with_brpc", IsCompiledWithBrpc);
m.def("is_compiled_with_dist", IsCompiledWithDIST); m.def("is_compiled_with_dist", IsCompiledWithDIST);
m.def("_cuda_synchronize", [](const platform::CUDAPlace &place) {
platform::DeviceContextPool::Instance().Get(place)->Wait();
});
m.def("run_cmd", m.def("run_cmd",
[](const std::string &cmd, int time_out = -1, [](const std::string &cmd, int time_out = -1,
int sleep_inter = -1) -> const std::string { int sleep_inter = -1) -> const std::string {
......
...@@ -88,6 +88,7 @@ from .dygraph.base import enable_dygraph, disable_dygraph, enable_imperative, di ...@@ -88,6 +88,7 @@ from .dygraph.base import enable_dygraph, disable_dygraph, enable_imperative, di
from .io import save, load, load_program_state, set_program_state from .io import save, load, load_program_state, set_program_state
from .dygraph.checkpoint import save_dygraph, load_dygraph from .dygraph.checkpoint import save_dygraph, load_dygraph
from .dygraph.varbase_patch_methods import monkey_patch_varbase from .dygraph.varbase_patch_methods import monkey_patch_varbase
from .core import _cuda_synchronize
Tensor = LoDTensor Tensor = LoDTensor
__all__ = framework.__all__ + executor.__all__ + \ __all__ = framework.__all__ + executor.__all__ + \
...@@ -128,7 +129,8 @@ __all__ = framework.__all__ + executor.__all__ + \ ...@@ -128,7 +129,8 @@ __all__ = framework.__all__ + executor.__all__ + \
'install_check', 'install_check',
'save', 'save',
'load', 'load',
'VarBase' 'VarBase',
'_cuda_synchronize'
] ]
......
...@@ -260,6 +260,7 @@ if avx_supported(): ...@@ -260,6 +260,7 @@ if avx_supported():
from .core_avx import _save_dygraph_dict from .core_avx import _save_dygraph_dict
from .core_avx import _load_dygraph_dict from .core_avx import _load_dygraph_dict
from .core_avx import _create_loaded_parameter from .core_avx import _create_loaded_parameter
from .core_avx import _cuda_synchronize
if sys.platform != 'win32': if sys.platform != 'win32':
from .core_avx import _set_process_pids from .core_avx import _set_process_pids
from .core_avx import _erase_process_pids from .core_avx import _erase_process_pids
...@@ -304,6 +305,7 @@ if load_noavx: ...@@ -304,6 +305,7 @@ if load_noavx:
from .core_noavx import _save_dygraph_dict from .core_noavx import _save_dygraph_dict
from .core_noavx import _load_dygraph_dict from .core_noavx import _load_dygraph_dict
from .core_noavx import _create_loaded_parameter from .core_noavx import _create_loaded_parameter
from .core_noavx import _cuda_synchronize
if sys.platform != 'win32': if sys.platform != 'win32':
from .core_noavx import _set_process_pids from .core_noavx import _set_process_pids
from .core_noavx import _erase_process_pids from .core_noavx import _erase_process_pids
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册