【OPEN IC】之emuMonitor:硬件仿真器palladium/zebu信息检索工具

原创
09/05 14:47
阅读数 929

最新工具手册请参照 https://github.com/bytedance/emuMonitor/blob/master/docs/emuMonitor_user_manual.pdf

 

一、简介

硬件仿真器(hardware emulator)是为了克服芯片设计中软件仿真和FPGA原型验证的不足,通过厂商指定的流程,将RTL映射到各自的硬件仿真平台上,从而在支持丰富debug功能的前提下实现了芯片的硬件化仿真。
当前比较主流的硬件仿真器有cadence的palladium和synopsys的zebu,实现方式有定制化cpu和FPGA两种方式,各自的使用流程上也有一些差异。
 
硬件仿真器价格昂贵,整套价格以千万计,一般只有较具经济实力的超大规模集成电路设计厂商才会购买。为了更好地使用,需要搜集和分析硬件仿真器的使用信息,并根据历史记录合理配置和分配,以提升其使用效率,降低经济成本,emuMonitor正是为满足这一目的而开发。
下面以palladium为例,emuMonitor中palladium的信息采集和信息展示流程如下图所示。
 
可以通过Cadence提供的工具“test_server”获取palladium的使用信息,其样式如下。
Emulator: BD02_emu Hardware: Palladium Z1 Configmgr:
V21.02.201.s005System Status: ONLINE
Rack 0 has 2 clusters
Cluster 0 has 6 logic drawers CCD: ONLINE
Logic drawer 0 has 8 domains Logic drawer: ONLINE
Domain Owner PID T-Pod Design ElapTime ReservedKey
0.0 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.1 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.2 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.3 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.4 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.5 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.6 <user> n212-207-138:215761 -- -- emu_top 00:44:06 --
0.7 <user> n212-207-138:215761 -- -- emu_top 00:44:06 -- ...
 
解析palladium使用信息,将其保存为python的字典,可以作为历史记录,同时可以根据每个Domain有无使用统计实时使用率信息。
最后将这些信息,在图形工具上结构化展示出来即可,用户可以方便查找。
 
 

二、环境依赖

2.1 操作系统依赖

emuMonitor的开发和测试操作系统为 CentOS Linux release 7.9.2009 (Core),这也是IC设计常用的操作系统版本之一。
centos6/centos7/centos8,及对应的redhat版本应该都可以运行,主要的潜在风险在于系统库版本差异可能会影响部分组件的运行。
建议在centos7.9操作系统下使用。
 

2.2 python版本依赖

emuMonitor基于python开发,其开发和测试的python版本为 python3.8.8,推荐使用 Anaconda3-2021.05以解决库依赖问题。
不同版本的python可能会有python库版本问题,按照系统要求安装对应版本的python库即可解决。
 

2.3 使用环境依赖

使用emuMonitor是,使用环境主要需要满足如下依赖:
  • For palladium:环境中已安装cadence的工具test_server,且执行test_server的机器允许用户ssh登录。
  • For zebu:环境中已安装synopsys的工具zRscManager,且可进行sysstat与sysreport查询。
 
 

三、工具安装及配置

3.1 工具下载

emuMonitor的github路径位于 https://github.com/bytedance/emuMonitor。
 
可以采用 “git clone https://github.com/bytedance/emuMonitor.git”的方式拉取源代码。
[liyanqing@personal_pc test]$ git clone https://github.com/bytedance/emuMonitor.git
Cloning into 'emuMonitor'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 38 (delta 2), reused 38 (delta 2), pack-reused 0
Unpacking objects: 100% (38/38), done.
 
也可以在emuMonitor的github界面上,Code -> Download ZIP的方式拉取代码包。
 

3.2 工具安装

工具安装之前,首先参照第二章“环境依赖”满足emuMonitor的环境依赖关系。
安装包下的文件和目录如下。
[liyanqing.1987@ic-admin2 tools]$ cd emuMonitor-master/
[liyanqing.1987@ic-admin2 emuMonitor-master]$ ls bin
common config db docs install.py lib LICENSE README requirements.txt test tools
 
