luoshuiqingfeng的个人空间 https://blog.eetop.cn/640161 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

【OPEN IC】之licenseMonitor:EDA license信息检索工具

已有 1033 次阅读| 2023-2-26 11:37 |个人分类:开源工具|系统分类:芯片设计| EDA, license

一、简介

EDA,electronic design automation,即电子设计自动化,是指利用计算机辅助设计软件,来完成超大规模集成电路芯片的功能设计、综合、验证、物理设计等流程的设计方式。EDA 位于集成电路产业的最上游,其成本在集成电路设计总成本中占有较高的比重,全流程的 EDA 工具价格常常达到千万甚至过亿的水平,出于高效利用和节省成本的考虑,需要实时了解 EDA 工具的 license 使用情况。
licenseMonitor 工具是一款 ByteDance 开源的 EDA license 信息实时检索系统,对 IC 设计降本增效具有重要的意义。
 

1.1 主要用途

IC 工程师是 EDA license 的主要用户,其主要的 EDA license 信息获取需求有如下几种:
  1. 某个 license feature 是否存在。
  2. 某个 license feature 总数量是多少。
  3. 某个 license feature 当前被哪些人用了。
  4. 某个 license feature 的过期日期是哪天。
 
对 IC 环境管理员而言,还有一些额外的 EDA license 实时信息需求。
  1. EDA license server 及 vendor daemon 的状态。(故障警示)
  2. 全量 license feature 的数量信息。(总量,使用量)
  3. 全量 license feature 的过期信息。(未过期,即将过期,已经过期)
  4. 全量 license feature 的使用信息。(谁,什么时间开始,使用了几个)
 
licenseMonitor 就用于这些 EDA license 实时信息的获取。
后续,会根据需求增加 EDA license 历史数据保存及分析功能。
 

1.2 工作原理

licenseMonitor 的工作流程如下图所示。
 
绝大多数 EDA vendor 都是使用 FlexNet 的 lmgrd 来管理 EDA license server,所以可以通过 FlexNet 的工具 lmstat 获取 EDA license 信息,样式如下。
License server status: PORT@HOSTNAME     License file(s) on HOSTNAME: LICENSE_FILE: HOSTNAME: license server UP (MASTER) v11.16.4 Vendor daemon status (on HOSTNAME):     VENDOR_DAEMON: UP v11.16.4 Feature usage info: Users of FEATURE1: (Total of 1 license issued; Total of 0 licenses in use) Users of FEATURE2: (Total of 8 licenses issued; Total of 5 licenses in use)   "FEATURE2" v2021.06, vendor: VENDOR_DAEMON, expiry: 28-sep-2022   vendor_string: UHD:PERM   floating license     USER1 EXECUTE_HOST /dev/pts/1 14165.SUBMIT_HOST (v2018.06) (HOSTNAME/PORT 482), start Sat 6/18 11:35, 4 licenses     USER2 EXECUTE_HOST /dev/pts/2 52926.SUBMIT_HOST (v2018.06) (HOSTNAME/PORT 2845), start Mon 6/20 15:31 
    ... Feature Version #licenses Vendor Expires _______ _________ _________ ______ ________ FEATURE1 1.0 1 VENDOR_DAEMON 28-Sep-2022 FEATURE2 2021.06 2 VENDOR_DAEMON 28-sep-2022 ... ----------------------------------------------------------------------------
 
解析 license 信息,将其保存为 python 的字典,数据结构如下。
license_dic = { 
               'license_files': '', 
               'license_server_status': 'UNKNOWN', 
               'license_server_version': '', 
               'vendor_daemon': { vendor_daemon: { 
                                                  'vendor_daemon_status': 'UP', 
                                                  'vendor_daemon_version': '', 
                                                  'feature': {feature: { 
                                                                        'issued': 0, 
                                                                        'in_use': 0, 
                                                                        'in_use_info_string': [], 
                                                                        'in_use_info': [], 
                                                                       }, 
                                                             }, 
                                                 'expires': {feature: { 
                                                                       'version': '', 
                                                                       'license': '', 
                                                                       'vendor': '', 
                                                                       'expires': '', 
                                                                      }, 
                                                            }, 
                                                 }, 
                                 }, 
               }
 
