Skip to content

how to get memory allocate detail in model infer? #24323

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zhangvia opened this issue Apr 7, 2025 · 2 comments
Open

how to get memory allocate detail in model infer? #24323

zhangvia opened this issue Apr 7, 2025 · 2 comments

Comments

@zhangvia
Copy link

zhangvia commented Apr 7, 2025

Describe the issue

i want to analysis the memory cost in model infer, but when i set enable_profiling=true, there is nothing about memory detail in profile json. do i need build onnxruntime from source with onnxruntime_ENABLE_MEMORY_PROFILE?

To reproduce

import onnxruntime as ort
model_path = "/media/general.onnx"
sess_options = ort.SessionOptions()
sess_options.enable_profiling = True
model_sess = ort.InferenceSession(model_path,sess_options,providers=[('CUDAExecutionProvider',{'device_id':1})])
import numpy as np
import numpy as np
input = {"input":np.random.rand(1,3,1170,2532).astype(np.float32),"orig_im_size":[1170,2532]}
model_sess.run(None,input)

Urgency

No response

Platform

Linux

OS Version

ubuntu 20.04

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

1.18.1

ONNX Runtime API

Python

Architecture

X64

Execution Provider

CUDA

Execution Provider Library Version

cuda 12.4

@tianleiwu
Copy link
Contributor

Use --enable_memory_profile in build.
See #5658

@zhangvia
Copy link
Author

zhangvia commented Apr 8, 2025

Use --enable_memory_profile in build. See #5658

i build onnxruntime from source with args ./build.sh --use_cuda --cudnn_home /usr/local/cuda --cuda_home /usr/local/cuda --enable_nvtx_profile --enable_memory_profile --allow_running_as_root --build_wheel --cmake_extra_defines CMAKE_POLICY_VERSION_MINIMUM=3.5

and there is no error in build process, but seg fault happened in some pytorch test. and there is no whl file in build directory. how can i install python interface of onnxruntime after build?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants