Skip to main content

Impact of memory on time to add Gurobi matrix variables

Answered

Comments

4 comments

  • Gurobot (AI-generated response)
    Gurobi Staff Gurobi Staff

    Yes, high memory usage can indeed impact the performance of Gurobi, not just during the solve phase but also when adding variables to the model. When the physical memory (RAM) is heavily utilized or nearly full, operations that require additional memory allocation, such as adding variable vectors via `.addMVar()`, can become slower. This is because the system may need to use swap space on the disk, which is significantly slower than RAM, to manage memory demands. The inconsistency in the time it takes to add variable vectors could be attributed to varying levels of memory availability at the time of each operation, influenced by what other processes are running and how much memory they are consuming. Reducing the memory usage of other processes or optimizing the memory usage of your script before initializing the Gurobi model could help in achieving more consistent performance.

    0
  • Gwyneth Butera
    Gurobi Staff Gurobi Staff

    Also, what does your typical addMVar look like in the script with "modeling activities"? This might have an impact as well.

    0
  • Yuzhou Jiang
    Conversationalist
    Gurobi-versary
    First Question

    Hi Gwyneth,

    Can you clarify what you mean by "modeling activities"? I have a procedure which starts with querying data and storing data into an object, as its attributes, and then is followed by a function that takes this object as an input and constructs a Gurobi model. The function .addMVar is literally the first thing I do after the Gurobi model is created. As I mentioned, I observed that, after this procedure starts, there is a Python 3.11 process in the Activity Monitor whose memory usage is over 10G. My understanding is that this Python process takes too much memory which results in the slowness of the subsequent Gurobi process.

    Thanks,

    Yuzhou

    0
  • Gwyneth Butera
    Gurobi Staff Gurobi Staff

    I was referring to your statement "without any activities that cause high memory usage". I am curious as to what is happening in your addMVar... what arguments are you passing it? How do these differ from your test "without any activities".

    You state: "Sorry I cannot provide any re-producible code so it's work-related". If you are a commercial customer, you can open up a Support Request through the Gurobi Help Center for confidential sharing of files. Also please note that Academic Licenses can only be used for academic purposes like coursework, teaching, and academic, published research.

    0

Please sign in to leave a comment.