Skip to main content

CANN simulation log parser and web viewer

Project description

CANN Sim Log Viewer

用于浏览和解析 cannsim 仿真日志的本地 Web 可视化工具。后端给定日志目录启动,前端在浏览器中动态查看日志、访存数据和指令关联关系。

安装

从 PyPI 安装:

pip install cannLog

从源码安装:

pip install .

开发模式安装:

pip install -e .

安装后会提供两个等价命令:

cann-log-parser /path/to/log_dir --host localhost --port 8000
cann-log-viewer /path/to/log_dir --host localhost --port 8000

也可以继续使用兼容入口:

python -m cann_log_parser.server /path/to/log_dir --host localhost --port 8000
python -m app.server /path/to/log_dir --host localhost --port 8000

打开:http://localhost:8000

已支持的日志类型

  • 指令日志:*.instr_log.dump*.instr_popped_log.dump
  • 访存日志:*.rd_log.dump*.wr_log.dump
  • PV 访存日志:*rvec_pv.dump,按指令 ID 合并 Rd/Wr 数据块并支持解码
  • CCU/队列事件:*.ccu_log.dump*issque.dump*.OOO.dump
  • PMU/summary:*.perf_pmu.log*.perf_pmu_per_vf.log*summary_log

功能

  • 给定日志目录启动本地 Web 服务
  • 前端动态加载文件树和事件页,大日志分页读取
  • 访存日志按指令 ID 合并展示;同一指令拆开的多个数据块会作为同一事件的多个 block 展示
  • 支持 hex32uint8/int8uint16/int16/float16/bfloat16uint32/int32/float32uint64/int64/float64 解码
  • instructionId 跨文件查询关联访存事件,并可跳转定位到具体事件
  • 支持分类、Core、Unit、文件名过滤
  • 支持多日志页签、右键菜单、新窗口打开、重载日志

使用示例

cann-log-parser /mnt/workspace/log/cann-sim/log_ca --host 0.0.0.0 --port 18000

打开:http://localhost:18000

API

  • GET /api/overview
  • GET /api/files
  • GET /api/file?path=...&page=1&pageSize=50
  • GET /api/stats?path=...
  • GET /api/instruction-memory?instructionId=4309
  • GET /api/decode-memory?path=core0.veccore0.ub.wr_log.dump&eventIndex=0&dtype=float32
  • POST /api/reload

打包发布到 PyPI

安装构建和上传工具:

python -m pip install build twine

构建源码包和 wheel:

python -m build

检查包元数据:

python -m twine check dist/*

上传到 TestPyPI:

python -m twine upload --repository testpypi dist/*

上传到正式 PyPI:

python -m twine upload dist/*

发布前建议:

  • 确认 pyproject.toml 中的 name = "cannLog" 没有被 PyPI 占用
  • 为每次发布递增 version
  • 如果需要开源发布,补充许可证文件并在 pyproject.toml 里声明 license

实现说明

  • 后端仅使用 Python 标准库,无运行时依赖
  • 前端为原生 HTML/CSS/JS,无需构建
  • 静态资源已作为 package data 打进 wheel,pip 安装后可直接运行

许可证

本项目使用 MIT License,详见 LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cannlog-0.1.0.tar.gz (32.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cannlog-0.1.0-py3-none-any.whl (33.5 kB view details)

Uploaded Python 3

File details

Details for the file cannlog-0.1.0.tar.gz.

File metadata

  • Download URL: cannlog-0.1.0.tar.gz
  • Upload date:
  • Size: 32.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for cannlog-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bf58c6e6f2fd999d4e2d4a44dfbe060521d3361bc12008b8e54b03b85bcab38c
MD5 868a2e5cb85997dd205aec9817b8e210
BLAKE2b-256 8c68f1bf78f2aed217e3c31c78673d59d1604963fb8902095b5d12dfdcf9fe66

See more details on using hashes here.

File details

Details for the file cannlog-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: cannlog-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 33.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.4

File hashes

Hashes for cannlog-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 74b2ac566e53c185507bd641eb9812cb4aeaea1989ff049844df524890dd3641
MD5 cb42ea137341f2608ab8e8bb4a6bf647
BLAKE2b-256 79740dc6a448a31fa3421ff2358f9a8392ab7dc46e4274836a4deeafbec9ae92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page