Skip to content
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

[Feature Request] C++: Create arena based allocator and have access to it #18912

Open
AndreyOrb opened this issue Dec 22, 2023 · 2 comments
Open
Labels
feature request request for unsupported feature or enhancement

Comments

@AndreyOrb
Copy link

AndreyOrb commented Dec 22, 2023

Describe the feature request

I would like to reuse a global allocator.

With api.CreateAndRegisterAllocatorV2 I can create global allocator, but I still have no access to it.

With api.CreateAllocator I can create one and have access to it, but it requires a session as a parameter.
So, I need to create a session with some dummy graph first.

Describe scenario use case

With an access to allocator, I can reuse it to pre-allocate tensors (not with bindings), to know current utilization of a memory, etc.

It can be a new api.GetAllocator method or api.CreateAllocator without session

@AndreyOrb AndreyOrb added the feature request request for unsupported feature or enhancement label Dec 22, 2023
@AndreyOrb AndreyOrb changed the title [Feature Request] C++: Create global allocator and have access to it [Feature Request] C++: Create arena based allocator and have access to it Dec 22, 2023
@pranavsharma
Copy link
Contributor

Does this work for you?

/** \brief Get the default allocator
*
* The default allocator is a CPU based, non-arena. Always returns the same pointer to the same default allocator.
*
* \param[out] out Returned value should NOT be freed
*
* \snippet{doc} snippets.dox OrtStatus Return Value
*/
ORT_API2_STATUS(GetAllocatorWithDefaultOptions, _Outptr_ OrtAllocator** out);
. I assume you're looking for a CPU allocator only.

@AndreyOrb
Copy link
Author

I'm actually looking for both CPU and GPU allocators.

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

No branches or pull requests

2 participants