Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
abd4239d
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看板
提交
abd4239d
编写于
4月 22, 2020
作者:
X
xiefangqi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix random stuck problem
上级
140201fc
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
20 addition
and
29 deletion
+20
-29
mindspore/ccsrc/dataset/CMakeLists.txt
mindspore/ccsrc/dataset/CMakeLists.txt
+3
-0
mindspore/ccsrc/dataset/engine/datasetops/map_op.cc
mindspore/ccsrc/dataset/engine/datasetops/map_op.cc
+0
-22
mindspore/ccsrc/dataset/engine/datasetops/map_op.h
mindspore/ccsrc/dataset/engine/datasetops/map_op.h
+0
-4
mindspore/ccsrc/dataset/engine/datasetops/shuffle_op.cc
mindspore/ccsrc/dataset/engine/datasetops/shuffle_op.cc
+6
-1
mindspore/ccsrc/dataset/util/random.cc
mindspore/ccsrc/dataset/util/random.cc
+6
-1
mindspore/ccsrc/dataset/util/services.cc
mindspore/ccsrc/dataset/util/services.cc
+5
-1
未找到文件。
mindspore/ccsrc/dataset/CMakeLists.txt
浏览文件 @
abd4239d
...
...
@@ -13,6 +13,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-format")
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wno-attributes"
)
############################# Options ################################
if
(
${
CMAKE_SYSTEM_NAME
}
MATCHES
"Windows"
)
add_definitions
(
-D _CRT_RAND_S
)
endif
()
if
(
ENABLE_GPUQUE
)
add_definitions
(
-D ENABLE_GPUQUE
)
message
(
STATUS
"GPU queue is enabled"
)
...
...
mindspore/ccsrc/dataset/engine/datasetops/map_op.cc
浏览文件 @
abd4239d
...
...
@@ -65,9 +65,6 @@ MapOp::MapOp(const std::vector<std::string> &in_col_names, const std::vector<std
tfuncs_
(
std
::
move
(
tensor_funcs
)),
in_columns_
(
in_col_names
),
out_columns_
(
out_col_names
),
#if defined(_WIN32) || defined(_WIN64)
eof_worker_id_
(
0
),
#endif
perf_mode_
(
perf_mode
)
{
// If caller didn't specify the out_col_names, assume they are same as the in_columns.
if
(
out_columns_
.
empty
()
||
out_columns_
[
0
].
empty
())
{
...
...
@@ -123,17 +120,6 @@ Status MapOp::operator()() {
RETURN_IF_NOT_OK
(
child_
[
0
]
->
GetNextBuffer
(
&
buff
,
0
));
is_eof
=
buff
->
eof
();
RETURN_IF_NOT_OK
(
local_queues_
[
que_id
]
->
Add
(
std
::
move
(
buff
)));
#if defined(_WIN32) || defined(_WIN64)
if
(
is_eof
)
{
eof_worker_id_
=
que_id
;
for
(
int32_t
id
=
0
;
id
<
num_workers_
;
id
++
)
{
if
(
id
!=
eof_worker_id_
)
{
auto
eof_buffer
=
std
::
make_unique
<
DataBuffer
>
(
0
,
DataBuffer
::
kDeBFlagEOF
);
RETURN_IF_NOT_OK
(
local_queues_
[
id
]
->
Add
(
std
::
move
(
eof_buffer
)));
}
}
}
#endif
que_id
=
(
que_id
+
1
)
%
num_workers_
;
}
}
...
...
@@ -173,14 +159,6 @@ Status MapOp::WorkerEntry(int32_t worker_id) {
continue
;
}
else
if
(
in_buffer
->
eof
())
{
// Calling base class EofReceived to forward eof buffer.
#if defined(_WIN32) || defined(_Win64)
if
(
perf_mode_
)
{
if
(
eof_worker_id_
==
worker_id
)
{
RETURN_IF_NOT_OK
(
EofReceived
(
worker_id
));
}
break
;
}
#endif
RETURN_IF_NOT_OK
(
EofReceived
(
worker_id
));
break
;
}
...
...
mindspore/ccsrc/dataset/engine/datasetops/map_op.h
浏览文件 @
abd4239d
...
...
@@ -193,10 +193,6 @@ class MapOp : public ParallelOp {
// cause additional blocking because pop calls to Connector from the threads are synchronized to enforce the order.
bool
perf_mode_
;
#if defined(_WIN32) || defined(_WIN64)
// EOF worker id is only work on Performance mode, to record the worker id of queue which gets EOF
int32_t
eof_worker_id_
;
#endif
// Private function for worker/thread to loop continuously. It comprises the main
// logic of MapOp: getting the data from previous Op, validating user specified column names,
// applying a list of TensorOps to each of the data, process the results and then
...
...
mindspore/ccsrc/dataset/engine/datasetops/shuffle_op.cc
浏览文件 @
abd4239d
...
...
@@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(_WIN32) || defined(_WIN64)
#include <stdlib.h>
#endif
#include <securec.h>
#include <algorithm>
#include <chrono>
...
...
@@ -86,7 +89,9 @@ Status ShuffleOp::SelfReset() {
rng_
=
std
::
mt19937_64
(
shuffle_seed_
);
}
else
{
#if defined(_WIN32) || defined(_WIN64)
std
::
random_device
random_device
;
unsigned
int
number
;
rand_s
(
&
number
);
std
::
mt19937
random_device
{
static_cast
<
uint32_t
>
(
number
)};
#else
std
::
random_device
random_device
(
"/dev/urandom"
);
#endif
...
...
mindspore/ccsrc/dataset/util/random.cc
浏览文件 @
abd4239d
...
...
@@ -18,6 +18,9 @@
#include "dataset/util/random.h"
#if defined(_WIN32) || defined(_WIn64)
#include <stdlib.h>
#endif
#include <limits>
#include <memory>
#include <random>
...
...
@@ -33,7 +36,9 @@ uint32_t GetSeed() {
uint32_t
seed
=
GlobalContext
::
config_manager
()
->
seed
();
if
(
seed
==
std
::
mt19937
::
default_seed
)
{
#if defined(_WIN32) || defined(_WIN64)
std
::
random_device
random_device
;
unsigned
int
number
;
rand_s
(
&
number
);
std
::
mt19937
random_device
{
static_cast
<
uint32_t
>
(
number
)};
#else
std
::
random_device
random_device
(
"/dev/urandom"
);
#endif
...
...
mindspore/ccsrc/dataset/util/services.cc
浏览文件 @
abd4239d
...
...
@@ -18,6 +18,8 @@
#include <limits.h>
#if !defined(_WIN32) && !defined(_WIN64)
#include <sys/syscall.h>
#else
#include <stdlib.h>
#endif
#include <unistd.h>
#include <random>
...
...
@@ -49,7 +51,9 @@ int Services::GetLWP() { return syscall(SYS_gettid); }
std
::
string
Services
::
GetUniqueID
()
{
const
std
::
string
kStr
=
"abcdefghijklmnopqrstuvwxyz0123456789"
;
#if defined(_WIN32) || defined(_WIN64)
std
::
mt19937
gen
{
std
::
random_device
{}()};
unsigned
int
number
;
rand_s
(
&
number
);
std
::
mt19937
gen
{
static_cast
<
uint32_t
>
(
number
)};
#else
std
::
mt19937
gen
{
std
::
random_device
{
"/dev/urandom"
}()};
#endif
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录