Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
db6be3b3
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
db6be3b3
编写于
8月 28, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
8月 28, 2020
浏览文件
操作
浏览文件
下载
差异文件
!5408 Use forkserver context to fix not-exit issue
Merge pull request !5408 from LiHongzhang/forkserver
上级
2b86c92f
9050f2ad
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
5 deletion
+10
-5
mindspore/train/callback/_summary_collector.py
mindspore/train/callback/_summary_collector.py
+1
-1
mindspore/train/summary/_writer_pool.py
mindspore/train/summary/_writer_pool.py
+9
-4
未找到文件。
mindspore/train/callback/_summary_collector.py
浏览文件 @
db6be3b3
...
...
@@ -111,7 +111,7 @@ class SummaryCollector(Callback):
and float. Default: None, it means there is no custom data.
collect_tensor_freq (Optional[int]): The same semantics as the `collect_freq`, but controls TensorSummary only.
Because TensorSummary data is too large to be compared with other summary data, this parameter is used to
reduce its collection. By default, The maximum number of steps for collecting TensorSummary data is 2
1
,
reduce its collection. By default, The maximum number of steps for collecting TensorSummary data is 2
0
,
but it will not exceed the number of steps for collecting other summary data.
Default: None, which means to follow the behavior as described above. For example, given `collect_freq=10`,
when the total steps is 600, TensorSummary will be collected 20 steps, while other summary data 61 steps,
...
...
mindspore/train/summary/_writer_pool.py
浏览文件 @
db6be3b3
...
...
@@ -16,7 +16,6 @@
import
os
import
time
from
collections
import
deque
from
multiprocessing
import
Pool
,
Process
,
Queue
,
cpu_count
import
mindspore.log
as
logger
...
...
@@ -24,6 +23,12 @@ from ._lineage_adapter import serialize_to_lineage_event
from
._summary_adapter
import
package_graph_event
,
package_summary_event
from
._summary_writer
import
LineageWriter
,
SummaryWriter
try
:
from
multiprocessing
import
get_context
ctx
=
get_context
(
'forkserver'
)
except
ValueError
:
import
multiprocessing
as
ctx
def
_pack_data
(
datadict
,
wall_time
):
"""Pack data according to which plugin."""
...
...
@@ -42,7 +47,7 @@ def _pack_data(datadict, wall_time):
return
result
class
WriterPool
(
Process
):
class
WriterPool
(
ctx
.
Process
):
"""
Use a set of pooled resident processes for writing a list of file.
...
...
@@ -54,12 +59,12 @@ class WriterPool(Process):
def
__init__
(
self
,
base_dir
,
max_file_size
,
**
filedict
)
->
None
:
super
().
__init__
()
self
.
_base_dir
,
self
.
_filedict
=
base_dir
,
filedict
self
.
_queue
,
self
.
_writers_
=
Queue
(
cpu_count
()
*
2
),
None
self
.
_queue
,
self
.
_writers_
=
ctx
.
Queue
(
ctx
.
cpu_count
()
*
2
),
None
self
.
_max_file_size
=
max_file_size
self
.
start
()
def
run
(
self
):
with
Pool
(
min
(
cpu_count
(),
32
))
as
pool
:
with
ctx
.
Pool
(
min
(
ctx
.
cpu_count
(),
32
))
as
pool
:
deq
=
deque
()
while
True
:
while
deq
and
deq
[
0
].
ready
():
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录