Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
18e5935c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
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看板
提交
18e5935c
编写于
6月 13, 2017
作者:
T
Travis CI
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Deploy to GitHub Pages:
0e2acb8b
上级
c99a8742
变更
6
展开全部
显示空白变更内容
内联
并排
Showing
6 changed file
with
102 addition
and
50 deletion
+102
-50
develop/doc/_sources/design/cluster_train/pserver_client.md.txt
...p/doc/_sources/design/cluster_train/pserver_client.md.txt
+25
-12
develop/doc/design/cluster_train/pserver_client.html
develop/doc/design/cluster_train/pserver_client.html
+25
-12
develop/doc/searchindex.js
develop/doc/searchindex.js
+1
-1
develop/doc_cn/_sources/design/cluster_train/pserver_client.md.txt
...oc_cn/_sources/design/cluster_train/pserver_client.md.txt
+25
-12
develop/doc_cn/design/cluster_train/pserver_client.html
develop/doc_cn/design/cluster_train/pserver_client.html
+25
-12
develop/doc_cn/searchindex.js
develop/doc_cn/searchindex.js
+1
-1
未找到文件。
develop/doc/_sources/design/cluster_train/pserver_client.md.txt
浏览文件 @
18e5935c
...
...
@@ -74,14 +74,25 @@ typedef enum {
typedef struct {
char* name;
paddle_element_type element_type;
void*
content;
unsigned char*
content;
int content_len;
} paddle_parameter, paddle_gradient;
typedef
struct paddle_pserver_clie
nt paddle_pserver_client;
typedef
i
nt paddle_pserver_client;
paddle_pserver_client* paddle_new_pserver_client();
void paddle_pserver_client_release(paddle_pserver_client* client);
/**
* @brief creates a pserver client that talks to etcd for coordination.
*/
paddle_pserver_client paddle_new_etcd_pserver_client(char* etcd_addr);
/**
* @brief creates a pserver client given pserver addresses.
*
* @param pserver_addrs comma-separated pserver addresses.
* @param selected if current pserver client is selected to initialize all parameter servers.
*/
paddle_pserver_client paddle_new_pserver_client(char* pserver_addrs, int selected);
void paddle_pserver_client_release(paddle_pserver_client c);
/**
* @brief paddle_begin_init_params begins to initialize parameters on
...
...
@@ -95,7 +106,7 @@ void paddle_pserver_client_release(paddle_pserver_client* client);
* @return 1 if the trainer is selected to initialize parameter
* servers, otherwise 0.
*/
int paddle_begin_init_params(paddle_pserver_client
*
client);
int paddle_begin_init_params(paddle_pserver_client client);
/**
* @brief paddle_init_param initializes the parameter on parameter
...
...
@@ -109,7 +120,7 @@ int paddle_begin_init_params(paddle_pserver_client* client);
* @paddle_begin_init_param). Or simply exit the program and wait for
* the cluster management system to restart the trainer.
*/
int paddle_init_param(paddle_pserver_client
*
client, paddle_parameter param, const unsigned char* param_config_proto, int config_len);
int paddle_init_param(paddle_pserver_client client, paddle_parameter param, const unsigned char* param_config_proto, int config_len);
/**
* @brief paddle_finish_init_params tells parameter servers client has
...
...
@@ -120,7 +131,7 @@ int paddle_init_param(paddle_pserver_client* client, paddle_parameter param, con
* @paddle_begin_init_param). Or simply exit the program and wait for
* the cluster management system to restart the trainer.
*/
int paddle_finish_init_params(paddle_pserver_client
*
client);
int paddle_finish_init_params(paddle_pserver_client client);
/**
* @brief paddle_send_grads sends gradients to parameter servers for
...
...
@@ -131,7 +142,7 @@ int paddle_finish_init_params(paddle_pserver_client* client);
* @param learning_rate the learning rate for the gradients.
* @return 0 if successful, otherwise -1.
*/
int paddle_send_grads(paddle_pserver_client
*
client, const paddle_gradient* grads, int len);
int paddle_send_grads(paddle_pserver_client client, const paddle_gradient* grads, int len);
/**
* @brief paddle_get_params gets parameters from parameter servers.
...
...
@@ -139,13 +150,15 @@ int paddle_send_grads(paddle_pserver_client* client, const paddle_gradient* grad
* paddle_get_params will block until parameters are initialized on
* the parameter servers.
*
* @param names the array of names of the parameters to get.
* @param dst the destination array of parameters to save to.
* @param dst the destination array of parameter pointers to save to.
* The parameter pointer must be pre-popullated with required parameter name,
* and the content of parameter must be pre-allocated of the size of required
* parameter on pserver.
* @param len the length of the names array and the paddle_parameter
* array.
* @return 0 if successful, otherwise -1.
*/
int paddle_get_params(paddle_pserver_client
* client, const char** names, paddle_parameter
* dst, int len);
int paddle_get_params(paddle_pserver_client
client, paddle_parameter*
* dst, int len);
/**
* @brief paddle_save_model indicates parameters to save the parameter
...
...
@@ -154,5 +167,5 @@ int paddle_get_params(paddle_pserver_client* client, const char** names, paddle_
* @param path the path to save parameters.
* @return 0 if successful, otherwise -1.
*/
int paddle_save_model(paddle_pserver_client
*
client, const char* path);
int paddle_save_model(paddle_pserver_client client, const char* path);
```
develop/doc/design/cluster_train/pserver_client.html
浏览文件 @
18e5935c
...
...
@@ -244,14 +244,25 @@ name:sparse-n-1
<span
class=
"k"
>
typedef
</span>
<span
class=
"k"
>
struct
</span>
<span
class=
"p"
>
{
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
name
</span><span
class=
"p"
>
;
</span>
<span
class=
"n"
>
paddle_element_type
</span>
<span
class=
"n"
>
element_type
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
void
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
content
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
content
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
content_len
</span><span
class=
"p"
>
;
</span>
<span
class=
"p"
>
}
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"p"
>
;
</span>
<span
class=
"k"
>
typedef
</span>
<span
class=
"k
"
>
struct
</span>
<span
class=
"n"
>
paddle_pserver_clie
nt
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"p"
>
;
</span>
<span
class=
"k"
>
typedef
</span>
<span
class=
"k
t"
>
i
nt
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"p"
>
;
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"o"
>
*
</span>
<span
class=
"nf"
>
paddle_new_pserver_client
</span><span
class=
"p"
>
();
</span>
<span
class=
"kt"
>
void
</span>
<span
class=
"nf"
>
paddle_pserver_client_release
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief creates a pserver client that talks to etcd for coordination.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"nf"
>
paddle_new_etcd_pserver_client
</span><span
class=
"p"
>
(
</span><span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
etcd_addr
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief creates a pserver client given pserver addresses.
</span>
<span
class=
"cm"
>
*
</span>
<span
class=
"cm"
>
* @param pserver_addrs comma-separated pserver addresses.
</span>
<span
class=
"cm"
>
* @param selected if current pserver client is selected to initialize all parameter servers.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"nf"
>
paddle_new_pserver_client
</span><span
class=
"p"
>
(
</span><span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
pserver_addrs
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
selected
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
void
</span>
<span
class=
"nf"
>
paddle_pserver_client_release
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
c
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_begin_init_params begins to initialize parameters on
</span>
...
...
@@ -265,7 +276,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @return 1 if the trainer is selected to initialize parameter
</span>
<span
class=
"cm"
>
* servers, otherwise 0.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_begin_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_begin_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_init_param initializes the parameter on parameter
</span>
...
...
@@ -279,7 +290,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @paddle_begin_init_param). Or simply exit the program and wait for
</span>
<span
class=
"cm"
>
* the cluster management system to restart the trainer.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_init_param
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span>
<span
class=
"n"
>
param
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
param_config_proto
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
config_len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_init_param
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span>
<span
class=
"n"
>
param
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
param_config_proto
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
config_len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_finish_init_params tells parameter servers client has
</span>
...
...
@@ -290,7 +301,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @paddle_begin_init_param). Or simply exit the program and wait for
</span>
<span
class=
"cm"
>
* the cluster management system to restart the trainer.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_finish_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_finish_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_send_grads sends gradients to parameter servers for
</span>
...
...
@@ -301,7 +312,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @param learning_rate the learning rate for the gradients.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_send_grads
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
grads
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_send_grads
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
grads
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_get_params gets parameters from parameter servers.
</span>
...
...
@@ -309,13 +320,15 @@ name:sparse-n-1
<span
class=
"cm"
>
* paddle_get_params will block until parameters are initialized on
</span>
<span
class=
"cm"
>
* the parameter servers.
</span>
<span
class=
"cm"
>
*
</span>
<span
class=
"cm"
>
* @param names the array of names of the parameters to get.
</span>
<span
class=
"cm"
>
* @param dst the destination array of parameters to save to.
</span>
<span
class=
"cm"
>
* @param dst the destination array of parameter pointers to save to.
</span>
<span
class=
"cm"
>
* The parameter pointer must be pre-popullated with required parameter name,
</span>
<span
class=
"cm"
>
* and the content of parameter must be pre-allocated of the size of required
</span>
<span
class=
"cm"
>
* parameter on pserver.
</span>
<span
class=
"cm"
>
* @param len the length of the names array and the paddle_parameter
</span>
<span
class=
"cm"
>
* array.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_get_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
**
</span>
<span
class=
"n"
>
names
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
dst
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_get_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"o"
>
*
*
</span>
<span
class=
"n"
>
dst
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_save_model indicates parameters to save the parameter
</span>
...
...
@@ -324,7 +337,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @param path the path to save parameters.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_save_model
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
path
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_save_model
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
path
</span><span
class=
"p"
>
);
</span>
</pre></div>
</div>
</div>
...
...
develop/doc/searchindex.js
浏览文件 @
18e5935c
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
develop/doc_cn/_sources/design/cluster_train/pserver_client.md.txt
浏览文件 @
18e5935c
...
...
@@ -74,14 +74,25 @@ typedef enum {
typedef struct {
char* name;
paddle_element_type element_type;
void*
content;
unsigned char*
content;
int content_len;
} paddle_parameter, paddle_gradient;
typedef
struct paddle_pserver_clie
nt paddle_pserver_client;
typedef
i
nt paddle_pserver_client;
paddle_pserver_client* paddle_new_pserver_client();
void paddle_pserver_client_release(paddle_pserver_client* client);
/**
* @brief creates a pserver client that talks to etcd for coordination.
*/
paddle_pserver_client paddle_new_etcd_pserver_client(char* etcd_addr);
/**
* @brief creates a pserver client given pserver addresses.
*
* @param pserver_addrs comma-separated pserver addresses.
* @param selected if current pserver client is selected to initialize all parameter servers.
*/
paddle_pserver_client paddle_new_pserver_client(char* pserver_addrs, int selected);
void paddle_pserver_client_release(paddle_pserver_client c);
/**
* @brief paddle_begin_init_params begins to initialize parameters on
...
...
@@ -95,7 +106,7 @@ void paddle_pserver_client_release(paddle_pserver_client* client);
* @return 1 if the trainer is selected to initialize parameter
* servers, otherwise 0.
*/
int paddle_begin_init_params(paddle_pserver_client
*
client);
int paddle_begin_init_params(paddle_pserver_client client);
/**
* @brief paddle_init_param initializes the parameter on parameter
...
...
@@ -109,7 +120,7 @@ int paddle_begin_init_params(paddle_pserver_client* client);
* @paddle_begin_init_param). Or simply exit the program and wait for
* the cluster management system to restart the trainer.
*/
int paddle_init_param(paddle_pserver_client
*
client, paddle_parameter param, const unsigned char* param_config_proto, int config_len);
int paddle_init_param(paddle_pserver_client client, paddle_parameter param, const unsigned char* param_config_proto, int config_len);
/**
* @brief paddle_finish_init_params tells parameter servers client has
...
...
@@ -120,7 +131,7 @@ int paddle_init_param(paddle_pserver_client* client, paddle_parameter param, con
* @paddle_begin_init_param). Or simply exit the program and wait for
* the cluster management system to restart the trainer.
*/
int paddle_finish_init_params(paddle_pserver_client
*
client);
int paddle_finish_init_params(paddle_pserver_client client);
/**
* @brief paddle_send_grads sends gradients to parameter servers for
...
...
@@ -131,7 +142,7 @@ int paddle_finish_init_params(paddle_pserver_client* client);
* @param learning_rate the learning rate for the gradients.
* @return 0 if successful, otherwise -1.
*/
int paddle_send_grads(paddle_pserver_client
*
client, const paddle_gradient* grads, int len);
int paddle_send_grads(paddle_pserver_client client, const paddle_gradient* grads, int len);
/**
* @brief paddle_get_params gets parameters from parameter servers.
...
...
@@ -139,13 +150,15 @@ int paddle_send_grads(paddle_pserver_client* client, const paddle_gradient* grad
* paddle_get_params will block until parameters are initialized on
* the parameter servers.
*
* @param names the array of names of the parameters to get.
* @param dst the destination array of parameters to save to.
* @param dst the destination array of parameter pointers to save to.
* The parameter pointer must be pre-popullated with required parameter name,
* and the content of parameter must be pre-allocated of the size of required
* parameter on pserver.
* @param len the length of the names array and the paddle_parameter
* array.
* @return 0 if successful, otherwise -1.
*/
int paddle_get_params(paddle_pserver_client
* client, const char** names, paddle_parameter
* dst, int len);
int paddle_get_params(paddle_pserver_client
client, paddle_parameter*
* dst, int len);
/**
* @brief paddle_save_model indicates parameters to save the parameter
...
...
@@ -154,5 +167,5 @@ int paddle_get_params(paddle_pserver_client* client, const char** names, paddle_
* @param path the path to save parameters.
* @return 0 if successful, otherwise -1.
*/
int paddle_save_model(paddle_pserver_client
*
client, const char* path);
int paddle_save_model(paddle_pserver_client client, const char* path);
```
develop/doc_cn/design/cluster_train/pserver_client.html
浏览文件 @
18e5935c
...
...
@@ -251,14 +251,25 @@ name:sparse-n-1
<span
class=
"k"
>
typedef
</span>
<span
class=
"k"
>
struct
</span>
<span
class=
"p"
>
{
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
name
</span><span
class=
"p"
>
;
</span>
<span
class=
"n"
>
paddle_element_type
</span>
<span
class=
"n"
>
element_type
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
void
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
content
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
content
</span><span
class=
"p"
>
;
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
content_len
</span><span
class=
"p"
>
;
</span>
<span
class=
"p"
>
}
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"p"
>
;
</span>
<span
class=
"k"
>
typedef
</span>
<span
class=
"k
"
>
struct
</span>
<span
class=
"n"
>
paddle_pserver_clie
nt
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"p"
>
;
</span>
<span
class=
"k"
>
typedef
</span>
<span
class=
"k
t"
>
i
nt
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"p"
>
;
</span>
<span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"o"
>
*
</span>
<span
class=
"nf"
>
paddle_new_pserver_client
</span><span
class=
"p"
>
();
</span>
<span
class=
"kt"
>
void
</span>
<span
class=
"nf"
>
paddle_pserver_client_release
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief creates a pserver client that talks to etcd for coordination.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"nf"
>
paddle_new_etcd_pserver_client
</span><span
class=
"p"
>
(
</span><span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
etcd_addr
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief creates a pserver client given pserver addresses.
</span>
<span
class=
"cm"
>
*
</span>
<span
class=
"cm"
>
* @param pserver_addrs comma-separated pserver addresses.
</span>
<span
class=
"cm"
>
* @param selected if current pserver client is selected to initialize all parameter servers.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"nf"
>
paddle_new_pserver_client
</span><span
class=
"p"
>
(
</span><span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
pserver_addrs
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
selected
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
void
</span>
<span
class=
"nf"
>
paddle_pserver_client_release
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
c
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_begin_init_params begins to initialize parameters on
</span>
...
...
@@ -272,7 +283,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @return 1 if the trainer is selected to initialize parameter
</span>
<span
class=
"cm"
>
* servers, otherwise 0.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_begin_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_begin_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_init_param initializes the parameter on parameter
</span>
...
...
@@ -286,7 +297,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @paddle_begin_init_param). Or simply exit the program and wait for
</span>
<span
class=
"cm"
>
* the cluster management system to restart the trainer.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_init_param
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span>
<span
class=
"n"
>
param
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
param_config_proto
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
config_len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_init_param
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span>
<span
class=
"n"
>
param
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
unsigned
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
param_config_proto
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
config_len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_finish_init_params tells parameter servers client has
</span>
...
...
@@ -297,7 +308,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @paddle_begin_init_param). Or simply exit the program and wait for
</span>
<span
class=
"cm"
>
* the cluster management system to restart the trainer.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_finish_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_finish_init_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_send_grads sends gradients to parameter servers for
</span>
...
...
@@ -308,7 +319,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @param learning_rate the learning rate for the gradients.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_send_grads
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
grads
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_send_grads
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"n"
>
paddle_gradient
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
grads
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_get_params gets parameters from parameter servers.
</span>
...
...
@@ -316,13 +327,15 @@ name:sparse-n-1
<span
class=
"cm"
>
* paddle_get_params will block until parameters are initialized on
</span>
<span
class=
"cm"
>
* the parameter servers.
</span>
<span
class=
"cm"
>
*
</span>
<span
class=
"cm"
>
* @param names the array of names of the parameters to get.
</span>
<span
class=
"cm"
>
* @param dst the destination array of parameters to save to.
</span>
<span
class=
"cm"
>
* @param dst the destination array of parameter pointers to save to.
</span>
<span
class=
"cm"
>
* The parameter pointer must be pre-popullated with required parameter name,
</span>
<span
class=
"cm"
>
* and the content of parameter must be pre-allocated of the size of required
</span>
<span
class=
"cm"
>
* parameter on pserver.
</span>
<span
class=
"cm"
>
* @param len the length of the names array and the paddle_parameter
</span>
<span
class=
"cm"
>
* array.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_get_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
**
</span>
<span
class=
"n"
>
names
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
dst
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_get_params
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"n"
>
paddle_parameter
</span><span
class=
"o"
>
*
*
</span>
<span
class=
"n"
>
dst
</span><span
class=
"p"
>
,
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"n"
>
len
</span><span
class=
"p"
>
);
</span>
<span
class=
"cm"
>
/**
</span>
<span
class=
"cm"
>
* @brief paddle_save_model indicates parameters to save the parameter
</span>
...
...
@@ -331,7 +344,7 @@ name:sparse-n-1
<span
class=
"cm"
>
* @param path the path to save parameters.
</span>
<span
class=
"cm"
>
* @return 0 if successful, otherwise -1.
</span>
<span
class=
"cm"
>
*/
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_save_model
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"o"
>
*
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
path
</span><span
class=
"p"
>
);
</span>
<span
class=
"kt"
>
int
</span>
<span
class=
"nf"
>
paddle_save_model
</span><span
class=
"p"
>
(
</span><span
class=
"n"
>
paddle_pserver_client
</span>
<span
class=
"n"
>
client
</span><span
class=
"p"
>
,
</span>
<span
class=
"k"
>
const
</span>
<span
class=
"kt"
>
char
</span><span
class=
"o"
>
*
</span>
<span
class=
"n"
>
path
</span><span
class=
"p"
>
);
</span>
</pre></div>
</div>
</div>
...
...
develop/doc_cn/searchindex.js
浏览文件 @
18e5935c
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录