Design Compiler:命令的后台执行与并行(redirect -bg命令与parallel_execute命令)

📅 2026/7/13 21:54:30
Design Compiler:命令的后台执行与并行(redirect -bg命令与parallel_execute命令)
相关阅读Design Compilerhttps://blog.csdn.net/weixin_45791458/category_12738116.html?spm1001.2014.3001.5482在Design Compiler使用多核技术多进程、多线程一文中我们了解了如何使用多核技术减少工具的运行时间。本文将讨论在利用多核技术的同时使用后台执行功能redirect -bg命令该选项由2018版本引入与并行执行功能parallel_execute命令该命令由2014版本引入进一步提高非综合命令的运行效率。后台执行命令使用redirect命令配合-bg选项可以将命令放在后台执行如下所示。dcnxt_shell set_host_options -max_cores 6 dcnxt_shell redirect -bg -file test.log -max_cores 1 {report_design} Information: redirect -bg with max_cores 1 started. The maximum number of cores available in parent is reduced to 5. (BGE-004) .... Information: The maximum number of cores available in parent is back to 2 cores. (BGE-005)下面是后台执行命令的注意事项。1、使用-bg选项必须同时使用-max_cores选项指定执行该后台进程使用的最大CPU核心数指定范围是1到16的整数值在使用redirect -bg命令前必须使用set_host_options命令指定主进程的最大核心数至少为2否则会出现BGE-007错误后台进程的最大核心数会从主进程的最大核心数中扣减至少需保证主进程有1个核心否则会出现BGE-006警告并自动限制后台进程的最大核心数-bg选项和max_cores选项不能与除-file选项外的其他选项一起使用。2、最多同时存在两个后台进程如超过则会造成前台阻塞等待如下所示。dcnxt_shell redirect -bg -file test.log {after 200000} -max_cores 1 Information: redirect -bg with max_cores 1 started. The maximum number of cores available in parent is reduced to 5. (BGE-004) 39795 dcnxt_shell redirect -bg -file test.log {after 200000} -max_cores 1 redirect -bg -file {test.log} after 200000 -max_cores 1 is running Information: redirect -bg with max_cores 1 started. The maximum number of cores available in parent is reduced to 4. (BGE-004) 39799 dcnxt_shell redirect -bg -file test.log {after 200000} -max_cores 1 redirect -bg -file {test.log} after 200000 -max_cores 1 is running redirect -bg -file {test.log} after 200000 -max_cores 1 is running Waiting for the above jobs to complete ....3、只有一部分命令支持在后台执行主要包括查询类(get_*)、报告类(report_*)、输出类(write_*)命令使用list_commands -bg命令即可查看所有支持的命令如下所示。dcnxt_shell list_commands -bg Note: ro - read_only mro - read_only for mapped netlist ---------------------------------------- all_active_scenarios all_clocks mro all_connected all_designs ro all_fanin all_fanout all_high_fanout ro all_inputs ro all_level_shifters ro all_macro_cells all_outputs ro all_registers mro all_scenarios capture_app_var change_names check_bindings check_block_abstraction check_bsd check_design check_error *****如果使用了不支持的命令则会出现以下错误。Error: unknown command *** (CMD-005)它们又分为只读类命令和非只读类命令如果后台执行的非只读命令修改了网表或其他数据这些修改通常不会反映回正在运行的前台同时还可能会因为触发写时复制(Copy-on-WriteCOW)导致子进程内存急剧膨胀。使用enable_redirect_bg_commands命令配合-all/-read_only选项可以指定是否允许在后台运行只读类和非只读类命令默认为全部允许如违反规则会出现BGE-011信息。4、如果后台进程尚未完成quit和exit命令会造成前台阻塞等待如下所示。dcnxt_shell redirect -bg -file test.log {after 200000} -max_cores 1 Information: redirect -bg with max_cores 1 started. The maximum number of cores available in parent is reduced to 5. (BGE-004) dcnxt_shell quit redirect -bg -file {test.log} after 200000 -max_cores 1 is running Waiting for the above jobs to complete ....5、-bg选项是不支持递归的即如果使用了redirect -bg命令则后台执行的命令不能是另一个redirect -bg命令否则会出现以下错误。Error: Command redirect -bg is not supported during redirect -bg. (BGE-001)报告后台进程使用report_background_jobs命令可以查看所有已提交到后台运行的进程包括已完成的进程和正在运行的进程若只想显示运行中的进程可以添加-reset选项来省略已完成的进程如下所示。dcnxt_shell report_background_jobs JOB redirect -bg -file {test.log} after 2000 -max_cores 1 completed JOB(pid:14051) redirect -bg -file {test.log} after 200000 -max_cores 1 is running dcnxt_shell report_background_jobs -reset JOB(pid:14051) redirect -bg -file {test.log} after 200000 -max_cores 1 is running并行执行命令使用parallel_execute命令可以将多条命令并行执行如下所示。dcnxt_shell parallel_execute report_cell report_timing report_area Information: Running parallel report using a maximum of * cores. (RPT-100)下面是并行执行命令的注意事项。1、在使用parallel_execute命令前可以使用set_host_options命令指定最大核心数但并行执行命令最多可以使用8个核心如果指定的最大核心数大于8工具会发出以下警告并自动将最大核心数限制为实际可用的核心数只针对该命令调整。Warning: you specified 10 cores to use but parallel_execute can use only up to 8 cores. parallel_execute will override and use only 8 cores. (RPT-110)2、可以将后台执行和并行执行结合即在后台并行执行命令如下所示。dcnxt_shell redirect -bg -file test.log {parallel_execute report_cell report_timing report_area} -max_cores 13、只有一部分命令支持并行执行主要包括检查类(check_*)、报告类(report_*)命令使用parallel_execute -list_all命令即可查看所有支持的命令如下所示。dcnxt_shell parallel_execute -list_all ---------------------------------------- check_bindings check_block_abstraction check_bsd check_design check_error check_implementations check_library check_license check_mv_design check_scan_def check_synlib check_target_library_subset *****如果使用了不支持的命令则会出现以下错误。Warning: Command *** not supported within parallel_execute mode. (RPT-106)4、parallel_execute命令会造成前台阻塞等待直到列表中最长时间运行的命令完成建议在并行执行前执行update_timing命令更新时序信息否则工具会自动调用。5、parallel_execute命令可以在每条命令中通过或将输出写入不同文件也可以使用-out选项指定生成的输出文件。实际使用中通常建议每条报告命令写入不同文件。例如dcnxt_shell parallel_execute [list report_timing timing.log report_qor qor.log report_area area.log]如果多条并行执行的命令同时写入同一个文件可能出现输出交错、覆盖或顺序不可预测的问题。即使使用追加由于命令同时运行输出的先后顺序也不一定与列表中的顺序一致。