最后将这些信息,在图形工具上结构化展示出来即可,用户可以方便查找。
 
 

二、环境依赖

2.1 操作系统依赖

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

2.2 python 版本依赖

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

2.3 使用环境依赖

使用 licenseMonitor 是,使用环境需要满足如下依赖:
  • 可以访问 license server,及当前机器跟 license server 之间的网络是通的。
  • 环境中配置有正确的 LM_LICENSE_FILE 设置,lmstat 依赖 LM_LICENSE_FILE 的设置获取 license 信息。
 
 

三、工具安装及配置

3.1 工具下载

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

3.2 工具安装

工具安装之前,首先参照第二章 “环境依赖” 满足 licenseMonitor 的环境依赖关系。
安装包下的文件和目录如下。
[liyanqing.1987@n212-206-194 tools]$ cd licenseMonitor/ 
[liyanqing.1987@n212-206-194 licenseMonitor]$ ls 
bin common config data docs install.py LICENSE Notice.txt patch README requirements.txt tools
 
确认 python 版本正确,并基于安装包中的 requirements.txt 安装 python 依赖库。
[root@ic-admin1 licenseMonitor]# pip3 install -r requirements.txt Looking in indexes: https://bytedpypi.byted.org/simple/ Requirement already satisfied: pexpect==4.8.0 in /ic/software/tools/python3/3.8.8/lib/python3.8/site-packages (from -r requirements.txt (line 1)) (4.8.0) 
Requirement already satisfied: ptyprocess>=0.5 in /ic/software/tools/python3/3.8.8/lib/python3.8/site-packages (from pexpect==4.8.0->-r requirements.txt (line 1)) (0.7.0)
 
在安装目录下,使用命令 “python3 install.py” 安装 licenseMonitor。
[root@ic-admin1 licenseMonitor]# python3 install.py >>> Check python version. 
    Required python version : (3, 8) 
    Current python version : (3, 8) 

>>> Generate script "/ic/data/usr/liyanqing.1987/tools/licenseMonitor/bin/license_monitor". 
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/licenseMonitor/tools/config_product_feature_relationship". 
>>> Generate script "/ic/data/usr/liyanqing.1987/tools/licenseMonitor/tools/get_product_feature_relationship". 
>>> Generate config file "/ic/data/usr/liyanqing.1987/tools/licenseMonitor/conf/config.py". 

Done, Please enjoy it.
 

3.3 工具配置

安装目录下主要的配置文件为 config/config.py,用于配置工具的一些基本设置和验证规则。
安装后默认配置如下,大多数都需要重新配置。
# Specify EDA license administrators. (only administrator can execute license_monitor) administrators = "" # Set configured LM_LICENSE_FILE for administrators. If False, will get LM_LICENSE_FILE from current terminal. show_configured_for_admin = True # Specify lmstat path, just like "***/bin". lmstat_path = "" # Specify lmstat bsub command, just like "bsub -q normal -Is". lmstat_bsub_command = "" # Specify LM_LICENSE_FILE setting. LM_LICENSE_FILE = "" # Specify EDA license product-feature relationship file, you can get the file with "tools/get_product_feature_relationship.py". product_feature_relationship_file = "" # The time interval to fresh license information automatically, unit is "second", default is 300 seconds. fresh_interval = 300
 
administrators : 指定管理员,管理员才可以在 licenseMonitor 中直接读取配置的全部 LM_LICENSE_FILE 设置,其他人则只能从当前环境中读取 LM_LICENSE_FILE 配置。
show_configred_for_admin :同上一个设置相关,如果是 “True”,则 administrators 可以读取配置的全部 LM_LICENSE_FILE 设置,否则只能从当前环境中读取 LM_LICENSE_FILE 配置,默认设置为 “True”。
db_path :预留项,指定数据库(如果有)位置,没有可以不填。
lmstat_path :必填项,指定 lmstat 工具的路径,截止到 bin 路径为止。
lmstat_bsub_command :IC 环境中 login server 一般会禁掉 EDA license port,所以不能执行 lmstat 命令,所以需要 bsub 到 computing server 上执行,此处是指定 bsub 时候的命令。
LM_LICENSE_FILE :指定 license server 的相关信息,因为是给 EDA license 管理员查看,所以此处最好填上公司全部的 license server 信息。
product_feature_releationship_file :licenseMonitor 本身支持根据 EDA license 的 product 和 feature 的映射管理来做 feature 检索,前提是存在 yaml 格式的映射文件,此处就是用来指定这个映射文件的位置,如果没有可以不填。
fresh_interval :licenseMonitor 默认筛选信息的时候会重新获取 EDA license 状态,fresh_interval 是控制上次获取 EDA license 状态后,多长时间内筛选信息不需要重新获取,默认值为 300s,即 5 分钟。不要设置的太过频繁,以防止频繁连接 license server 导致程序卡顿。
 
