From 5f39c666386eb0dbbaa4ef7be2e06497057dda9f Mon Sep 17 00:00:00 2001 From: jim19930609 Date: Wed, 17 Nov 2021 06:31:20 +0000 Subject: [PATCH] Changed AutoCodeGen to always overwrite previous contents during compilation --- .../autocodegen/generate_file_structures.py | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/paddle/fluid/eager/autocodegen/generate_file_structures.py b/paddle/fluid/eager/autocodegen/generate_file_structures.py index 9305693b7c5990..fca2edb8b96a40 100644 --- a/paddle/fluid/eager/autocodegen/generate_file_structures.py +++ b/paddle/fluid/eager/autocodegen/generate_file_structures.py @@ -71,20 +71,17 @@ "CMakeLists.txt") forwards_level_cmakelist_path = os.path.join(forwards_dir, "CMakeLists.txt") - if not os.path.exists(nodes_level_cmakelist_path): - 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(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)") - if not os.path.exists(forwards_level_cmakelist_path): - 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(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)") - if not os.path.exists(generated_level_cmakelist_path): - with open(generated_level_cmakelist_path, "w") as f: - f.write("add_subdirectory(forwards)\nadd_subdirectory(nodes)") + with open(generated_level_cmakelist_path, "w") as f: + f.write("add_subdirectory(forwards)\nadd_subdirectory(nodes)")