确认python版本正确,并基于安装包中的requirements.txt安装python依赖库。(python库安装一般需要使用root账号)
[root@ic-admin2 emuMonitor-master]# pip3 install -r requirements.txt
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting matplotlib==3.3.4 (from -r requirements.txt (line 1))
Downloading https://bytedpypi.byted.org/packages/pypi/matplotlib/matplotlib-3.3.4-cp36-cp36m-manylinux1_x86_64.whl (11.5MB) 100% |████████████████████████████████| 11.5MB 69.3MB/s ...
Requirement already satisfied: six>=1.5 in /usr/lib/python3.6/site-packages (from python-dateutil>=2.1->matplotlib==3.3.4->-r requirements.txt (line 1))
Installing collected packages: kiwisolver, cycler, pyparsing, pillow, matplotlib, sip, PyQt5, ptyprocess, pexpect
Running setup.py install for pillow ... done
Successfully installed PyQt5-5.10.1 cycler-0.11.0 kiwisolver-1.3.1 matplotlib-3.3.4 pexpect-4.6.0 pillow-8.4.0 ptyprocess-0.7.0 pyparsing-3.1.1 sip-4.19.8
 
在安装目录下,使用命令“python3 install.py”安装emuMonitor。(公共软件安装一般需要使用root账号,当然,仅本人使用用私人账号安装亦可)
[root@ic-admin2 emuMonitor-master]# python3 install.py
>>> Check python version.
    Required python version : (3, 8)
    Current python version : (3, 8)
 
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/bin/pmonitor".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/bin/psample".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/bin/zmonitor".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/tools/patch".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/test/pmonitor_test".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/test/psample_test".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/test/zmonitor_test".
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/test/gen_test_db".
>>> Generate config file "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/config.py".
>>> Generate config file "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/test/test_config/test_config.py".
 
Done, Please enjoy it.
 

3.3 工具配置

安装目录下主要的配置文件为config/config.py,用于配置工具的一些基本设置和验证规则。
安装后默认配置如下,大多数都需要重新配置。
######## For Palladium ########
# Specify the database directory.
db_path = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/db"
 
# Specify test_server path for Palladium Z1.
Z1_test_server = ""
 
# Specify test_server path for Palladium Z2.
Z2_test_server = ""
 
# Specify test_server execute hosts for Palladium Z1, make sure you can ssh the host without password.
Z1_test_server_host = ""
 
# Specify test_server execute hosts for Palladium Z2, make sure you can ssh the host without password.
Z2_test_server_host = ""
 
# Specify project list file.
project_list_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_list"
 
# Specify project & execute_host relationship file.
project_execute_host_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_execute_host"
 
# Specify project & user relationship file.
project_user_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_user"
 
# Specify which are the primary factors when getting project information, it could be one or serveral items between "user/execute_host/submit_host".
project_primary_factors = "user execute_host"
 
 
######## For Zebu ########
# Specify zRscManager path for Zebu.
zRscManager = ""
 
# Specify zebu system directory.
ZEBU_SYSTEM_DIR = ""
 
# Specify check status command.
check_status_command = zRscManager + " -nc -sysstat " + ZEBU_SYSTEM_DIR + " -pid ; rm ZEBU_GLOBAL_SYSTEM_DIR_global_mngt.db"
 
# Specify check report command.
check_report_command = zRscManager + " -nc -sysreport " + ZEBU_SYSTEM_DIR + " -from FROMDATE -to TODATE -noheader -fields 'opendate, closedate, modulesList, user, pid, pc' -nofilter ; rm ZEBU_GLOBAL_SYSTEM_DIR_global_mngt.db"
 
db_path : 指定数据路径,默认在palladiumMonitor安装目录下的db目录。
Z1_test_server :为Palladium Z1指定工具test_server的路径,一般用vxe工具下的test_server。
Z2_test_server :为Palladium Z2指定工具test_server的路径,一般用wxe工具下的test_server。
Z1_test_server_host :指定在哪台机器上执行test_server命令,会ssh上去获取palladium Z1的使用信息。
Z2_test_server_host :指定在哪台机器上执行test_server命令,会ssh上去获取palladium Z2的使用信息。
project_list_file :指定project的配置文件路径,用于pmonitor COST页费用分摊。
project_submit_host_file :指定palladium submit_host跟project对应关系的配置文件路径,用于pmonitor COST页费用分摊。
project_user_file :指定palladium user跟project对应关系的配置文件路径,用于pmonitor COST页费用分摊。
project_primary_factors :palladium在不同project上的项目分摊,优先依赖那些因素分摊,默认顺序是“user execute_host submit_host”,也就是说,先按照palladium的user判断这个palladium是哪个project使用的,如果不能判断,再依次按照execute_host和submit_host来判断。
 
zRscManager:指定工具zRscManager的路径。
ZEBU_SYSTEM_DIR:指定zebu系统日志的路径
check_status_command:sysstat查询命令。
check_report_command:stsreport查询命令。
 
一个实用的demo配置如下。
######## For Palladium ########
# Specify the database directory.
db_path = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/db"
 
# Specify test_server path for Palladium Z1.
Z1_test_server = "/ic/software/cadence/vxe/22.04/bin/test_server"
 
# Specify test_server path for Palladium Z2.
Z2_test_server = "/ic/software/cadence/wxe/21.00.s007/bin/test_server"
 
# Specify test_server execute hosts for Palladium Z1, make sure you can ssh the host without password.
Z1_test_server_host = "10.212.207.136"
 
# Specify test_server execute hosts for Palladium Z2, make sure you can ssh the host without password.
Z2_test_server_host = "10.232.129.12"
 
# Specify project list file.
project_list_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_list"
 
# Specify project & execute_host relationship file.
project_execute_host_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_execute_host"
 
# Specify project & user relationship file.
project_user_file = "/ic/data/usr/liyanqing.1987/tools/emuMonitor-master/config/project_user"
 
# Specify which are the primary factors when getting project information, it could be one or serveral items between "user/execute_host/submit_host".
project_primary_factors = "user execute_host"
 
 
######## For Zebu ########
# Specify zRscManager path for Zebu.
zRscManager = "/ic/software/synopsys/zebu/Q-2020.03-SP1-4/bin/zRscManager"
 
# Specify zebu system directory.
ZEBU_SYSTEM_DIR = "/ic/data/usr/emu/common/ZEBU_SYSTEM_DIR"
 
# Specify check status command.
check_status_command = zRscManager + " -nc -sysstat " + ZEBU_SYSTEM_DIR + " -pid ; rm ZEBU_GLOBAL_SYSTEM_DIR_global_mngt.db"
 
# Specify check report command.
check_report_command = zRscManager + " -nc -sysreport " + ZEBU_SYSTEM_DIR + " -from FROMDATE -to TODATE -noheader -fields 'opendate, closedate, modulesList, user, pid, pc' -nofilter ; rm ZEBU_GLOBAL_SYSTEM_DIR_global_mngt.db"
 
 

四、工具使用

emuMonitor包含palladium和zebu两套监控系统。
palladium:包含psample, pmonitor两个程序,前者是数据采集程序,用于获取和存储palladium使用信息及使用率信息,后者用于展示palladium实时使用信息、历史使用信息、使用率信息和计费分摊信息。
zebu: 包含zmonitor程序, 用于展示zebu实时使用信息、历史使用信息和使用率信息。
 

4.1 psample:palladium信息采样程序

psample位于palladiumMonitor安装目录下的bin/psample,安装后可以直接引用。如果使用环境中配置了modules,则可以通过module load的方式引用psample。
 

4.1.1 帮助信息

psample的帮助信息如下所示。
[liyanqing.1987@n212-206-207 palladiumMonitor]$ bin/psample -h
usage: psample.py [-h] [-H {Z1,Z2}]
 
optional arguments:
    -h, --help show this help message and exit
    -H {Z1,Z2}, --hardware {Z1,Z2}
                Specify hardware, it could be "Z1" or "Z2", default is "Z1".
 
--hareware:指定硬件型号,只能从“Z1”和“Z2”中选择,默认为“Z1”。
 

4.1.2 采样范例

下面给与一个palladium Z1采样的一个范例。
首先,登录到可以执行test_server并获取palladium使用信息的机器,此处为10.212.207.136。
[liyanqing.1987@personal_pc palladiumMonitor]$ ssh 10.212.207.136
Last login: Thu Mar 16 14:50:38 2023 from n212-206-207
 
执行“psample -H Z1”来采样。
[liyanqing.1987@n212-207-136 palladiumMonitor]$ bin/psample -H Z1
>>> Sampling palladium usage information ...
    Sample Time : 20230316_145600
    Hardware : Palladium Z1
    Emulator : BD02_emu
    Status : ONLINE
    Utilization : 0.83
 
