Personal tools
You are here: Home cm Wiki Change Memory Allocation Parameters
Views
[The cm Wiki. User and Developer Documentation]? >>

Change Memory Allocation Parameters

last edited 3 years ago by stevens

The Memory Allocation Parameters

The memory allocation parameters control the sizes of arrays used by CMISS. The parameters are set by default in CMISS, however, often a users may need change the parameters to suit their requirements. For example, one might find when solving a finite element problem that more elements than the default maximum number are required. Alternatively the default sizes may be excessively large for a particular application, to save memory the user can decrease the size of some parameters or not allocate memory for applications of CMISS that are never used.

To set the memory allocation parameters one must create a parameters file, edit the desired values, and read the new parameters into CMISS. Each of these steps is explained fully in the following sections.

Creating a Parameters File

In order to change the memory allocation parameters one must first create a parameters file. The command to create or overwrite a parameters file is

FEM define parameters;w

or to give the created file a name other than the default

FEM define parameters;w;name

The file created will have the extension .ippara.

Descriptions of Memory Allocation Parameters

The parameters file described above contains full list of memory allocation parameters and a short description. A more detailed description of each parameter may be obtained by looking up the name in the CMISS Viewer.

There are two major types of memory allocation parameters: dimension parameters and switch parameters.

The parameters beginning with N and ending in M are dimension parameters. They determine the dimensions of arrays. The values should generally be positive integers, or sometimes can be 0. If an array is not used in an optimized version of CMISS its dimension can be set to 0 but this may cause problems in the debug version. The maximum allowable parameter value is governed by the capabilities of the hardware but the parameters should be kept close to as small as possible.

The parameters beginning with USE_ are switch parameters and must either have the value 0 or 1. They specify whether or not to allocate memory for array required for various features of CMISS. The value needs to be 1 if the feature is going to be used, but, if the feature is not used, it can be set to 0 to save memory. USE_VORONOI should only be set to one if Voronoi triangulations are going to be used.

Determining the Appropriate Values for Dimension Parameters

One of the most common reasons that memory allocation parameters may need to be changed is an error message like this

Error: >>Increase NP_R_M>IPMESH9_DYNAM>IPMESH9>IPMESH>DEMESH>
FEMA>FEM>SYNTAX>PARSE

This means that the dimension parameter NP_R_M (the maximum number of nodes in a region) must be increased. For a guide to the required value for a dimension parameter use the command

FEM list parameters

or to list specific dimension parameters e.g., np, those related to the number of nodes FEM list parameters np

A portion of the resulting listing for this case is as follows

NPM = 200 NPT(0..nr) = 312 312
NP_R_M = 200 NPNODE(0,0..nr) = 312 312
NPTM = 1      

In the first column are the parameters current values; In the second column the parameters ending with T are a guide to the required value. For example from the error message and the parameters listing above we can see that presently the maximum number of global nodes (NPM) is 200, but the required number is 312 (NPT). Therefore the value of the parameters NPM and NP_R_M (the maximum number of global nodes and the maximum number of nodes in a region) must be increased to at least 312.

The parameter listing may also be used to determine the minimum required values for the memory allocation parameters.

NOTE: This provides some guide to the required values, but may not be useful in some cases.

Editing the Parameters File

Once a parameters file has been created it can be edited using any text editor. Do not use tabs or alter the format of the file, change only the values of the parameters or CMISS will be unable to read the file back in.

In the example above it was determined that the maximum number of global nodes and the maximum number of nodes in a region needed to be increased. To do this the following lines need to be found in the parameters file

Max global nodes (NPM)[1]?: 200
Max global nodes in a region (NP_R_M)[1]?: 200

and changed to

Max global nodes (NPM)[1]?: 312
Max global nodes in a region (NP_R_M)[1]?: 312

Save and close the file

Reading the New Parameters Into CMISS

To use the memory allocation parameters to set up the required arrays, the parameters must first be read into CMISS. The parameters are read in with the command

FEM define parameters;r

or if the file has a name other than the default

FEM define parameters;r;name

This will erase all arrays and reallocate memory using the new parameters.

Sparsity Structures

COMPRESSED-ROW FORMAT:

The sparsity scheme is based on storing a NxN matrix, GX, as a one dimensional array of length NZT (where nz=sxNxN, s is the sparsity of the array) that stores only the non-zero elements of GX. Two additional arrays ISR and ISC store the positions of the non-zero elements. ISR is of length N+1 and ISC is of length NZT. ISR(i) stores the position in ISC of the start of row i. The N+1 position of ISR stores the size of ISC+1 ie. NZT+1. The number of non-zero elements in row i can be found from ISR(i+1)-ISR(i). ISC(nz) gives the column number for non-zero element nz. Example of sparsity storage scheme on a NxN matrix (N=6). Here the sparsity is 8/36 or 22%
    
GX 1 2 3 4 5 6
____________ GX(nz)
1| 0 A 0 B 0 0 A B C D E F G H
2| 0 0 C 0 0 0
3| 0 0 0 0 D E ISR(i)
4| F 0 0 0 0 0 1 3 4 6 7 8 9
5| 0 0 G 0 0 0 ISC(i)
6| 0 0 0 0 0 H 2 4 3 5 6 1 3 6

ROW-COLUMN FORMAT:

The sparsity scheme is based on storing a NxN matrix, GX, as a one dimensional array of length NZT (where nz=sxNxN, s is the sparsity of the array) that stores only the non-zero elements of GX. Two additional arrays ISC and ISR store the positions of the non-zero elements. Both ISR and ISC are of length NZT. ISR(nz) stores the row number of the non-zero element nz and ISC(nz) stores the column number of the element. Example of sparsity storage scheme on a NxN matrix (N=6). Here the sparsity is 8/36 or 22%

 
GX 1 2 3 4 5 6
____________ GX(nz)
1| 0 A 0 B 0 0 A B C D E F G H
2| 0 0 C 0 0 0
3| 0 0 0 0 D E ISR(i)
4| F 0 0 0 0 0 1 1 2 3 3 4 5 6
5| 0 0 G 0 0 0 ISC(i)
6| 0 0 0 0 0 H 2 4 3 5 6 1 3 6