SuperLU: SRC/smemory.c File Reference

# SRC/smemory.c File Reference

Memory details. More...

`#include "slu_sdefs.h"`

## Defines
#define | StackFull(x) ( x + Glu->stack.used >= Glu->stack.size )
#define | NotDoubleAlign(addr) ( (long int)addr & 7 )
#define | DoubleAlign(addr) ( ((long int)addr + 7) & ~7L )
#define | TempSpace(m, w)
#define | Reduce(alpha) ((alpha + 1) / 2)
## Functions
void * | sexpand (int *prev_len,MemType type,int len_to_copy,int keep_prev,GlobalLU_t *Glu)
| Expand the existing storage to accommodate more fill-ins.
int | sLUWorkInit (int m, int n, int panel_size, int **iworkptr, float **dworkptr, GlobalLU_t *Glu)
| Allocate known working storage. Returns 0 if success, otherwise returns the number of bytes allocated so far when failure occurred.
void | copy_mem_float (int, void *, void *)
void | sStackCompress (GlobalLU_t *Glu)
| Compress the work[] array to remove fragmentation.
void | sSetupSpace (void *work, int lwork, GlobalLU_t *Glu)
| Setup the memory model to be used for factorization.
void * | suser_malloc (int, int, GlobalLU_t *)
void | suser_free (int, int, GlobalLU_t *)
void | copy_mem_int (int, void *, void *)
void | user_bcopy (char *, char *, int)
int | sQuerySpace (SuperMatrix *L, SuperMatrix *U, mem_usage_t *mem_usage)
int | ilu_sQuerySpace (SuperMatrix *L, SuperMatrix *U, mem_usage_t *mem_usage)
int | sLUMemInit (fact_t fact, void *work, int lwork, int m, int n, int annz, int panel_size, float fill_ratio, SuperMatrix *L, SuperMatrix *U, GlobalLU_t *Glu, int **iwork, float **dwork)
| Allocate storage for the data structures common to all factor routines.
void | sSetRWork (int m, int panel_size, float *dworkptr, float **dense, float **tempv)
| Set up pointers for real working arrays.
void | sLUWorkFree (int *iwork, float *dwork, GlobalLU_t *Glu)
| Free the working storage used by factor routines.
int | sLUMemXpand (int jcol, int next, MemType mem_type, int *maxlen, GlobalLU_t *Glu)
| Expand the data structures for L and U during the factorization.
void | sallocateA (int n, int nnz, float **a, int **asub, int **xa)
| Allocate storage for original matrix A.
float * | floatMalloc (int n)
float * | floatCalloc (int n)
int | smemory_usage (const int nzlmax, const int nzumax, const int nzlumax, const int n)

## Detailed Description

     -- SuperLU routine (version 4.0) --
     Lawrence Berkeley National Laboratory.
     June 30, 2009

## Define Documentation

#define DoubleAlign | ( | addr |  | ) | ( ((long int)addr + 7) & ~7L )

#define NotDoubleAlign | ( | addr |  | ) | ( (long int)addr & 7 )

#define Reduce | ( | alpha |  | ) | ((alpha + 1) / 2)

#define StackFull | ( | x |  | ) | ( x + Glu->stack.used >= Glu->stack.size )

#define TempSpace | ( | m,
|  | w |  | ) |

Value:

    ( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \
                                  (w + 1) * m * sizeof(float) )

## Function Documentation

void copy_mem_float | ( | int | howmany,
|  | void * | old,
|  | void * | new |
| ) |  |  |

void copy_mem_int | ( | int | ,
|  | void * | ,
|  | void * |  |
| ) |  |  |

float* floatCalloc | ( | int | n | ) |

float* floatMalloc | ( | int | n | ) |

int ilu_sQuerySpace | ( | SuperMatrix * | L,
|  | SuperMatrix * | U,
|  | mem_usage_t * | mem_usage |
| ) |  |  |

     mem_usage consists of the following fields:
    for_lu (float)
          The amount of space used in bytes for the L data structures.total_needed (float)
          The amount of space needed in bytes to perform factorization.

void sallocateA | ( | int | n,
|  | int | nnz,
|  | float ** | a,
|  | int ** | asub,
|  | int ** | xa |
| ) |  |  |

void * sexpand | ( | int * | prev_len,
|  | MemType | type,
|  | int | len_to_copy,
|  | int | keep_prev,
|  | GlobalLU_t * | Glu |
| ) |  |  |

int sLUMemInit | ( | fact_t | fact,
|  | void * | work,
|  | int | lwork,
|  | int | m,
|  | int | n,
|  | int | annz,
|  | int | panel_size,
|  | float | fill_ratio,
|  | SuperMatrix * | L,
|  | SuperMatrix * | U,
|  | GlobalLU_t * | Glu,
|  | int ** | iwork,
|  | float ** | dwork |
| ) |  |  |

Memory-related.

     For those unpredictable size, estimate as fill_ratio * nnz(A).
     Return value:
         If lwork = -1, return the estimated amount of space required, plus n;
         otherwise, return the amount of space actually allocated when
         memory allocation failure occurred.

int sLUMemXpand | ( | int | jcol,
|  | int | next,
|  | MemType | mem_type,
|  | int * | maxlen,
|  | GlobalLU_t * | Glu |
| ) |  |  |

     Return value:   0 - successful return
                   > 0 - number of bytes allocated when run out of space

void sLUWorkFree | ( | int * | iwork,
|  | float * | dwork,
|  | GlobalLU_t * | Glu |
| ) |  |  |

int sLUWorkInit | ( | int | m,
|  | int | n,
|  | int | panel_size,
|  | int ** | iworkptr,
|  | float ** | dworkptr,
|  | GlobalLU_t * | Glu |
| ) |  |  |

int smemory_usage | ( | const int | nzlmax,
|  | const int | nzumax,
|  | const int | nzlumax,
|  | const int | n |
| ) |  |  |

int sQuerySpace | ( | SuperMatrix * | L,
|  | SuperMatrix * | U,
|  | mem_usage_t * | mem_usage |
| ) |  |  |

     mem_usage consists of the following fields:
    for_lu (float)
          The amount of space used in bytes for the L data structures.total_needed (float)
          The amount of space needed in bytes to perform factorization.

void sSetRWork | ( | int | m,
|  | int | panel_size,
|  | float * | dworkptr,
|  | float ** | dense,
|  | float ** | tempv |
| ) |  |  |

void sSetupSpace | ( | void * | work,
|  | int | lwork,
|  | GlobalLU_t * | Glu |
| ) |  |  |

lwork = 0: use system malloc; lwork > 0: use user-supplied work[] space.

void sStackCompress | ( | GlobalLU_t * | Glu | ) |

void suser_free | ( | int | bytes,
|  | int | which_end,
|  | GlobalLU_t * | Glu |
| ) |  |  |

void * suser_malloc | ( | int | bytes,
|  | int | which_end,
|  | GlobalLU_t * | Glu |
| ) |  |  |

void user_bcopy | ( | char * | ,
|  | char * | ,
|  | int |  |
| ) |  |  |