Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f29fb396
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
f29fb396
编写于
10月 21, 2020
作者:
D
danleifeng
提交者:
GitHub
10月 21, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
dygraph nccl init support host domain name (#28107)
* nccl init support hostname and ip; test=develop
上级
5cd97a1c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
15 addition
and
2 deletion
+15
-2
paddle/fluid/imperative/nccl_context.cc
paddle/fluid/imperative/nccl_context.cc
+13
-1
paddle/fluid/imperative/nccl_context.h
paddle/fluid/imperative/nccl_context.h
+1
-0
paddle/fluid/imperative/tests/nccl_context_test.cc
paddle/fluid/imperative/tests/nccl_context_test.cc
+1
-1
未找到文件。
paddle/fluid/imperative/nccl_context.cc
浏览文件 @
f29fb396
...
@@ -100,7 +100,19 @@ void NCCLParallelContext::SendNCCLID(const std::string &ep,
...
@@ -100,7 +100,19 @@ void NCCLParallelContext::SendNCCLID(const std::string &ep,
serv_addr
.
sin_family
=
AF_INET
;
serv_addr
.
sin_family
=
AF_INET
;
serv_addr
.
sin_port
=
htons
(
port
);
serv_addr
.
sin_port
=
htons
(
port
);
if
(
inet_pton
(
AF_INET
,
host
.
c_str
(),
&
serv_addr
.
sin_addr
)
<=
0
)
{
char
*
ip
=
NULL
;
struct
hostent
*
hp
;
if
((
hp
=
gethostbyname
(
host
.
c_str
()))
==
NULL
)
{
PADDLE_THROW
(
platform
::
errors
::
InvalidArgument
(
"Fail to get host by name %s."
,
host
));
}
int
i
=
0
;
while
(
hp
->
h_addr_list
[
i
]
!=
NULL
)
{
ip
=
inet_ntoa
(
*
(
struct
in_addr
*
)
hp
->
h_addr_list
[
i
]);
VLOG
(
3
)
<<
"gethostbyname host:"
<<
host
<<
" ->ip: "
<<
ip
;
break
;
}
if
(
inet_pton
(
AF_INET
,
ip
,
&
serv_addr
.
sin_addr
)
<=
0
)
{
PADDLE_THROW
(
platform
::
errors
::
Unavailable
(
"Open address %s failed."
,
ep
));
PADDLE_THROW
(
platform
::
errors
::
Unavailable
(
"Open address %s failed."
,
ep
));
}
}
...
...
paddle/fluid/imperative/nccl_context.h
浏览文件 @
f29fb396
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
// network header files
// network header files
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
#if defined(PADDLE_WITH_CUDA) && !defined(_WIN32)
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/socket.h>
...
...
paddle/fluid/imperative/tests/nccl_context_test.cc
浏览文件 @
f29fb396
...
@@ -20,7 +20,7 @@ namespace imperative = paddle::imperative;
...
@@ -20,7 +20,7 @@ namespace imperative = paddle::imperative;
namespace
platform
=
paddle
::
platform
;
namespace
platform
=
paddle
::
platform
;
imperative
::
ParallelStrategy
GetStrategy
(
int
local_rank
)
{
imperative
::
ParallelStrategy
GetStrategy
(
int
local_rank
)
{
std
::
vector
<
std
::
string
>
eps
=
{
"127.0.0.1:9866"
,
"
127.0.0.1
:9867"
};
std
::
vector
<
std
::
string
>
eps
=
{
"127.0.0.1:9866"
,
"
localhost
:9867"
};
imperative
::
ParallelStrategy
strategy
;
imperative
::
ParallelStrategy
strategy
;
strategy
.
trainer_endpoints_
=
eps
;
strategy
.
trainer_endpoints_
=
eps
;
strategy
.
current_endpoint_
=
eps
[
local_rank
];
strategy
.
current_endpoint_
=
eps
[
local_rank
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录