Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
csdn_franckjun
Paddle
提交
5696f967
P
Paddle
项目概览
csdn_franckjun
/
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
5696f967
编写于
9月 01, 2022
作者:
R
Roc
提交者:
GitHub
9月 01, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Auto gen cmake (#45614)
上级
ded33b58
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
37 addition
and
6 deletion
+37
-6
.pre-commit-config.yaml
.pre-commit-config.yaml
+7
-0
python/paddle/fluid/tests/unittests/collective/CMakeLists.txt
...on/paddle/fluid/tests/unittests/collective/CMakeLists.txt
+1
-1
tools/gen_ut_cmakelists.hook
tools/gen_ut_cmakelists.hook
+4
-0
tools/gen_ut_cmakelists.py
tools/gen_ut_cmakelists.py
+25
-5
未找到文件。
.pre-commit-config.yaml
浏览文件 @
5696f967
...
...
@@ -64,6 +64,13 @@ repos:
(?x)^(
paddle/utils/.*
)$
-
repo
:
local
hooks
:
-
id
:
auto-generate-cmakelists
name
:
auto-generate-cmakelists
entry
:
bash ./tools/gen_ut_cmakelists.hook
language
:
system
files
:
testslist.csv$
-
repo
:
https://github.com/cheshirekow/cmake-format-precommit
rev
:
v0.6.13
hooks
:
...
...
python/paddle/fluid/tests/unittests/collective/CMakeLists.txt
浏览文件 @
5696f967
...
...
@@ -272,7 +272,7 @@ if((WITH_GPU
)
set_tests_properties
(
test_gen_nccl_id_op PROPERTIES RUN_SERIAL 1
)
endif
()
if
((
WITH_GPU
)
AND
(
LINUX
))
if
((
WITH_GPU
OR WITH_ROCM
)
AND
(
LINUX
))
py_test_modules
(
test_communication_stream_allreduce_api MODULES
test_communication_stream_allreduce_api ENVS
...
...
tools/gen_ut_cmakelists.hook
0 → 100644
浏览文件 @
5696f967
set -e
lists=`python tools/gen_ut_cmakelists.py -f $* |grep 'modified/new:'|cut -f 2 -d :`
git add $lists
tools/gen_ut_cmakelists.py
浏览文件 @
5696f967
...
...
@@ -342,14 +342,20 @@ class CMakeGenerator():
self
.
processed_dirs
=
set
()
self
.
port_manager
=
DistUTPortManager
(
ignore_dirs
)
self
.
current_dirs
=
_norm_dirs
(
current_dirs
)
self
.
modified_or_created_files
=
[]
def
prepare_dist_ut_port
(
self
):
for
c
in
self
.
_find_root_dirs
():
self
.
port_manager
.
parse_assigned_dist_ut_ports
(
c
,
depth
=
0
)
def
parse_csvs
(
self
):
'''
parse csv files, return the lists of craeted or modified files
'''
self
.
modified_or_created_files
=
[]
for
c
in
self
.
current_dirs
:
self
.
_gen_cmakelists
(
c
)
return
self
.
modified_or_created_files
def
_find_root_dirs
(
self
):
root_dirs
=
[]
...
...
@@ -449,7 +455,6 @@ class CMakeGenerator():
def
_gen_cmakelists
(
self
,
current_work_dir
,
depth
=
0
):
if
depth
==
0
:
self
.
processed_dirs
.
clear
()
print
(
"procfessing dir:"
,
current_work_dir
)
if
current_work_dir
==
""
:
current_work_dir
=
"."
...
...
@@ -490,9 +495,20 @@ class CMakeGenerator():
for
sub
in
sub_dirs
:
cmds
+=
f
"add_subdirectory(
{
sub
}
)
\n
"
print
(
cmds
,
end
=
""
)
with
open
(
f
"
{
current_work_dir
}
/CMakeLists.txt"
,
"w"
)
as
cmake_file
:
print
(
cmds
,
end
=
""
,
file
=
cmake_file
)
# check whether the generated file are thge same with the existing file, ignoring the blank chars
# if the are same, skip the weiting process
with
open
(
f
"
{
current_work_dir
}
/CMakeLists.txt"
,
"r"
)
as
old_cmake_file
:
char_seq
=
old_cmake_file
.
read
().
split
()
char_seq
=
""
.
join
(
char_seq
)
if
char_seq
!=
""
.
join
(
cmds
.
split
()):
assert
f
"
{
current_work_dir
}
/CMakeLists.txt"
not
in
self
.
modified_or_created_files
,
\
f
"the file
{
current_work_dir
}
/CMakeLists.txt are modified twice, which may cause some error"
self
.
modified_or_created_files
.
append
(
f
"
{
current_work_dir
}
/CMakeLists.txt"
)
with
open
(
f
"
{
current_work_dir
}
/CMakeLists.txt"
,
"w"
)
as
cmake_file
:
print
(
cmds
,
end
=
""
,
file
=
cmake_file
)
if
__name__
==
"__main__"
:
...
...
@@ -544,4 +560,8 @@ if __name__ == "__main__":
cmake_generator
=
CMakeGenerator
(
current_work_dirs
,
args
.
ignore_cmake_dirs
)
cmake_generator
.
prepare_dist_ut_port
()
cmake_generator
.
parse_csvs
()
created
=
cmake_generator
.
parse_csvs
()
# summary the modified files
for
f
in
created
:
print
(
"modified/new:"
,
f
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录