Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5e61b04c
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看板
未验证
提交
5e61b04c
编写于
7月 18, 2023
作者:
F
Frank Lin
提交者:
GitHub
7月 18, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix UT: Try fixing test_the_one_ps and test_communicator_geo (#55263)
* extend timeout * Rewrite test_communicator_geo * black
上级
2dcb0ebf
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
49 addition
and
43 deletion
+49
-43
test/legacy_test/run_server_for_communicator_geo.py
test/legacy_test/run_server_for_communicator_geo.py
+37
-0
test/legacy_test/test_communicator_geo.py
test/legacy_test/test_communicator_geo.py
+11
-42
test/ps/CMakeLists.txt
test/ps/CMakeLists.txt
+1
-1
未找到文件。
test/legacy_test/run_server_for_communicator_geo.py
0 → 100644
浏览文件 @
5e61b04c
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
os
from
test_communicator_geo
import
TestCommunicatorGeoEnd2End
import
paddle
paddle
.
enable_static
()
pipe_name
=
os
.
getenv
(
"PIPE_FILE"
)
class
RunServer
(
TestCommunicatorGeoEnd2End
):
def
runTest
(
self
):
pass
os
.
environ
[
"TRAINING_ROLE"
]
=
"PSERVER"
half_run_server
=
RunServer
()
with
open
(
pipe_name
,
'w'
)
as
pipe
:
pipe
.
write
(
'done'
)
half_run_server
.
run_ut
()
test/legacy_test/test_communicator_geo.py
浏览文件 @
5e61b04c
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
import
os
import
os
import
subprocess
import
subprocess
import
sys
import
sys
import
t
im
e
import
t
empfil
e
import
unittest
import
unittest
import
numpy
import
numpy
...
@@ -124,51 +124,22 @@ class TestCommunicatorGeoEnd2End(unittest.TestCase):
...
@@ -124,51 +124,22 @@ class TestCommunicatorGeoEnd2End(unittest.TestCase):
self
.
run_pserver
(
role
,
strategy
)
self
.
run_pserver
(
role
,
strategy
)
def
test_communicator
(
self
):
def
test_communicator
(
self
):
run_server_cmd
=
"""
temp_dir
=
tempfile
.
TemporaryDirectory
()
pipe_name
=
os
.
path
.
join
(
temp_dir
.
name
,
'mypipe'
)
import sys
try
:
import os
os
.
mkfifo
(
pipe_name
)
except
OSError
as
oe
:
import time
print
(
f
"Failed to create pipe:
{
oe
}
"
)
import threading
import subprocess
import unittest
import numpy
import paddle
import paddle.fluid as fluid
from paddle.distributed.communicator import Communicator
import paddle.incubate.distributed.fleet.role_maker as role_maker
from paddle.incubate.distributed.fleet.parameter_server.mode import DistributedMode
import paddle.distributed.fleet as fleet
from test_communicator_geo import TestCommunicatorGeoEnd2End
paddle.enable_static()
class RunServer(TestCommunicatorGeoEnd2End):
def runTest(self):
pass
os.environ["TRAINING_ROLE"] = "PSERVER"
half_run_server = RunServer()
half_run_server.run_ut()
"""
server_file
=
"run_server_for_communicator_geo.py"
with
open
(
server_file
,
"w"
)
as
wb
:
wb
.
write
(
run_server_cmd
)
port
=
find_free_ports
(
1
).
pop
()
port
=
find_free_ports
(
1
).
pop
()
os
.
environ
[
"TRAINING_ROLE"
]
=
"PSERVER"
os
.
environ
[
"TRAINING_ROLE"
]
=
"PSERVER"
os
.
environ
[
"PADDLE_PORT"
]
=
str
(
port
)
os
.
environ
[
"PADDLE_PORT"
]
=
str
(
port
)
os
.
environ
[
"PADDLE_PSERVERS_IP_PORT_LIST"
]
=
f
"127.0.0.1:
{
port
}
"
os
.
environ
[
"PADDLE_PSERVERS_IP_PORT_LIST"
]
=
f
"127.0.0.1:
{
port
}
"
os
.
environ
[
"PIPE_FILE"
]
=
pipe_name
_python
=
sys
.
executable
_python
=
sys
.
executable
server_file
=
"run_server_for_communicator_geo.py"
ps_cmd
=
f
"
{
_python
}
{
server_file
}
"
ps_cmd
=
f
"
{
_python
}
{
server_file
}
"
ps_proc
=
subprocess
.
Popen
(
ps_proc
=
subprocess
.
Popen
(
...
@@ -177,7 +148,8 @@ half_run_server.run_ut()
...
@@ -177,7 +148,8 @@ half_run_server.run_ut()
stderr
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
PIPE
,
)
)
time
.
sleep
(
5
)
with
open
(
pipe_name
,
'r'
)
as
pipe
:
start_command
=
pipe
.
read
()
os
.
environ
[
"TRAINING_ROLE"
]
=
"TRAINER"
os
.
environ
[
"TRAINING_ROLE"
]
=
"TRAINER"
...
@@ -186,9 +158,6 @@ half_run_server.run_ut()
...
@@ -186,9 +158,6 @@ half_run_server.run_ut()
ps_proc
.
wait
()
ps_proc
.
wait
()
outs
,
errs
=
ps_proc
.
communicate
()
outs
,
errs
=
ps_proc
.
communicate
()
if
os
.
path
.
exists
(
server_file
):
os
.
remove
(
server_file
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
test/ps/CMakeLists.txt
浏览文件 @
5e61b04c
...
@@ -11,7 +11,7 @@ endif()
...
@@ -11,7 +11,7 @@ endif()
foreach
(
TEST_OP
${
TEST_OPS
}
)
foreach
(
TEST_OP
${
TEST_OPS
}
)
py_test_modules
(
${
TEST_OP
}
MODULES
${
TEST_OP
}
)
py_test_modules
(
${
TEST_OP
}
MODULES
${
TEST_OP
}
)
list
(
APPEND TEST_OPS
${
TEST_OP
}
)
list
(
APPEND TEST_OPS
${
TEST_OP
}
)
set_tests_properties
(
${
TEST_OP
}
PROPERTIES TIMEOUT
5
0
)
set_tests_properties
(
${
TEST_OP
}
PROPERTIES TIMEOUT
12
0
)
endforeach
()
endforeach
()
if
(
WITH_HETERPS AND NOT WITH_PSLIB
)
if
(
WITH_HETERPS AND NOT WITH_PSLIB
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录