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

Add a new Multithreading mode "Low RAM - Max thread" #59

Open
redmoon1945 opened this issue Aug 22, 2024 · 3 comments
Open

Add a new Multithreading mode "Low RAM - Max thread" #59

redmoon1945 opened this issue Aug 22, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@redmoon1945
Copy link

Feature Description

There are 2 modes at the moment. "Performance" crashes the system when all memory is consumed. "Low RAM" works well but is slower, because it does not seem to use all the available processors (thread). I suggest a "Low RAM - Max thread" mode (name is just a suggestion, pick up one that make more sense) where RAM used could be retrained to a certain amount (e.g. 16 GB) and threads number could be specified up to MAX-1.

Technical Details

I have no idea how you can implement this.

Existing Implementations

There is no such option at the moment.

@JacobDev1
Copy link
Owner

I have little control over the encoders because I'm not using the API. This makes the problem quite tricky to solve.

Limiting the maximum number of encoders is definitely an option.

Monitoring the RAM usage of each process would require a heavy rewrite. I'm not sure if that's worth it. I'm planning on eventually transitioning to the API anyway.

For now, I'll wait for the libjxl devs to get back to me. If that fails, I'll think of something else then.

@JacobDev1 JacobDev1 added the enhancement New feature or request label Aug 22, 2024
@JacobDev1
Copy link
Owner

The "Low RAM" mode may be slower, but I can assure you it does utilize all threads given to it. Thread saturation is a separate topic.

The solution you proposed of letting users choose the number of threads is something I've considered for some time. I don't think it will be that useful to most users, though.

For now, I've replaced the Multithreading options with an optimizer that will detect when to switch to a single-worker mode. This will fix the high RAM usage at a cost of some speed.

Unfortunately, the transition to API I mentioned before won't happen.

@kupitmanzv

This comment was marked as spam.

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

No branches or pull requests

3 participants