Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
N
NiuTrans.Tensor
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
8
Issues
8
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
NiuTrans
NiuTrans.Tensor
Commits
51e02fd6
Commit
51e02fd6
authored
Mar 30, 2021
by
xiaotong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename pworker as aworker
parent
c0bcb78b
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
20 行增加
和
22 行删除
+20
-22
source/train/XLeader.cpp
+10
-10
source/train/XLeader.h
+4
-5
source/train/XLeaderAllReduce.cpp
+3
-4
source/train/XLeaderPS.cpp
+3
-3
没有找到文件。
source/train/XLeader.cpp
查看文件 @
51e02fd6
...
@@ -69,9 +69,9 @@ void XLeader::Init()
...
@@ -69,9 +69,9 @@ void XLeader::Init()
delete
(
XWorkerBroadcast
*
)
bworkers
.
GetItem
(
i
);
delete
(
XWorkerBroadcast
*
)
bworkers
.
GetItem
(
i
);
bworkers
.
Clear
();
bworkers
.
Clear
();
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
delete
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
delete
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
p
workers
.
Clear
();
a
workers
.
Clear
();
serverRecord
.
Clear
();
serverRecord
.
Clear
();
}
}
...
@@ -142,7 +142,7 @@ void XLeader::InitForRun()
...
@@ -142,7 +142,7 @@ void XLeader::InitForRun()
workers
.
AddList
(
&
cworkers
);
workers
.
AddList
(
&
cworkers
);
workers
.
AddList
(
&
uworkers
);
workers
.
AddList
(
&
uworkers
);
workers
.
AddList
(
&
bworkers
);
workers
.
AddList
(
&
bworkers
);
workers
.
AddList
(
&
p
workers
);
workers
.
AddList
(
&
a
workers
);
for
(
int
i
=
0
;
i
<
workers
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
workers
[
i
];
XWorker
*
worker
=
(
XWorker
*
)
workers
[
i
];
...
@@ -234,8 +234,8 @@ void XLeader::SetInstantRun(bool flag)
...
@@ -234,8 +234,8 @@ void XLeader::SetInstantRun(bool flag)
worker
->
SetInstantRun
(
flag
);
worker
->
SetInstantRun
(
flag
);
}
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
XWorker
*
worker
=
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
worker
->
SetInstantRun
(
flag
);
worker
->
SetInstantRun
(
flag
);
}
}
}
}
...
@@ -266,8 +266,8 @@ void XLeader::Start()
...
@@ -266,8 +266,8 @@ void XLeader::Start()
worker
->
Start
();
worker
->
Start
();
}
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
XWorker
*
worker
=
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
worker
->
Start
();
worker
->
Start
();
}
}
}
}
...
@@ -331,7 +331,7 @@ void XLeader::AddParamterWorker(int n)
...
@@ -331,7 +331,7 @@ void XLeader::AddParamterWorker(int n)
{
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
XWorker
*
worker
=
new
XWorker
();
XWorker
*
worker
=
new
XWorker
();
p
workers
.
Add
(
worker
);
a
workers
.
Add
(
worker
);
}
}
}
}
...
@@ -378,7 +378,7 @@ void XLeader::MakeParamMap()
...
@@ -378,7 +378,7 @@ void XLeader::MakeParamMap()
paramMap
[
i
][
c
].
tensor
=
model
->
params
[
i
].
tensor
;
paramMap
[
i
][
c
].
tensor
=
model
->
params
[
i
].
tensor
;
paramMap
[
i
][
c
].
grad
=
model
->
params
[
i
].
tensor
->
grad
;
paramMap
[
i
][
c
].
grad
=
model
->
params
[
i
].
tensor
->
grad
;
paramMap
[
i
][
c
].
flag
=
PARAM_STATE_NOT_READY
;
paramMap
[
i
][
c
].
flag
=
PARAM_STATE_NOT_READY
;
paramMap
[
i
][
c
].
trainFlag
=
PARAM_STATE_NOT_READY
;
;
paramMap
[
i
][
c
].
trainFlag
=
PARAM_STATE_NOT_READY
;
c
++
;
c
++
;
}
}
else
{
else
{
...
...
source/train/XLeader.h
查看文件 @
51e02fd6
...
@@ -89,11 +89,10 @@ protected:
...
@@ -89,11 +89,10 @@ protected:
/* data-broadcasting workers */
/* data-broadcasting workers */
XList
bworkers
;
XList
bworkers
;
/* parameter workers (each for a paramter). cworkers,
/* auxiliary workers. These workers are pipelines of
uworkers, and bworkers would push their jobs into
updating parameters (one for each parameter, or one
parameter workers. So they are actually pipelines
for each job worker) */
of jobs. */
XList
aworkers
;
XList
pworkers
;
/* map of parameters. (x,y) indexes parameter x of
/* map of parameters. (x,y) indexes parameter x of
worker y. Note that a worker keeps a copy of the
worker y. Note that a worker keeps a copy of the
...
...
source/train/XLeaderAllReduce.cpp
查看文件 @
51e02fd6
...
@@ -59,7 +59,6 @@ void XLeaderAllReduce::MakeAll(XConfig * config, XModel * model, const int * dev
...
@@ -59,7 +59,6 @@ void XLeaderAllReduce::MakeAll(XConfig * config, XModel * model, const int * dev
AddCollectWorker
();
AddCollectWorker
();
for
(
int
i
=
0
;
i
<
jobWorkerNum
;
i
++
)
for
(
int
i
=
0
;
i
<
jobWorkerNum
;
i
++
)
AddUpdateWorker
(
model
);
AddUpdateWorker
(
model
);
AddParamterWorker
(
model
->
paramNum
);
XLeader
::
MakeAll
(
config
,
model
);
XLeader
::
MakeAll
(
config
,
model
);
}
}
...
@@ -111,7 +110,7 @@ bool XLeaderAllReduce::Run(XConfig* config, DataDistributeBase* dataDistributor,
...
@@ -111,7 +110,7 @@ bool XLeaderAllReduce::Run(XConfig* config, DataDistributeBase* dataDistributor,
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
p
workers
.
count
>
0
,
"No pworkers!"
);
CheckNTErrors
(
a
workers
.
count
>
0
,
"No pworkers!"
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
int
activeJobCount
=
0
;
int
activeJobCount
=
0
;
...
@@ -213,8 +212,8 @@ void XLeaderAllReduce::RunUpdate(XConfig* config, XOptimizer* optimizer, const i
...
@@ -213,8 +212,8 @@ void XLeaderAllReduce::RunUpdate(XConfig* config, XOptimizer* optimizer, const i
membersAll
.
Add
(
worker
->
GetModel
());
membersAll
.
Add
(
worker
->
GetModel
());
}
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
[
i
];
XWorker
*
worker
=
(
XWorker
*
)
a
workers
[
i
];
jobQueues
.
Add
(
worker
->
GetJobQueue
());
jobQueues
.
Add
(
worker
->
GetJobQueue
());
}
}
...
...
source/train/XLeaderPS.cpp
查看文件 @
51e02fd6
...
@@ -116,7 +116,7 @@ bool XLeaderPS::Run(XConfig* config, DataDistributeBase* dataDistributor, XOptim
...
@@ -116,7 +116,7 @@ bool XLeaderPS::Run(XConfig* config, DataDistributeBase* dataDistributor, XOptim
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
p
workers
.
count
>
0
,
"No pworkers!"
);
CheckNTErrors
(
a
workers
.
count
>
0
,
"No pworkers!"
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
int
activeJobCount
=
0
;
int
activeJobCount
=
0
;
...
@@ -218,8 +218,8 @@ void XLeaderPS::RunUpdate(XConfig* config, XOptimizer* optimizer, const int* act
...
@@ -218,8 +218,8 @@ void XLeaderPS::RunUpdate(XConfig* config, XOptimizer* optimizer, const int* act
membersAll
.
Add
(
worker
->
GetModel
());
membersAll
.
Add
(
worker
->
GetModel
());
}
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
[
i
];
XWorker
*
worker
=
(
XWorker
*
)
a
workers
[
i
];
jobQueues
.
Add
(
worker
->
GetJobQueue
());
jobQueues
.
Add
(
worker
->
GetJobQueue
());
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论