Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
fcd44b54
P
Paddle
项目概览
Crayon鑫
/
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看板
未验证
提交
fcd44b54
编写于
11月 26, 2021
作者:
Z
Zhanlue Yang
提交者:
GitHub
11月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added Eager Dygraph AutoCodeGen dependencies
#1
(#37574)
上级
e05540f7
变更
4
展开全部
显示空白变更内容
内联
并排
Showing
4 changed file
with
854 addition
and
0 deletion
+854
-0
paddle/fluid/eager/auto_code_generator/CMakeLists.txt
paddle/fluid/eager/auto_code_generator/CMakeLists.txt
+18
-0
paddle/fluid/eager/auto_code_generator/eager_generator.cc
paddle/fluid/eager/auto_code_generator/eager_generator.cc
+745
-0
paddle/fluid/eager/auto_code_generator/generate_file_structures.py
...uid/eager/auto_code_generator/generate_file_structures.py
+87
-0
paddle/fluid/eager/auto_code_generator/op_list.txt
paddle/fluid/eager/auto_code_generator/op_list.txt
+4
-0
未找到文件。
paddle/fluid/eager/auto_code_generator/CMakeLists.txt
0 → 100644
浏览文件 @
fcd44b54
set
(
EAGER_GENERETOR_DEPS
${
GLOB_OP_LIB
}
${
GLOB_OPERATOR_DEPS
}
pybind proto_desc executor layer tracer engine imperative_profiler imperative_flag
)
add_executable
(
eager_generator eager_generator.cc
)
target_link_libraries
(
eager_generator
${
EAGER_GENERETOR_DEPS
}
)
get_property
(
os_dependency_modules GLOBAL PROPERTY OS_DEPENDENCY_MODULES
)
target_link_libraries
(
eager_generator
${
os_dependency_modules
}
)
# Prepare file structure
message
(
"Generate dygraph file structure at path:
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/generated"
)
execute_process
(
COMMAND
"
${
PYTHON_EXECUTABLE
}
"
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/auto_code_generator/generate_file_structures.py"
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/"
)
add_custom_target
(
eager_codegen
COMMAND
"
${
CMAKE_CURRENT_BINARY_DIR
}
/eager_generator"
"
${
PADDLE_SOURCE_DIR
}
/paddle/fluid/eager/api/generated/fluid_generated"
DEPENDS eager_generator
VERBATIM
)
paddle/fluid/eager/auto_code_generator/eager_generator.cc
0 → 100644
浏览文件 @
fcd44b54
此差异已折叠。
点击以展开。
paddle/fluid/eager/auto_code_generator/generate_file_structures.py
0 → 100644
浏览文件 @
fcd44b54
# Copyright (c) 2021 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
sys
import
os
if
__name__
==
"__main__"
:
assert
len
(
sys
.
argv
)
==
2
eager_dir
=
sys
.
argv
[
1
]
op_list
=
[]
with
open
(
f
"
{
eager_dir
}
/auto_code_generator/op_list.txt"
,
"r"
)
as
f
:
for
line
in
f
:
line
=
str
(
line
.
strip
())
op_list
.
append
(
line
)
"""
paddle/fluid/eager
|- generated
| |- CMakeLists.txt
| | "add_subdirectory(forwards), add_subdirectory(nodes)"
|
| |- forwards
| |- op_name + "_dygraph.cc"
| |- CMakeLists.txt
| | "cc_library(dygraph_function SRCS op_name+"_dygraph.cc" DEPS ${eager_deps} ${fluid_deps} GLOB_OP_LIB)"
|
| |- nodes
| |- op_name + "_node.cc"
| |- op_name + "_node.h"
| |- CMakeLists.txt
| | "cc_library(dygraph_node SRCS op_name+"_node.cc" DEPS ${eager_deps} ${fluid_deps})"
|
| |- dygraph_forward_api.h
"""
# Directory Generation
generated_dir
=
os
.
path
.
join
(
eager_dir
,
"api/generated/fluid_generated"
)
forwards_dir
=
os
.
path
.
join
(
generated_dir
,
"forwards"
)
nodes_dir
=
os
.
path
.
join
(
generated_dir
,
"nodes"
)
dirs
=
[
generated_dir
,
forwards_dir
,
nodes_dir
]
for
directory
in
dirs
:
if
not
os
.
path
.
exists
(
directory
):
os
.
mkdir
(
directory
)
# Empty files
dygraph_forward_api_h_path
=
os
.
path
.
join
(
generated_dir
,
"dygraph_forward_api.h"
)
empty_files
=
[
dygraph_forward_api_h_path
]
for
op_name
in
op_list
:
empty_files
.
append
(
os
.
path
.
join
(
forwards_dir
,
op_name
+
"_dygraph.cc"
))
empty_files
.
append
(
os
.
path
.
join
(
nodes_dir
,
op_name
+
"_node.cc"
))
empty_files
.
append
(
os
.
path
.
join
(
nodes_dir
,
op_name
+
"_node.h"
))
for
path
in
empty_files
:
if
not
os
.
path
.
exists
(
path
):
open
(
path
,
'a'
).
close
()
# CMakeLists
nodes_level_cmakelist_path
=
os
.
path
.
join
(
nodes_dir
,
"CMakeLists.txt"
)
generated_level_cmakelist_path
=
os
.
path
.
join
(
generated_dir
,
"CMakeLists.txt"
)
forwards_level_cmakelist_path
=
os
.
path
.
join
(
forwards_dir
,
"CMakeLists.txt"
)
with
open
(
nodes_level_cmakelist_path
,
"w"
)
as
f
:
f
.
write
(
"cc_library(dygraph_node SRCS %s DEPS ${eager_deps} ${fluid_deps})
\n
"
%
" "
.
join
([
op_name
+
'_node.cc'
for
op_name
in
op_list
]))
f
.
write
(
"add_dependencies(dygraph_node eager_codegen)"
)
with
open
(
forwards_level_cmakelist_path
,
"w"
)
as
f
:
f
.
write
(
"cc_library(dygraph_function SRCS %s DEPS ${eager_deps} ${fluid_deps} ${GLOB_OP_LIB})
\n
"
%
" "
.
join
([
op_name
+
'_dygraph.cc'
for
op_name
in
op_list
]))
f
.
write
(
"add_dependencies(dygraph_function eager_codegen)"
)
with
open
(
generated_level_cmakelist_path
,
"w"
)
as
f
:
f
.
write
(
"add_subdirectory(forwards)
\n
add_subdirectory(nodes)"
)
paddle/fluid/eager/auto_code_generator/op_list.txt
0 → 100644
浏览文件 @
fcd44b54
sigmoid
matmul_v2
reduce_sum
elementwise_add
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录