一个实用的 demo 配置如下。
# Specify EDA license administrators. (only administrator can execute license_monitor) administrators = "luchengxin jiangziyi.1108 liyanqing.1987" # Set configured LM_LICENSE_FILE for administrators. If False, will get LM_LICENSE_FILE from current terminal. show_configured_for_admin = True # Specify the database directory. db_path = "/ic/software/cad_data/it/licenseMonitor/db" # Specify lmstat path. lmstat_path = "/ic/software/synopsys/scl/2021.03/linux64/bin" # Specify lmstat bsub command. lmstat_bsub_command = "bsub -q normal -Is" # Specify LM_LICENSE_FILE setting. LM_LICENSE_FILE = "\ 1055@ic-lic02:\ ... 27020@ic-lic03" # Specify EDA license product-feature relationship file. product_feature_relationship_file = "/ic/software/cad_tools/it/lsfMonitor/config/product_feature_relationship.yaml" # The time interval to fresh license information automatically, unit is "second", default is 300 seconds. fresh_interval = 300
 
 

四、工具使用

4.1 工具载入

licenseMonitor 的主程序是 license_monitor,位于 licenseMonitor 安装目录下的 bin/license_monitor,安装后可以直接引用。如果使用环境中配置了 modules,则可以通过 module load 的方式引用 license_monitor。
[liyanqing.1987@n212-206-194 licenseMonitor]$ bin/license_monitor * 
[2023-01-06 19:08:45] Loading License information, please wait a moment ...
 

4.2 帮助信息

license_monitor 的帮助信息如下。
[liyanqing.1987@n212-206-194 licenseMonitor]$ bin/license_monitor -h 
usage: license_monitor.py [-h] [-f FEATURE] [-u USER] [-t {SERVER,FEATURE,EXPIRES,USAGE}] 

optional arguments: 
  -h, --help show this help message and exit 
  -f FEATURE, --feature FEATURE 
        Specify license feature which you want to see on "LICENSE/EXPIRES/USAGE" tab. 
  -u USER, --user USER Specify the user on "USAGE" tab. 
  -t {SERVER,FEATURE,EXPIRES,USAGE}, --tab {SERVER,FEATURE,EXPIRES,USAGE} 
        Specify current tab, default is "FEATURE" tab.
 
--help : 打印帮助信息。
--feature : 指定 LICENSE/EXPIRES/USAGE 界面中要检索的 faeture,也可以在图形界面中指定。
--user : 指定 USAGE 界面中要检索的 user,也可以在图形界面中指定。
--tab : 指定打开时的 tab 页,默认是 LICENSE 页。
 

4.3 功能介绍

4.3.1 查看 license server 及 vendor daemon 状态

打开 license_monitor 图形界面后,可以在 SERVER 页查看相关信息。
 
如果 Server_Status 标红,说明这个 server 状态异常。
如果 Vendor_Status 标红,说明这个 vendor daemon 异常。
 

4.3.2 查看 feature 使用情况

打开 license_monitor 图形界面后,可以在 FEATURE 页查看相关信息。
 
可以按照 “ Show” 来筛选,有 “ ALL” 和 “ IN_USE” 两个选项,前者会显示所有的 license feature,后者仅显示在用的 license feature。
可以按照 “ Server” 来筛选。
可以按照 “ Vendor” 来筛选。
可以按照 “ Feature” 来筛选,此处的 Feature 支持模糊检索。比如输入 “Verdi”,可以精确地检索到 “Verdi” 这个 license,如果输入 “verdi”,除了 “Verdi” 外,还可以检索到所有和 verdi 相似的 license。
如果 “In_Use_License” 的数目大于 0,点击对应的数值,可以调到 USAGE 页查看这个 license feature 的 usage 细节,比如 “elec_solve_level1” 对应的 1。
 

