Predefine memory for a program in Linux before starting it
I have a program that repeatedly solves large systems of linear equations using cholestial decomposition. It is characterized by the fact that sometimes I need to store full factorization, which can exceed about 20 GB of memory. Factorization happens inside the library I am calling. In addition, this matrix and the resulting factorization change quite frequently and, as such, the memory requirements.
I'm not the only person who can use this computation - node. Hence, is there a way to run a program under Linux and predefine the free memory for the process ?
Sort of: $: prealloc -m 25G ./program
a source to share
I'll hold my neck and say that I don't think Linux has that way. I think the philosophy behind Linux (and every other multitasking feature I've used or heard of) is to give the programmer (and program) the illusion that they have all of the computer's memory to play with and make it very difficult for the programmer to intervene in o / s.
Instead, I think you should be planning to change your program to grab the memory it (or might) require when it starts up, meaning the memory management system itself will be regardless of the language you choose. How easy it can be for you, given the calls to the library, I don't know.
a source to share
I never heard of it. It would normally be bad for other users on node if one program went ahead and started up all the available memory. This is not good practice.
But opinions aside, I would probably write my program in such a way that it acts like a small environment, capable of doing several runs of the subroutine in question without end. It will allocate a lot of memory on startup and then wait for user commands (through a minimal shell) and make requests requested with the memory pool allocated. It will remain in the pool until the user asks for termination.
Of course this requires you to have an interactive node session that you may not have.
a source to share