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 个修改的文件
包含
22 行增加
和
26 行删除
+22
-26
source/train/XLeader.cpp
+10
-10
source/train/XLeader.h
+4
-5
source/train/XLeaderAllReduce.cpp
+4
-6
source/train/XLeaderPS.cpp
+4
-5
没有找到文件。
source/train/XLeader.cpp
查看文件 @
51e02fd6
...
...
@@ -69,9 +69,9 @@ void XLeader::Init()
delete
(
XWorkerBroadcast
*
)
bworkers
.
GetItem
(
i
);
bworkers
.
Clear
();
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
delete
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
p
workers
.
Clear
();
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
delete
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
a
workers
.
Clear
();
serverRecord
.
Clear
();
}
...
...
@@ -142,7 +142,7 @@ void XLeader::InitForRun()
workers
.
AddList
(
&
cworkers
);
workers
.
AddList
(
&
uworkers
);
workers
.
AddList
(
&
bworkers
);
workers
.
AddList
(
&
p
workers
);
workers
.
AddList
(
&
a
workers
);
for
(
int
i
=
0
;
i
<
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
workers
[
i
];
...
...
@@ -234,8 +234,8 @@ void XLeader::SetInstantRun(bool flag)
worker
->
SetInstantRun
(
flag
);
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
worker
->
SetInstantRun
(
flag
);
}
}
...
...
@@ -266,8 +266,8 @@ void XLeader::Start()
worker
->
Start
();
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
.
GetItem
(
i
);
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
a
workers
.
GetItem
(
i
);
worker
->
Start
();
}
}
...
...
@@ -331,7 +331,7 @@ void XLeader::AddParamterWorker(int n)
{
for
(
int
i
=
0
;
i
<
n
;
i
++
)
{
XWorker
*
worker
=
new
XWorker
();
p
workers
.
Add
(
worker
);
a
workers
.
Add
(
worker
);
}
}
...
...
@@ -378,7 +378,7 @@ void XLeader::MakeParamMap()
paramMap
[
i
][
c
].
tensor
=
model
->
params
[
i
].
tensor
;
paramMap
[
i
][
c
].
grad
=
model
->
params
[
i
].
tensor
->
grad
;
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
++
;
}
else
{
...
...
source/train/XLeader.h
查看文件 @
51e02fd6
...
...
@@ -89,11 +89,10 @@ protected:
/* data-broadcasting workers */
XList
bworkers
;
/* parameter workers (each for a paramter). cworkers,
uworkers, and bworkers would push their jobs into
parameter workers. So they are actually pipelines
of jobs. */
XList
pworkers
;
/* auxiliary workers. These workers are pipelines of
updating parameters (one for each parameter, or one
for each job worker) */
XList
aworkers
;
/* map of parameters. (x,y) indexes parameter x of
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
AddCollectWorker
();
for
(
int
i
=
0
;
i
<
jobWorkerNum
;
i
++
)
AddUpdateWorker
(
model
);
AddParamterWorker
(
model
->
paramNum
);
XLeader
::
MakeAll
(
config
,
model
);
}
...
...
@@ -111,7 +110,7 @@ bool XLeaderAllReduce::Run(XConfig* config, DataDistributeBase* dataDistributor,
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
p
workers
.
count
>
0
,
"No pworkers!"
);
CheckNTErrors
(
a
workers
.
count
>
0
,
"No pworkers!"
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
int
activeJobCount
=
0
;
...
...
@@ -213,8 +212,8 @@ void XLeaderAllReduce::RunUpdate(XConfig* config, XOptimizer* optimizer, const i
membersAll
.
Add
(
worker
->
GetModel
());
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
[
i
];
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
a
workers
[
i
];
jobQueues
.
Add
(
worker
->
GetJobQueue
());
}
...
...
@@ -333,4 +332,4 @@ void XLeaderAllReduce::RunUpdate(XConfig* config, XOptimizer* optimizer, const i
delete
[]
paramList
;
}
}
\ No newline at end of file
}
source/train/XLeaderPS.cpp
查看文件 @
51e02fd6
...
...
@@ -116,7 +116,7 @@ bool XLeaderPS::Run(XConfig* config, DataDistributeBase* dataDistributor, XOptim
CheckNTErrors
(
cworkers
.
count
>
0
,
"No cworkers!"
);
CheckNTErrors
(
uworkers
.
count
>
0
,
"No uworkers!"
);
CheckNTErrors
(
bworkers
.
count
>
0
,
"No bworkers!"
);
CheckNTErrors
(
p
workers
.
count
>
0
,
"No pworkers!"
);
CheckNTErrors
(
a
workers
.
count
>
0
,
"No pworkers!"
);
bool
isToUpdate
=
(
optimizer
!=
NULL
);
int
activeJobCount
=
0
;
...
...
@@ -218,8 +218,8 @@ void XLeaderPS::RunUpdate(XConfig* config, XOptimizer* optimizer, const int* act
membersAll
.
Add
(
worker
->
GetModel
());
}
for
(
int
i
=
0
;
i
<
p
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
p
workers
[
i
];
for
(
int
i
=
0
;
i
<
a
workers
.
count
;
i
++
)
{
XWorker
*
worker
=
(
XWorker
*
)
a
workers
[
i
];
jobQueues
.
Add
(
worker
->
GetJobQueue
());
}
...
...
@@ -338,4 +338,4 @@ void XLeaderPS::RunUpdate(XConfig* config, XOptimizer* optimizer, const int* act
delete
[]
paramList
;
}
}
\ No newline at end of file
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论