4.3.3 查看 expires 过期日期

打开 license_monitor 图形界面后,可以在 EXPIRES 页查看相关信息。
 
筛选功能同 FEATURE 页相同。
另外,Expires 项会按照不同的颜色来显示 feature 不同的 expires 状态:
  • 黑色:未过期。
  • 红色:两周内过期。
  • 灰色:已过期。
 

4.3.4 查看 usage 使用细节

打开 license_monitor 图形界面后,可以在 USAGE 页查看相关信息。
 
筛选功能同 FEATURE 页类似,不过除了按照 server/vendor/feature 筛选外,还可以按照 submit_host/execute_host/user 筛选。
如果某个 feature 的 Start_Time 早于 3 天前,此处会显示为红色,警示使用过久的 license。
 

4.3.5 启动时直接指定 feature/user/tab

比如我希望在 license_monitor 启动的时候直接查看 liulimin 对 vcs 相关的 feature 的使用情况,可以通过如下命令行指定。
[liyanqing.1987@n212-206-194 licenseMonitor]$ bin/license_monitor -f vcs -u *** -t USAGE * 
[2023-01-28 16:44:26] Loading License information, please wait a moment ...
 

4.3.6 信息刷新

菜单栏 Setup 下有 “Fresh” 和 “Period Fresh” 两项,分别用于一次性刷新和周期性刷新。
 
 

五、辅助工具

出于功能扩展的需求,licenseMonitor 自带一些辅助工具。
 

5.1 config_product_feature_relationship

用于解析指定 EDA vendor 的 liense file,自动获取 product 和 feature 的映射关系。
[liyanqing.1987@n212-206-194 tools]$ ./config_product_feature_relationship -h 
usage: config_product_feature_relationship.py [-h] [-v {arm,cadence,empyrean,keysight,magillem,mentor,NOC,synopsys,TSRAM,xilinx}] [-l LICENSE_FILE] [-o OUTPUT_FILE] 

optional arguments: 
  -h, --help show this help message and exit   -v {arm,cadence,empyrean,keysight,magillem,mentor,NOC,synopsys,TSRAM,xilinx}, --vendor {arm,cadence,empyrean,keysight,magillem,mentor,NOC,synopsys,TSRAM,xilinx}         Specify vendor. 
  -l LICENSE_FILE, --license_file LICENSE_FILE         Specify license file. 
  -o OUTPUT_FILE, --output_file OUTPUT_FILE         Specify output file.
 
--VENDOR :指定 vendor。
--LICENSE_FILE :指定 vendor 对应的 license file。
--OUTPUT_FILE :指定输出文件路径。
 

5.2 get_product_feature_relationship

用于解析指定 EDA vendor 的 liense file 获取 license feature 信息,然后手工配置指定 vendor 的 EDA license product 和 feature 的映射关系,一般是用于 license file 中没有明确 product 信息的情况。
[liyanqing.1987@n212-206-194 tools]$ ./get_product_feature_relationship -h 
usage: get_product_feature_relationship.py [-h] [-v VENDORS [VENDORS ...]] -l LICENSE_FILES [LICENSE_FILES ...] [-o OUTPUT_FILE] 

optional arguments: 
  -h, --help show this help message and exit   -v VENDORS [VENDORS ...], --vendors VENDORS [VENDORS ...]         Required argument, specify vendor list, must be the same order of license_files. 
  -l LICENSE_FILES [LICENSE_FILES ...], --license_files LICENSE_FILES [LICENSE_FILES ...]         Required argument, specify license files. 
  -o OUTPUT_FILE, --output_file OUTPUT_FILE 
        Output file, yaml format.
 
--VENDOR :指定 vendor。
--LICENSE_FILE :指定 vendor 对应的 license file。
--OUTPUT_FILE :指定输出文件路径。
 
 

附录

附 1. 变更历史

日期
版本
变更描述
源代码变更
2023.1.4
1.0
发布第一个正式 release 版本






点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 20

    粉丝
  • 12

    好友
  • 15

    获赞
  • 0

    评论
  • 547

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-25 20:09 , Processed in 0.017101 second(s), 8 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部