mock cuda runtime api
Project description
The plt hook technology used refers to plthook
mock pytorch cuda runtime interface
-
update submodule
git submodule update --init --recursive
-
build wheel package
pip wheel .
-
direct install
pip install .
collect cuda operator call stack
- find nvcc installed path
which nvcc
- replace nvcc with my nvcc
mv /usr/local/bin/nvcc /usr/local/bin/nvcc_b
chmod 777 tools/nvcc
cp tools/nvcc /usr/local/bin/nvcc
- build and install pytorch
- build and install cuda_mock
- import cuda_mock after import torch
- run your torch train script
- we will dump the stack into console
收集cuda 算子调用堆栈
- 找到nvcc安装路径
which nvcc
- 用我们的nvcc替换系统的nvcc(我们只是在编译选项加了
-g
)
mv /usr/local/bin/nvcc /usr/local/bin/nvcc_b
chmod 777 tools/nvcc
cp tools/nvcc /usr/local/bin/nvcc
- 构建并且安装pytorch
- 构建并且安装cuda_mock
- 注意要在import torch之后import cuda_mock
- 开始跑你的训练脚本
- 我们将会把堆栈打印到控制台
收集统计xpu runtime 内存分配信息/xpu_wait
调用堆栈
- 打印
xpu_malloc
调用序列,统计实时内存使用情况以及历史使用的峰值内存,排查内存碎片问题 - 打印
xpu_wait
调用堆栈,排查流水中断处问题 - 注意要在
import torch
/import paddle
之后import cuda_mock; cuda_mock.xpu_initialize()
- 使用方法:
import paddle
import cuda_mock; cuda_mock.xpu_initialize() # 加入这一行
example
python test/test_import_mock.py
debug
- export LOG_LEVEL=0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cuda-mock-0.0.2.tar.gz
(2.6 MB
view hashes)
Built Distributions
Close
Hashes for cuda_mock-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c12f40304cb775fca93d28b52e591b93a3cbd1b2e45f59d7904626df08874d8f |
|
MD5 | e62a430df9fecdad3899c8d695eab5e8 |
|
BLAKE2b-256 | 42fb21838e42cab13a66887fb1589fac30e4aa4e48236508d14dc2dfa3b3e04d |
Close
Hashes for cuda_mock-0.0.2-cp312-abi3-manylinux_2_35_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e62e6c9aa3bf69093b548355e0b7c93471a3df751cc5c75530dc15c8b7d889da |
|
MD5 | 1e2f96dfbff60c388b79379d13c40b1f |
|
BLAKE2b-256 | b4e3847d7e7b013a3aa796a301524aaa4c25d67b534638fb6c5fa2fb53549321 |