Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
0ad7053e
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0ad7053e
编写于
7月 09, 2017
作者:
D
dongzhihong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
"make parameterCheckpoint exported"
上级
87e7924e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
10 deletion
+10
-10
go/cmd/pserver/pserver.go
go/cmd/pserver/pserver.go
+1
-1
go/pserver/service.go
go/pserver/service.go
+9
-9
未找到文件。
go/cmd/pserver/pserver.go
浏览文件 @
0ad7053e
...
...
@@ -21,7 +21,7 @@ func main() {
etcdTimeout
:=
flag
.
Int
(
"etcd-timeout"
,
5
,
"timeout for etcd calls"
)
numPservers
:=
flag
.
Int
(
"num-pservers"
,
1
,
"total pserver count in a training job"
)
checkpointPath
:=
flag
.
String
(
"checkpoint-path"
,
"/checkpoints/"
,
"save checkpoint path"
)
checkpointInterval
:=
flag
.
Int
(
"checkpoint-interval"
,
1
0
,
"save checkpoint per interval seconds"
)
checkpointInterval
:=
flag
.
Int
(
"checkpoint-interval"
,
60
0
,
"save checkpoint per interval seconds"
)
logLevel
:=
flag
.
String
(
"log-level"
,
"info"
,
"log level, possible values: debug, info, warning, error, fatal, panic"
)
flag
.
Parse
()
...
...
go/pserver/service.go
浏览文件 @
0ad7053e
...
...
@@ -51,8 +51,8 @@ type ParameterWithConfig struct {
Config
[]
byte
// parameter configuration in Proto Buffer format
}
//
Checkpoint of Parameter and State
type
parameterCheckP
oint
struct
{
//
ParameterCheckpoint is Parameter and State checkpoint
type
ParameterCheckp
oint
struct
{
ParamConfig
ParameterWithConfig
State
[]
byte
}
...
...
@@ -65,7 +65,7 @@ type checkpointMeta struct {
}
// Checkpoint is the pserver shard persist in file
type
Checkpoint
[]
parameterCheckP
oint
type
Checkpoint
[]
ParameterCheckp
oint
// Gradient is the gradient of the parameter.
type
Gradient
Parameter
...
...
@@ -186,10 +186,10 @@ func (s *Service) doCheckpoint() error {
s
.
mu
.
Lock
()
defer
s
.
mu
.
Unlock
()
cp
:=
make
([]
parameterCheckP
oint
,
0
,
len
(
s
.
optMap
))
cp
:=
make
([]
ParameterCheckp
oint
,
0
,
len
(
s
.
optMap
))
index
:=
0
for
name
,
opt
:=
range
s
.
optMap
{
var
pc
parameterCheckP
oint
var
pc
ParameterCheckp
oint
pc
.
ParamConfig
.
Param
.
Name
=
name
pc
.
ParamConfig
.
Param
.
ElementType
=
opt
.
elementType
pc
.
ParamConfig
.
Param
.
Content
=
opt
.
GetWeights
()
...
...
@@ -210,8 +210,8 @@ func (s *Service) doCheckpoint() error {
h
:=
md5
.
New
()
cpMeta
.
Md5sum
=
hex
.
EncodeToString
(
h
.
Sum
(
buf
.
Bytes
()))
cpMetajson
,
err
:=
json
.
Marshal
(
cpMeta
)
s
.
client
.
PutKey
(
filepath
.
Join
(
PsCheckpoint
,
strconv
.
Itoa
(
s
.
idx
)),
cpMetajson
,
3
)
cpMetajson
,
_
:=
json
.
Marshal
(
cpMeta
)
err
=
s
.
client
.
PutKey
(
filepath
.
Join
(
PsCheckpoint
,
strconv
.
Itoa
(
s
.
idx
)),
cpMetajson
,
3
)
if
err
!=
nil
{
return
err
}
...
...
@@ -224,13 +224,13 @@ func (s *Service) doCheckpoint() error {
f
,
err
:=
os
.
Create
(
cpMeta
.
UUID
)
defer
f
.
Close
()
if
err
!=
nil
{
log
.
Errorln
(
err
)
return
err
}
writer
:=
bufio
.
NewWriter
(
f
)
_
,
err
=
writer
.
Write
(
buf
.
Bytes
())
writer
.
Flush
()
if
err
!=
nil
{
log
.
Errorln
(
err
)
return
err
}
return
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录