Maximum size of matrix in GS

Answered

Comments

7 comments

  • Official comment
    Avatar
    Rick Kossik

    How big is your matrix?  You say you have an array label set with 1500 members.  Is the matrix 1500 by 1500?  Note that GoldSim was not designed to carry out computations on such large matrices.  As Jason pointed out, this is because all of the items in a matrix are not just numbers, they are potentially expressions and outputs.  As a result, the memory footprint is very large indeed. Can you explain 1) how big is the matrix; and 2) what exactly are you trying to do with it?  I'm sure that we can find a workaround.

    Comment actions Permalink
  • Avatar
    Jason

    Page,

    Would it be possible to switch to using a Lookup Table element instead of a Data element with matrix data types? The reason I ask is because the Data element items take more memory than the cells of a lookup table, which are just static values. The Data element inputs are fully capable of parsing any expression and therefore carry more weight.

    Are you calculating dynamic outputs in the same matrix dimensions or are you doing only a static matrix calculation at time zero of the simulation? If static, the Lookup Table could work. However, if you need to track all matrix item outputs during all time of the simulation, then you may start to run into system memory limits on your computer. It's not really that GoldSim has built in limits. Instead, it is that your computer has limits and whatever you are building in the model starts to approach those, causing issues with the application. 

    Does this help?

    Jason

    0
    Comment actions Permalink
  • Avatar
    Page Weil

    Rick/Jason

    This matrix is very simple (1s and 0s, no data elements). The intent of this matrix is to provide the relationship between different water rights within a stream system. Essentially, it works like this:

    1. There are 1500 water rights throughout a particular river system that are in various locations on the river, with a range of relative seniority (I develop this matrix using Excel and it does not change).

    2. When assessing whether a particular water right (row of matrix) is allowed to divert water, the model needs to check from a list of relevant water rights (all columns in that row with a 1) whether those have been fully satisfied or not. This is performed by multiplying a vector of flow values (1500 values) by the row in this matrix (1500 1s or 0s) and then finding the minimum of that row.

    3. If all "relevant" water rights are satisfied, then that water right is allowed to divert. 

    Jason, when I tried to build a lookup table of similar dimensions (1500x1500), I also get an "out of memory" error.

    A lookup table could work here if I can get past this error. 

    The lookup table does not need to interpolate between values, each row/column label is an integer and each value is a 1 or 0.

     

    0
    Comment actions Permalink
  • Avatar
    Rick Kossik

    I assume you are creating the matrix inside a Script?  In that case, it is indeed similar to a Data element (GoldSim sets up outputs for all 2,250,000 members of that matrix).  This is a very large memory footprint.

    So this matrix is not dynamic?  That is, the entries do not change with time during the simulation? I assume then that the flow values are dynamic, so you need to do this calculation every timestep?

    0
    Comment actions Permalink
  • Avatar
    Page Weil

    Rick:

    1. I am creating this matrix outside of the script (since the values are fixed). The script loops through each row of this matrix to do its assessment.

    2. The matrix is not dynamic. The flow values are, and they vary with each timestep.

    What I am trying to do, for each water right, is to find the minimum of a subset of flow values. Currently this subset is defined by the 1s and 0s in this matrix. I could do this in any number of ways. 

    0
    Comment actions Permalink
  • Avatar
    Rick Kossik

    I would need to better understand what you are doing.  It is not clear to me why you need a script for this. You should be able to actually do this operation in an expression.  Also, I can create a 2D table (1500 by 1500) without issues.  Perhaps the rest of your model also has large arrays?  I don't think we will make much progress without talking.  Please create a support ticket here: https://support.goldsim.com/hc/en-us/requests/new

    0
    Comment actions Permalink
  • Avatar
    Page Weil

    Thank you for your help here. I have opened a support ticket.

    0
    Comment actions Permalink

Please sign in to leave a comment.