Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
c44939af
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看板
提交
c44939af
编写于
7月 24, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 24, 2020
浏览文件
操作
浏览文件
下载
差异文件
!3412 Fix a DatasetCache sharing scenario
Merge pull request !3412 from qianlong21st/fix_cache
上级
20cb5eec
d28c63b6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
45 addition
and
0 deletion
+45
-0
mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc
...re/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc
+6
-0
tests/ut/python/dataset/test_cache_nomap.py
tests/ut/python/dataset/test_cache_nomap.py
+39
-0
未找到文件。
mindspore/ccsrc/minddata/dataset/engine/datasetops/dataset_op.cc
浏览文件 @
c44939af
...
...
@@ -388,6 +388,10 @@ uint32_t DatasetOp::GenerateCRC(const std::shared_ptr<DatasetOp> &op) {
op
->
tree_
->
Print
(
ss
,
op
);
std
::
string
ss_str
=
ss
.
str
();
// Filter out the Num workers field when generating the check sum
ss_str
=
std
::
regex_replace
(
ss_str
,
std
::
regex
(
"Num workers.*
\n
"
),
""
);
ss_str
=
std
::
regex_replace
(
ss_str
,
std
::
regex
(
"
\\
[workers.*
\\
]"
),
""
);
// Filter out the Operator control flags field when generating the check sum
ss_str
=
std
::
regex_replace
(
ss_str
,
std
::
regex
(
"Operator control flags.*
\n
"
),
""
);
...
...
@@ -400,6 +404,8 @@ uint32_t DatasetOp::GenerateCRC(const std::shared_ptr<DatasetOp> &op) {
ss_str
=
std
::
regex_replace
(
ss_str
,
std
::
regex
(
"Cache crc.*
\n
"
),
""
);
ss_str
=
std
::
regex_replace
(
ss_str
,
std
::
regex
(
"Server cache id.*
\n
"
),
""
);
MS_LOG
(
DEBUG
)
<<
"Printing the tree for generating crc:
\n
"
<<
ss_str
;
uint32_t
cache_crc
=
system
::
Crc32c
::
GetMaskCrc32cValue
(
ss_str
.
c_str
(),
ss_str
.
length
());
return
cache_crc
;
}
...
...
tests/ut/python/dataset/test_cache_nomap.py
浏览文件 @
c44939af
...
...
@@ -376,6 +376,44 @@ def test_cache_nomap_allowed_share3():
logger
.
info
(
"test_cache_nomap_allowed_share3 Ended.
\n
"
)
def
test_cache_nomap_allowed_share4
():
"""
It is allowed to share the cache between the following two trees:
Cache Cache
| |
Map(decode, num_parallel_workers=1) Map(decode, num_parallel_workers=2)
| |
TFReader TFReader
"""
logger
.
info
(
"Test cache nomap allowed share 4"
)
# This dataset has 3 records in it only
some_cache
=
ds
.
DatasetCache
(
session_id
=
2
,
size
=
0
,
spilling
=
True
)
decode_op
=
c_vision
.
Decode
()
ds1
=
ds
.
TFRecordDataset
(
DATA_DIR
,
SCHEMA_DIR
,
columns_list
=
[
"image"
],
shuffle
=
False
)
ds1
=
ds1
.
map
(
input_columns
=
[
"image"
],
operations
=
decode_op
,
cache
=
some_cache
,
num_parallel_workers
=
1
)
ds2
=
ds
.
TFRecordDataset
(
DATA_DIR
,
SCHEMA_DIR
,
columns_list
=
[
"image"
],
shuffle
=
False
)
ds2
=
ds2
.
map
(
input_columns
=
[
"image"
],
operations
=
decode_op
,
cache
=
some_cache
,
num_parallel_workers
=
2
)
num_iter
=
0
for
_
in
ds1
.
create_dict_iterator
():
num_iter
+=
1
logger
.
info
(
"Number of data in ds1: {} "
.
format
(
num_iter
))
assert
num_iter
==
3
num_iter
=
0
for
_
in
ds2
.
create_dict_iterator
():
num_iter
+=
1
logger
.
info
(
"Number of data in ds2: {} "
.
format
(
num_iter
))
assert
num_iter
==
3
logger
.
info
(
"test_cache_nomap_allowed_share4 Ended.
\n
"
)
def
test_cache_nomap_disallowed_share1
():
"""
It is not allowed to share the cache between the following two trees:
...
...
@@ -426,4 +464,5 @@ if __name__ == '__main__':
test_cache_nomap_allowed_share1
()
test_cache_nomap_allowed_share2
()
test_cache_nomap_allowed_share3
()
test_cache_nomap_allowed_share4
()
test_cache_nomap_disallowed_share1
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录