Preventing memory overflow #55
MarcT0K
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In my current experiments, I am trying to scale the parameters until the memory overflows. My goal is more specifically to compare two algorithms and identify the point at which they cannot be executed any more.
The tricky part is then to control the memory overflowing to avoid the computer to be blocked. The OS might kill the script at some point but it is better to control this process ourselves, especially if we want to execute other tasks (e.g., writing the results in a csv) after the overflowing).
The
resource
built-in library is helpful to set a limit on the memory usage. If the memory exceeds a certain limit, a MemoryError will be raised. All this looks great but it gets more complicated since MPyC operations are asynchronous.To simulate an overflow, one can use the following code:
All the code is executed normally until the shutdown. Indeed, we can catch the MemoryError but it seems complicated to pursue the MPC protocol afterwards. I've started investigating and it seems it comes from a desynchronization between the parties: some parties may have been stopped by the MemoryError while others never crashed. Hence, there may be one party waiting for messages that will never arrive. More generally, the MemoryError can occur at anytime during the coroutine execution. Hence, it is hard to recover from a state on which we have little control.
From these first investigations, I feel like I have two options:
Feel free to contribute to this discussion with potential ideas you may have to solve this problem. For now, I'll work with the second option which requires much less work than the first option. If someone else is interested by such a feature, I may isolate my code and improve it to make it easy to use (e.g., using pickle to simplify the subprocess creation).
Beta Was this translation helpful? Give feedback.
All reactions