然后可以在config.db_path下找到utilization记录和采样数据。
[ic_admin@n212-207-136 db]$ tail -n 1 Z1/BD02_emu/utilization 20230316
145600 : 0.83
[ic_admin@n212-207-136 db]$ ls Z1/BD02_emu/2023/03/16/
... 100002 120001 140002 145600
 

4.2 pmonitor:palladium信息展示程序

4.2.1 工具载入

pmonitor位于palladiumMonitor安装目录下的bin/pmonitor,安装后可以直接引用。如果使用环境中配置了modules,则可以通过module load的方式引用pmonitor。
[liyanqing.1987@personal_pc palladiumMonitor]$ bin/pmonitor
 

4.2.2 CURRENT页

CURRENT页用于展示palladium实时的使用信息。
Hardware和Host设定后,点击Check按钮,可以展示palladium的实时使用信息。Hardware只有Z1和Z2可选,选定后,Host会根据config.py中的设置自动填充。
 
palladium实时使用信息如下所示。
 
Rack/Cluster/Logi_Drawer/Domain/Onwer/PID/T-Pod/Design则可以用来对展示的palladium使用信息做筛选。
 

4.2.3 HISTORY页

HISTORY页用于加载bsample采样的历史使用信息数据。
 
Hardware/Emulator/Year/Month/Day/Time是筛选的6个层级,6者有联动关系,前者指定后,后者会自动填充可选值。
 

4.2.4 UTILIZATION页

UTILIZATION页基于历史数据统计指定palladium设备的使用率信息。
所谓使用率信息,对于瞬时值而言,是指 已用domain数目/总domain数目;对于统计值而言,是累计瞬时使用率的平均值。
 
使用率摘取,需要指定Hardware/Emulator/Start_Date/End_Date几个维度。
Start_Date默认为一个月前,End_Date默认为今天,两者的调节范围均为 10年前 - 今天。
选定Hardware后,会自动填充可选的Emulator项,并出现使用率统计信息。
 
其中每天的使用率,是基于当天多次采样的使用率算出来的日均值。最上部的“Average Utilization”值,则是所选日期的所有采样使用率算出来的均值。
 

4.2.5 COST页面

COST页面根据用户定义的计费分摊信息, 包括项目信息, 项目与host对应关系信息, 项目与user对应关系信息等, 显示项目计费分摊的详细信息。
Start_Date默认为一个月前,End_Date默认为今天,两者的调节范围均为 10年前 - 今天。
 
表格中展示每个palladium emulator在统计时间段内的被采集到的次数,以及每个项目针对此emulator采样次数占总采样次数的比例。需要说明的是,有些emulator的使用信息无法根据用户的config/project_***配置文件获取project信息,这样的使用时长都被归到了“others”项目中,理论上这种时长都需要被分配至已知项目才合理,否则无法分摊。
计费分摊信息支持export当前的表格为一个excel文档:
 
Excel的内容和COST页面单元格内容一致。
 

4.3 zmonitor: zebu信息展示程序

4.3.1 工具载入

用户在命令行输入zmonitor就可以启动工具。
[liyanqing.1987@personal_pc ~]$>zmonitor
 

4.3.2 CURRENT页

CURRENT页显示当前zebu各module的使用情况和任务信息。
 
用户可以在界面上方的筛选栏进行条件筛选后,显示筛选后的信息, 也可以点击Refresh刷新实时状态信息。
 

4.3.3 HISTORY页

History页用于对历史使用记录进行查询。用户可以查询到在过去任何一个时间段zebu的使用情况。
支持用户通过指定过滤条件进行筛选,得到自己期望的信息。
 

4.3.4 UTILIZATION页

UTILIZATION页显示指定日期时间范围内的使用率信息,即在一天内zebu被使用的时间除以总时间。
默认会显示近一个月整个zebu服务器的使用率信息,计算方式为各个module使用率之和/module数量。
 
同时也支持用户选择指定的module及日期,点击Search button生成对应的使用率折线图。
 
 

五、技术支持

本工具为开源工具,由开源社区维护,可以提供如下类型的技术支持:
  • 部署和使用技术指导。
  • 接收bug反馈并修复。
  • 接收功能修改建议。(需审核和排期)
 
获取技术支持的方式包括:
  • 通过Contact邮箱联系开发者。
  • 加入官方技术支持群。
 
 

附录

附1. 变更历史

日期
版本
变更描述
2023.9.4
1.0
发布第一个正式release版本
 
 
 

 

展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部