SuperLU: SRC/zmemory.c File Reference

SuperLU 7.0.0

Macros | Functions
zmemory.c File Reference

Memory details. More...

`#include "slu_zdefs.h"`
Include dependency graph for zmemory.c:

## Macros
#define | StackFull(x) ( x + Glu->stack.used >= Glu->stack.size )
#define | NotDoubleAlign(addr) ( (intptr_t)addr & 7 )
#define | DoubleAlign(addr) ( ((intptr_t)addr + 7) & ~7L )
#define | TempSpace(m, w)
#define | Reduce(alpha) ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */

## Functions
void * | zexpand (int_t *prev_len, MemType type, int_t len_to_copy, int keep_prev, GlobalLU_t *Glu)
| Expand the existing storage to accommodate more fill-ins. More...
int | zLUWorkInit (int m, int n, int panel_size, int **iworkptr, doublecomplex **dworkptr, GlobalLU_t *Glu)
| Allocate known working storage. Returns 0 if success, otherwise returns the number of bytes allocated so far when failure occurred. More...
void | copy_mem_doublecomplex (int_t, void *, void *)
void | zStackCompress (GlobalLU_t *Glu)
| Compress the work[] array to remove fragmentation. More...
void | zSetupSpace (void *work, int_t lwork, GlobalLU_t *Glu)
| Setup the memory model to be used for factorization. More...
void * | zuser_malloc (int, int, GlobalLU_t *)
void | zuser_free (int, int, GlobalLU_t *)
void | copy_mem_int (int, void *, void *)
void | user_bcopy (char *, char *, int)
int | zQuerySpace (SuperMatrix *L, SuperMatrix *U, mem_usage_t *mem_usage)
int | ilu_zQuerySpace (SuperMatrix *L, SuperMatrix *U, mem_usage_t *mem_usage)
int_t | zLUMemInit (fact_t fact, void *work, int_t lwork, int m, int n, int_t annz, int panel_size, double fill_ratio, SuperMatrix *L, SuperMatrix *U, GlobalLU_t *Glu, int **iwork, doublecomplex **dwork)
| Allocate storage for the data structures common to all factor routines. More...
void | zSetRWork (int m, int panel_size, doublecomplex *dworkptr, doublecomplex **dense, doublecomplex **tempv)
| Set up pointers for real working arrays. More...
void | zLUWorkFree (int *iwork, doublecomplex *dwork, GlobalLU_t *Glu)
| Free the working storage used by factor routines. More...
int_t | zLUMemXpand (int jcol, int_t next, MemType mem_type, int_t *maxlen, GlobalLU_t *Glu)
| Expand the data structures for L and U during the factorization. More...
void | zallocateA (int n, int_t nnz, doublecomplex **a, int_t **asub, int_t **xa)
| Allocate storage for original matrix A. More...
doublecomplex * | doublecomplexMalloc (size_t n)
doublecomplex * | doublecomplexCalloc (size_t n)
int_t | zmemory_usage (const int_t nzlmax, const int_t nzumax, const int_t nzlumax, const int n)

## Detailed Description

Copyright (c) 2003, The Regents of the University of California, through Lawrence Berkeley National Laboratory (subject to receipt of any required approvals from U.S. Dept. of Energy)

All rights reserved.

The source code is distributed under BSD license, see the file License.txt at the top-level directory.

    -- SuperLU routine (version 7.0.0) --
    Lawrence Berkeley National Laboratory.
    June 30, 2009
    August 2024

## Macro Definition Documentation

## ◆ DoubleAlign

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

## ◆ NotDoubleAlign

#define NotDoubleAlign | ( |  | addr | ) | ( (intptr_t)addr & 7 )

## ◆ Reduce

#define Reduce | ( |  | alpha | ) | ((alpha + 1) / 2) /* i.e. (alpha-1)/2 + 1 */

## ◆ StackFull

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

## ◆ TempSpace

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

Value:
( (2*w + 4 + NO_MARKER) * m * sizeof(int) + \
(w + 1) * m * sizeof(doublecomplex) )
NO_MARKER
#define NO_MARKER
Definition: slu_util.h:57
doublecomplex
Definition: slu_dcomplex.h:31

## Function Documentation

## ◆ copy_mem_doublecomplex()

void copy_mem_doublecomplex | ( | int_t | howmany,
|  | void * | old,
|  | void * | new
| ) |  |

## ◆ copy_mem_int()

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

## ◆ doublecomplexCalloc()

doublecomplex * doublecomplexCalloc | ( | size_t | n | ) |

## ◆ doublecomplexMalloc()

doublecomplex * doublecomplexMalloc | ( | size_t | n | ) |

## ◆ ilu_zQuerySpace()

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

Calculate memory usage

Parameters

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

Here is the call graph for this function:

## ◆ user_bcopy()

void user_bcopy | ( | char * | src,
|  | char * | dest,
|  | int | bytes
| ) |  |

## ◆ zallocateA()

void zallocateA | ( | int | n,
|  | int_t | nnz,
|  | doublecomplex ** | a,
|  | int_t ** | asub,
|  | int_t ** | xa
| ) |  |

Here is the call graph for this function:

## ◆ zexpand()

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

Here is the call graph for this function:

## ◆ zLUMemInit()

int_t zLUMemInit | ( | fact_t | fact,
|  | void * | work,
|  | int_t | lwork,
|  | int | m,
|  | int | n,
|  | int_t | annz,
|  | int | panel_size,
|  | double | fill_ratio,
|  | SuperMatrix * | L,
|  | SuperMatrix * | U,
|  | GlobalLU_t * | Glu,
|  | int ** | iwork,
|  | doublecomplex ** | 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.

Here is the call graph for this function:

## ◆ zLUMemXpand()

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

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

Here is the call graph for this function:

## ◆ zLUWorkFree()

void zLUWorkFree | ( | int * | iwork,
|  | doublecomplex * | dwork,
|  | GlobalLU_t * | Glu
| ) |  |

## ◆ zLUWorkInit()

int zLUWorkInit | ( | int | m,
|  | int | n,
|  | int | panel_size,
|  | int ** | iworkptr,
|  | doublecomplex ** | dworkptr,
|  | GlobalLU_t * | Glu
| ) |  |

Here is the call graph for this function:

## ◆ zmemory_usage()

int_t zmemory_usage | ( | const int_t | nzlmax,
|  | const int_t | nzumax,
|  | const int_t | nzlumax,
|  | const int | n
| ) |  |

## ◆ zQuerySpace()

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

Calculate memory usage

Parameters

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

Here is the call graph for this function:

## ◆ zSetRWork()

void zSetRWork | ( | int | m,
|  | int | panel_size,
|  | doublecomplex * | dworkptr,
|  | doublecomplex ** | dense,
|  | doublecomplex ** | tempv
| ) |  |

Here is the call graph for this function:

## ◆ zSetupSpace()

void zSetupSpace | ( | void * | work,
|  | int_t | lwork,
|  | GlobalLU_t * | Glu
| ) |  |

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

## ◆ zStackCompress()

void zStackCompress | ( | GlobalLU_t * | Glu | ) |

Here is the call graph for this function:

## ◆ zuser_free()

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

## ◆ zuser_malloc()

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