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

[DISCUSS] Any ideas about unified memory management for different native engines? #1

Closed
Gabriel39 opened this issue Dec 8, 2021 · 5 comments
Labels
CORE works for Gluten Core enhancement New feature or request

Comments

@Gabriel39
Copy link

Hi OAP team, your job is wonderful and do you have some plans or designs about unified memory management for different native engines (e.g. velox)?

@FelixYBW
Copy link
Contributor

FelixYBW commented Dec 8, 2021

Do you mean to use Spark's memory management system? Then we need to define a set of APIs for native library where they can be implemented based on native implementation. when the library allocate memory it needs to notify spark's memory management system. This is really important part for spark. In Gazelle engine we spent quite much effort to implement this. We can port them to Gazelle-jni.

Thank you for your reminder, Let's add to readme.

@Gabriel39
Copy link
Author

Gabriel39 commented Dec 9, 2021

Do you mean to use Spark's memory management system? Then we need to define a set of APIs for native library where they can be implemented based on native implementation. when the library allocate memory it needs to notify spark's memory management system. This is really important part for spark. In Gazelle engine we spent quite much effort to implement this. We can port them to Gazelle-jni.

Thank you for your reminder, Let's add to readme.

Hi @FelixYBW yep I think it's a critical part for this project. One more thing I have wondered is if this memory management is same in different engines. As you say, if users choose Gazelle engine, memory management will work well because you have defined-well API and spent much effort for it. But if users choose velox or another engine, since it may implement unified memory management by other ways instead of theses APIs you defined, does users have to do many works to unify memory management in this Spark-gazelleJni-mayAnotherEngine system?

In other words, my question is how to unify memory management API in different native engine?

@FelixYBW
Copy link
Contributor

FelixYBW commented Dec 9, 2021

It may depends on the native library. In theory we can implement a memory pool then every native engine use this pool to allocate large memory block. The pool register memory to Spark's memory management service. Currently Gazelle's one is enhanced from Arrow's. Let's see if it's possible to pull it out for general use.

@jinchengchenghh
Copy link
Contributor

Now we use [OPPRO-174] #264 to unify the memory management

@FelixYBW
Copy link
Contributor

FelixYBW commented Oct 6, 2022

We already implemented the memory allocation interface. Every memory allocation needs to check if Spark has enough memory for this task thread. Now both Arrow and Velox memory are allocated using the interface. Clickhouse backend is still WIP.

@FelixYBW FelixYBW closed this as completed Oct 6, 2022
rui-mo referenced this issue in rui-mo/gazelle-jni Nov 30, 2022
@weiting-chen weiting-chen added CORE works for Gluten Core enhancement New feature or request labels Apr 2, 2023
j7nhai pushed a commit to j7nhai/gluten that referenced this issue Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CORE works for Gluten Core enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants