Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
23c036d6
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
23c036d6
编写于
3月 16, 2022
作者:
R
ronnywang
提交者:
GitHub
3月 16, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
clean up DeviceManager in advance manually (#40504)
上级
f5bf46e6
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
15 addition
and
0 deletion
+15
-0
paddle/fluid/pybind/pybind.cc
paddle/fluid/pybind/pybind.cc
+6
-0
paddle/phi/backends/device_manager.cc
paddle/phi/backends/device_manager.cc
+5
-0
paddle/phi/backends/device_manager.h
paddle/phi/backends/device_manager.h
+2
-0
python/paddle/fluid/__init__.py
python/paddle/fluid/__init__.py
+2
-0
未找到文件。
paddle/fluid/pybind/pybind.cc
浏览文件 @
23c036d6
...
@@ -114,6 +114,7 @@ limitations under the License. */
...
@@ -114,6 +114,7 @@ limitations under the License. */
#include "paddle/fluid/pybind/metrics_py.h"
#include "paddle/fluid/pybind/metrics_py.h"
#include "paddle/fluid/pybind/ps_gpu_wrapper_py.h"
#include "paddle/fluid/pybind/ps_gpu_wrapper_py.h"
#include "paddle/fluid/pybind/pybind_boost_headers.h"
#include "paddle/fluid/pybind/pybind_boost_headers.h"
#include "paddle/phi/backends/device_manager.h"
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
#if defined(PADDLE_WITH_NCCL) || defined(PADDLE_WITH_RCCL)
#include "paddle/fluid/pybind/nccl_wrapper_py.h"
#include "paddle/fluid/pybind/nccl_wrapper_py.h"
...
@@ -742,6 +743,11 @@ PYBIND11_MODULE(core_noavx, m) {
...
@@ -742,6 +743,11 @@ PYBIND11_MODULE(core_noavx, m) {
// stored in this static instance to avoid illegal memory access.
// stored in this static instance to avoid illegal memory access.
m
.
def
(
"clear_kernel_factory"
,
m
.
def
(
"clear_kernel_factory"
,
[]()
{
phi
::
KernelFactory
::
Instance
().
kernels
().
clear
();
});
[]()
{
phi
::
KernelFactory
::
Instance
().
kernels
().
clear
();
});
m
.
def
(
"clear_device_manager"
,
[]()
{
#ifdef PADDLE_WITH_CUSTOM_DEVICE
phi
::
DeviceManager
::
Clear
();
#endif
});
// NOTE(zjl): ctest would load environment variables at the beginning even
// NOTE(zjl): ctest would load environment variables at the beginning even
// though we have not `import paddle.fluid as fluid`. So we add this API
// though we have not `import paddle.fluid as fluid`. So we add this API
...
...
paddle/phi/backends/device_manager.cc
浏览文件 @
23c036d6
...
@@ -393,6 +393,11 @@ DeviceManager& DeviceManager::Instance() {
...
@@ -393,6 +393,11 @@ DeviceManager& DeviceManager::Instance() {
return
platform_manager
;
return
platform_manager
;
}
}
void
DeviceManager
::
Clear
()
{
Instance
().
device_map_
.
clear
();
Instance
().
device_impl_map_
.
clear
();
}
std
::
vector
<
std
::
string
>
ListAllLibraries
(
const
std
::
string
&
library_dir
)
{
std
::
vector
<
std
::
string
>
ListAllLibraries
(
const
std
::
string
&
library_dir
)
{
std
::
vector
<
std
::
string
>
libraries
;
std
::
vector
<
std
::
string
>
libraries
;
std
::
regex
express
(
".*
\\
.so"
);
std
::
regex
express
(
".*
\\
.so"
);
...
...
paddle/phi/backends/device_manager.h
浏览文件 @
23c036d6
...
@@ -158,6 +158,8 @@ class DeviceManager {
...
@@ -158,6 +158,8 @@ class DeviceManager {
static
std
::
vector
<
size_t
>
GetDeviceList
(
const
std
::
string
&
device_type
);
static
std
::
vector
<
size_t
>
GetDeviceList
(
const
std
::
string
&
device_type
);
static
void
Clear
();
private:
private:
DISABLE_COPY_AND_ASSIGN
(
DeviceManager
);
DISABLE_COPY_AND_ASSIGN
(
DeviceManager
);
DeviceManager
()
{}
DeviceManager
()
{}
...
...
python/paddle/fluid/__init__.py
浏览文件 @
23c036d6
...
@@ -228,3 +228,5 @@ if core.is_compiled_with_npu():
...
@@ -228,3 +228,5 @@ if core.is_compiled_with_npu():
atexit
.
register
(
core
.
clear_executor_cache
)
atexit
.
register
(
core
.
clear_executor_cache
)
# NOTE(Aganlengzi): clean up KernelFactory in advance manually.
# NOTE(Aganlengzi): clean up KernelFactory in advance manually.
atexit
.
register
(
core
.
clear_kernel_factory
)
atexit
.
register
(
core
.
clear_kernel_factory
)
# NOTE(wangran16): clean up DeviceManger in advance manually.
atexit
.
register
(
core
.
clear_device_manager
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录