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

Memory management and Sobel Points #37

Open
jrhalket opened this issue Jan 9, 2023 · 8 comments
Open

Memory management and Sobel Points #37

jrhalket opened this issue Jan 9, 2023 · 8 comments

Comments

@jrhalket
Copy link

jrhalket commented Jan 9, 2023

I'm getting memory issues on the HPC I use when I expand the number of Sobel points I use from e.g. 300 to 1000. Is there a reason why the call to TikTak would use appreciably more memory with more Sobel points? What is it storing?

@tpapp
Copy link
Owner

tpapp commented Jan 9, 2023

Currently, it stores all of them before deciding which to keep. Cf this line.

In principle this pass could be done online, ie always keeping just the best points.

That said, I am not sure this is the relevant cause of memory consumption, unless the dimension itself is very large, you are effectively just storing vectors, even with a dimension of 10 thousand you would use 10^4 * 8 * 1000 / (10^9) = 0.08 Gb of memory.

How large is your dimension?

@jrhalket
Copy link
Author

jrhalket commented Jan 9, 2023

Hi - my dim is much smaller: 23 parameters. This is why I was confused by the memory issue as just the vector of points shouldn't be an issue.

I only get the memory issue when the inner loop is large too. In other words, if I use 1000 sobel points and the inner loop problem == "small", then I don't get a memory issue. If I use 100 Sobel points and the inner loop == "large", I don't get a memory issue. But when the inner loop uses a lot of memory and I use a lot of Sobel points, then I get the memory issue.

@tpapp
Copy link
Owner

tpapp commented Jan 9, 2023

Do you use threading?

Are you sure there is no memory leak in your inner loop?

@jrhalket
Copy link
Author

jrhalket commented Jan 9, 2023

I use pmap.

And I'm not 100% sure there's no memory leak in the inner loop. I will check into this a bit more. Thanks

@jrhalket
Copy link
Author

So I've checked into this a bit more and here's what I am finding:
I've tried with 500 Sobel points and everything works fine. After starting with those 500 points, it then subsequently evaluates the objective function more than 3000 times without a hitch. So if my objection function evaluations are leaking memory, it isn't causing a problem here.
When I go up to 1000 Sobel points I get some sort of issue. I don't change anything else in the program.
One random thing I'll mention: inside the objective function evaluation I have some println statements at the end of it that tell me what the fn and parameter values are. When TikTok iterates over the parameters it prints them out for each parameter evaluation. However it never prints this line during the part where it is computing the Sobel points.

@tpapp
Copy link
Owner

tpapp commented Jan 14, 2023

The printing interaction is just frompmap.

Can you try without parallelization though?

@jrhalket
Copy link
Author

jrhalket commented Jan 14, 2023 via email

@tpapp
Copy link
Owner

tpapp commented Jan 14, 2023

Yes, that code predates composable parallel processing APIs. Please try with use_threads = false. Cf #36.

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