Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
438ca7f6
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
438ca7f6
编写于
7月 21, 2022
作者:
Z
zhaoyingli
提交者:
GitHub
7月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[AutoParallel] fix unittest with paddle.distributed.launch (#44439)
* fix unittest * fix log_dir * _enable_legacy_dygraph
上级
98e96853
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
21 addition
and
18 deletion
+21
-18
python/paddle/distributed/auto_parallel/process_group.py
python/paddle/distributed/auto_parallel/process_group.py
+4
-1
python/paddle/fluid/tests/unittests/auto_parallel/test_auto_parallel_relaunch.py
...ts/unittests/auto_parallel/test_auto_parallel_relaunch.py
+1
-1
python/paddle/fluid/tests/unittests/auto_parallel/test_converter.py
...dle/fluid/tests/unittests/auto_parallel/test_converter.py
+5
-5
python/paddle/fluid/tests/unittests/auto_parallel/test_engine_api.py
...le/fluid/tests/unittests/auto_parallel/test_engine_api.py
+2
-2
python/paddle/fluid/tests/unittests/auto_parallel/test_engine_api_dp.py
...fluid/tests/unittests/auto_parallel/test_engine_api_dp.py
+2
-2
python/paddle/fluid/tests/unittests/auto_parallel/test_high_order_grad.py
...uid/tests/unittests/auto_parallel/test_high_order_grad.py
+5
-5
python/paddle/fluid/tests/unittests/auto_parallel/test_relaunch_with_gpt_planner.py
...unittests/auto_parallel/test_relaunch_with_gpt_planner.py
+1
-1
python/paddle/fluid/tests/unittests/auto_parallel/test_relaunch_with_planner.py
...sts/unittests/auto_parallel/test_relaunch_with_planner.py
+1
-1
未找到文件。
python/paddle/distributed/auto_parallel/process_group.py
浏览文件 @
438ca7f6
...
@@ -16,10 +16,12 @@ from collections import OrderedDict
...
@@ -16,10 +16,12 @@ from collections import OrderedDict
import
paddle
import
paddle
import
paddle.fluid.core
as
core
import
paddle.fluid.core
as
core
from
..collective
import
_get_global_env
from
..collective
import
_get_global_env
from
..collective
import
_new_ring_id
from
..collective
import
_new_ring_id
from
...fluid.framework
import
_non_static_mode
from
...fluid.framework
import
_non_static_mode
from
...fluid.layers.tensor
import
fill_constant
from
...fluid.layers.tensor
import
fill_constant
from
paddle.fluid.framework
import
_enable_legacy_dygraph
def
get_all_process_groups
():
def
get_all_process_groups
():
...
@@ -134,7 +136,8 @@ class ProcessGroup:
...
@@ -134,7 +136,8 @@ class ProcessGroup:
# TODO(shenliang03): This is a temporary solution to solve the problem of
# TODO(shenliang03): This is a temporary solution to solve the problem of
# hang caused by cross-creation of new_group
# hang caused by cross-creation of new_group
paddle
.
framework
.
_in_legacy_dygraph
()
paddle
.
disable_static
()
_enable_legacy_dygraph
()
paddle
.
set_device
(
'gpu:%d'
%
paddle
.
set_device
(
'gpu:%d'
%
paddle
.
distributed
.
ParallelEnv
().
dev_id
)
paddle
.
distributed
.
ParallelEnv
().
dev_id
)
tmp
=
paddle
.
to_tensor
(
tmp
=
paddle
.
to_tensor
(
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_auto_parallel_relaunch.py
浏览文件 @
438ca7f6
...
@@ -126,7 +126,7 @@ class TestAutoParallelReLaunch(unittest.TestCase):
...
@@ -126,7 +126,7 @@ class TestAutoParallelReLaunch(unittest.TestCase):
coverage_args
=
[]
coverage_args
=
[]
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"-m"
,
"
paddle.distributed.
launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
launch_model_path
launch_model_path
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_converter.py
浏览文件 @
438ca7f6
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
tempfile
import
unittest
import
unittest
import
os
import
os
import
sys
import
sys
...
@@ -32,18 +33,17 @@ class TestConverter(unittest.TestCase):
...
@@ -32,18 +33,17 @@ class TestConverter(unittest.TestCase):
else
:
else
:
coverage_args
=
[]
coverage_args
=
[]
tmp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"launch"
,
"--gpus"
,
"0,1"
,
launch_model_path
"-m"
,
"paddle.distributed.launch"
,
"--devices"
,
"0,1"
,
"--log_dir"
,
tmp_dir
.
name
,
launch_model_path
]
]
process
=
subprocess
.
Popen
(
cmd
)
process
=
subprocess
.
Popen
(
cmd
)
process
.
wait
()
process
.
wait
()
self
.
assertEqual
(
process
.
returncode
,
0
)
self
.
assertEqual
(
process
.
returncode
,
0
)
# Remove unnecessary files
tmp_dir
.
cleanup
()
log_path
=
os
.
path
.
join
(
file_dir
,
"log"
)
if
os
.
path
.
exists
(
log_path
):
shutil
.
rmtree
(
log_path
)
def
test_input_invalid
(
self
):
def
test_input_invalid
(
self
):
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_engine_api.py
浏览文件 @
438ca7f6
...
@@ -34,8 +34,8 @@ class TestEngineAPI(unittest.TestCase):
...
@@ -34,8 +34,8 @@ class TestEngineAPI(unittest.TestCase):
tmp_dir
=
tempfile
.
TemporaryDirectory
()
tmp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"
launch"
,
"--gpus"
,
"0,1"
,
"--log_dir"
,
tmp_dir
.
name
,
"-m"
,
"
paddle.distributed.launch"
,
"--devices"
,
"0,1"
,
"--log_dir"
,
launch_model_path
tmp_dir
.
name
,
launch_model_path
]
]
process
=
subprocess
.
Popen
(
cmd
)
process
=
subprocess
.
Popen
(
cmd
)
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_engine_api_dp.py
浏览文件 @
438ca7f6
...
@@ -34,8 +34,8 @@ class TestEngineAPI(unittest.TestCase):
...
@@ -34,8 +34,8 @@ class TestEngineAPI(unittest.TestCase):
tmp_dir
=
tempfile
.
TemporaryDirectory
()
tmp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"
launch"
,
"--gpus"
,
"0,1"
,
"--log_dir"
,
tmp_dir
.
name
,
"-m"
,
"
paddle.distributed.launch"
,
"--devices"
,
"0,1"
,
"--log_dir"
,
launch_model_path
tmp_dir
.
name
,
launch_model_path
]
]
process
=
subprocess
.
Popen
(
cmd
)
process
=
subprocess
.
Popen
(
cmd
)
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_high_order_grad.py
浏览文件 @
438ca7f6
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
import
tempfile
import
unittest
import
unittest
import
os
import
os
import
sys
import
sys
...
@@ -31,18 +32,17 @@ class TestHighOrderGrad(unittest.TestCase):
...
@@ -31,18 +32,17 @@ class TestHighOrderGrad(unittest.TestCase):
else
:
else
:
coverage_args
=
[]
coverage_args
=
[]
tmp_dir
=
tempfile
.
TemporaryDirectory
()
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"launch"
,
"--gpus"
,
"0,1"
,
launch_model_path
"-m"
,
"paddle.distributed.launch"
,
"--devices"
,
"0,1"
,
"--log_dir"
,
tmp_dir
.
name
,
launch_model_path
]
]
process
=
subprocess
.
Popen
(
cmd
)
process
=
subprocess
.
Popen
(
cmd
)
process
.
wait
()
process
.
wait
()
self
.
assertEqual
(
process
.
returncode
,
0
)
self
.
assertEqual
(
process
.
returncode
,
0
)
# Remove unnecessary files
tmp_dir
.
cleanup
()
log_path
=
os
.
path
.
join
(
file_dir
,
"log"
)
if
os
.
path
.
exists
(
log_path
):
shutil
.
rmtree
(
log_path
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_relaunch_with_gpt_planner.py
浏览文件 @
438ca7f6
...
@@ -56,7 +56,7 @@ class TestPlannerReLaunch(unittest.TestCase):
...
@@ -56,7 +56,7 @@ class TestPlannerReLaunch(unittest.TestCase):
coverage_args
=
[]
coverage_args
=
[]
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"-m"
,
"
paddle.distributed.
launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
launch_model_path
launch_model_path
...
...
python/paddle/fluid/tests/unittests/auto_parallel/test_relaunch_with_planner.py
浏览文件 @
438ca7f6
...
@@ -56,7 +56,7 @@ class TestPlannerReLaunch(unittest.TestCase):
...
@@ -56,7 +56,7 @@ class TestPlannerReLaunch(unittest.TestCase):
coverage_args
=
[]
coverage_args
=
[]
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
cmd
=
[
sys
.
executable
,
"-u"
]
+
coverage_args
+
[
"-m"
,
"launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"-m"
,
"
paddle.distributed.
launch"
,
"--log_dir"
,
self
.
temp_dir
.
name
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
"--cluster_topo_path"
,
cluster_json_path
,
"--rank_mapping_path"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
mapping_json_path
,
"--enable_auto_mapping"
,
"True"
,
launch_model_path
launch_model_path
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录