diff --git a/paddle/fluid/inference/CMakeLists.txt b/paddle/fluid/inference/CMakeLists.txt index de23d3e477ecf1810df19d6c1c54767003ce6775..b5e8450f35f788dcb14d3b3e132f33a275719869 100644 --- a/paddle/fluid/inference/CMakeLists.txt +++ b/paddle/fluid/inference/CMakeLists.txt @@ -109,6 +109,8 @@ set(SHARED_INFERENCE_SRCS ${PADDLE_CUSTOM_OP_SRCS}) # shared inference library deps +list(REMOVE_ITEM fluid_modules standalone_executor + interpretercore_garbage_collector) set(SHARED_INFERENCE_DEPS ${fluid_modules} phi analysis_predictor ${utils_modules}) diff --git a/paddle/fluid/platform/device/gpu/CMakeLists.txt b/paddle/fluid/platform/device/gpu/CMakeLists.txt index dd2a7d1eb88306d8ecf61c3f62464a0c7c5c1726..a6f6bc232e69420e6c6839a12e3ff1394032c10f 100644 --- a/paddle/fluid/platform/device/gpu/CMakeLists.txt +++ b/paddle/fluid/platform/device/gpu/CMakeLists.txt @@ -3,7 +3,13 @@ if(WITH_GPU) nv_library( gpu_info SRCS gpu_info.cc - DEPS phi_backends gflags glog enforce monitor dynload_cuda) + DEPS phi_backends + gflags + glog + enforce + monitor + dynload_cuda + malloc) nv_test(cuda_helper_test SRCS cuda_helper_test.cu) nv_test( diff --git a/tools/get_op_list.py b/tools/get_op_list.py index aa1fd4dbfb353ba221b8fba999e02108daea4fcc..8d71af4a6e7e76c9180308575dbc5b5798e3e5d5 100644 --- a/tools/get_op_list.py +++ b/tools/get_op_list.py @@ -30,15 +30,20 @@ def parse_args(): '--model_dir', type=str, default="", - help='Directory of the inference models.', + help='Directory of the inference models that named with pdmodel.', + ) + parser.add_argument( + '--op_list', + type=str, + default="", + help='List of ops like "conv2d;pool2d;relu".', ) return parser.parse_args() -def get_model_ops(model_file): +def get_model_ops(model_file, ops_set): model_bytes = paddle.static.load_from_file(model_file) pg = paddle.static.deserialize_program(model_bytes) - ops_set = set() for i in range(0, pg.desc.num_blocks()): block = pg.desc.block(i) @@ -47,12 +52,12 @@ def get_model_ops(model_file): for j in range(0, size): ops_set.add(block.op(j).type()) - return ops_set - def get_model_phi_kernels(ops_set): phi_set = set() for op in ops_set: + print(op) + print(_get_phi_kernel_name(op)) phi_set.add(_get_phi_kernel_name(op)) return phi_set @@ -60,10 +65,17 @@ def get_model_phi_kernels(ops_set): if __name__ == '__main__': args = parse_args() - for root, dirs, files in os.walk(args.model_dir, topdown=True): - for name in files: - if re.match(r'.*pdmodel', name): - ops_set = get_model_ops(os.path.join(root, name)) + ops_set = set() + if args.op_list != "": + op_list = args.op_list.split(";") + for op in op_list: + ops_set.add(op) + + if args.model_dir != "": + for root, dirs, files in os.walk(args.model_dir, topdown=True): + for name in files: + if re.match(r'.*pdmodel', name): + get_model_ops(os.path.join(root, name), ops_set) phi_set = get_model_phi_kernels(ops_set) ops = ";".join(ops_set) kernels = ";".join(phi_set)