PLASMA  2.4.5
PLASMA - Parallel Linear Algebra for Scalable Multi-core Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
descriptor.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

PLASMA_desc plasma_desc_init (PLASMA_enum dtyp, int mb, int nb, int bsiz, int lm, int ln, int i, int j, int m, int n)
PLASMA_desc plasma_desc_submatrix (PLASMA_desc descA, int i, int j, int m, int n)
int plasma_desc_check (PLASMA_desc *desc)
int plasma_desc_mat_alloc (PLASMA_desc *desc)
int plasma_desc_mat_free (PLASMA_desc *desc)
int PLASMA_Desc_Create (PLASMA_desc **desc, void *mat, PLASMA_enum dtyp, int mb, int nb, int bsiz, int lm, int ln, int i, int j, int m, int n)
int PLASMA_Desc_Destroy (PLASMA_desc **desc)

Detailed Description

PLASMA auxiliary routines PLASMA is a software package provided by Univ. of Tennessee, Univ. of California Berkeley and Univ. of Colorado Denver

Version:
2.4.5
Author:
Jakub Kurzak
Date:
2010-11-15

Definition in file descriptor.h.


Function Documentation

int plasma_desc_check ( PLASMA_desc desc)

Check for descriptor correctness

Definition at line 82 of file descriptor.c.

References plasma_desc_t::bsiz, plasma_desc_t::dtyp, plasma_desc_t::i, plasma_desc_t::j, plasma_desc_t::lm, plasma_desc_t::ln, plasma_desc_t::m, plasma_desc_t::mat, plasma_desc_t::mb, plasma_desc_t::n, plasma_desc_t::nb, PLASMA_ERR_ILLEGAL_VALUE, PLASMA_ERR_UNALLOCATED, plasma_error(), PLASMA_SUCCESS, PlasmaComplexDouble, PlasmaComplexFloat, PlasmaRealDouble, and PlasmaRealFloat.

{
if (desc->mat == NULL) {
plasma_error("plasma_desc_check", "NULL matrix pointer");
}
if (desc->dtyp != PlasmaRealFloat &&
desc->dtyp != PlasmaRealDouble &&
plasma_error("plasma_desc_check", "invalid matrix type");
}
if (desc->mb <= 0 || desc->nb <= 0) {
plasma_error("plasma_desc_check", "negative tile dimension");
}
if (desc->bsiz < desc->mb*desc->nb) {
plasma_error("plasma_desc_check", "tile memory size smaller than the product of dimensions");
}
if (desc->lm <= 0 || desc->ln <= 0) {
plasma_error("plasma_desc_check", "negative matrix dimension");
}
if (desc->i >= desc->lm || desc->j >= desc->ln) {
plasma_error("plasma_desc_check", "beginning of the matrix out of scope");
}
if (desc->i+desc->m > desc->lm || desc->j+desc->n > desc->ln) {
plasma_error("plasma_desc_check", "submatrix out of scope");
}
}

Here is the call graph for this function:

int PLASMA_Desc_Create ( PLASMA_desc **  desc,
void *  mat,
PLASMA_enum  dtyp,
int  mb,
int  nb,
int  bsiz,
int  lm,
int  ln,
int  i,
int  j,
int  m,
int  n 
)

User routines

PLASMA_Desc_Create - Create matrix descriptor.

Parameters:
[out]descOn exit, descriptor of the matrix.
[in]matMemory location of the matrix.
[in]dtypData type of the matrix:
  • PlasmaRealFloat: single precision real (S),
  • PlasmaRealDouble: double precision real (D),
  • PlasmaComplexFloat: single precision complex (C),
  • PlasmaComplexDouble: double precision complex (Z).
[in]mbNumber of rows in a tile.
[in]nbNumber of columns in a tile.
[in]bsizSize in bytes including padding.
[in]lmNumber of rows of the entire matrix.
[in]lnNumber of columns of the entire matrix.
[in]iRow index to the beginning of the submatrix.
[in]jColumn indes to the beginning of the submatrix.
[in]mNumber of rows of the submatrix.
[in]nNumber of columns of the submatrix.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit

Definition at line 201 of file descriptor.c.

{
int status;
plasma = plasma_context_self();
if (plasma == NULL) {
plasma_error("PLASMA_Desc_Create", "PLASMA not initialized");
}
/* Allocate memory and initialize the descriptor */
*desc = (PLASMA_desc*)malloc(sizeof(PLASMA_desc));
if (*desc == NULL) {
plasma_error("PLASMA_Desc_Create", "malloc() failed");
}
**desc = plasma_desc_init(dtyp, mb, nb, bsiz, lm, ln, i, j, m, n);
(**desc).mat = mat;
status = plasma_desc_check(*desc);
if (status != PLASMA_SUCCESS) {
plasma_error("PLASMA_Desc_Create", "invalid descriptor");
return status;
}
}
int PLASMA_Desc_Destroy ( PLASMA_desc **  desc)

PLASMA_Desc_Destroy - Destroys matrix descriptor.

Parameters:
[in]descMatrix descriptor.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit

Definition at line 245 of file descriptor.c.

{
plasma = plasma_context_self();
if (plasma == NULL) {
plasma_error("PLASMA_Desc_Destroy", "PLASMA not initialized");
}
if (*desc == NULL) {
plasma_error("PLASMA_Desc_Destroy", "attempting to destroy a NULL descriptor");
}
free(*desc);
*desc = NULL;
}
PLASMA_desc plasma_desc_init ( PLASMA_enum  dtyp,
int  mb,
int  nb,
int  bsiz,
int  lm,
int  ln,
int  i,
int  j,
int  m,
int  n 
)

Internal static descriptor initializer

Definition at line 22 of file descriptor.c.

References plasma_desc_t::A12, plasma_desc_t::A21, plasma_desc_t::A22, plasma_desc_t::bsiz, plasma_desc_t::dtyp, plasma_desc_t::i, plasma_desc_t::j, plasma_desc_t::lm, plasma_desc_t::lm1, plasma_desc_t::lmt, plasma_desc_t::ln, plasma_desc_t::ln1, plasma_desc_t::lnt, plasma_desc_t::m, plasma_desc_t::mat, plasma_desc_t::mb, plasma_desc_t::mt, plasma_desc_t::n, plasma_desc_t::nb, and plasma_desc_t::nt.

{
// Matrix address
desc.mat = NULL;
desc.A21 = (lm - lm%mb)*(ln - ln%nb);
desc.A12 = ( lm%mb)*(ln - ln%nb) + desc.A21;
desc.A22 = (lm - lm%mb)*( ln%nb) + desc.A12;
// Matrix properties
desc.dtyp = dtyp;
desc.mb = mb;
desc.nb = nb;
desc.bsiz = bsiz;
// Large matrix parameters
desc.lm = lm;
desc.ln = ln;
// Large matrix derived parameters
desc.lm1 = (lm/mb);
desc.ln1 = (ln/nb);
desc.lmt = (lm%mb==0) ? (lm/mb) : (lm/mb+1);
desc.lnt = (ln%nb==0) ? (ln/nb) : (ln/nb+1);
// Submatrix parameters
desc.i = i;
desc.j = j;
desc.m = m;
desc.n = n;
// Submatrix derived parameters
desc.mt = (i+m-1)/mb - i/mb + 1;
desc.nt = (j+n-1)/nb - j/nb + 1;
return desc;
}
int plasma_desc_mat_alloc ( PLASMA_desc desc)

Definition at line 121 of file descriptor.c.

References plasma_desc_t::dtyp, plasma_desc_t::lm, plasma_desc_t::ln, plasma_desc_t::mat, plasma_element_size(), PLASMA_ERR_OUT_OF_RESOURCES, plasma_error(), and PLASMA_SUCCESS.

{
size_t size;
size = (size_t)desc->lm * (size_t)desc->ln * (size_t)plasma_element_size(desc->dtyp);
if ((desc->mat = malloc(size)) == NULL) {
plasma_error("plasma_desc_mat_alloc", "malloc() failed");
}
memset(desc->mat, 0, size );
}

Here is the call graph for this function:

Here is the caller graph for this function:

int plasma_desc_mat_free ( PLASMA_desc desc)

Definition at line 138 of file descriptor.c.

References plasma_desc_t::mat, and PLASMA_SUCCESS.

{
if (desc->mat != NULL) {
free(desc->mat);
desc->mat = NULL;
}
}
PLASMA_desc plasma_desc_submatrix ( PLASMA_desc  descA,
int  i,
int  j,
int  m,
int  n 
)

Internal static descriptor initializer for submatrices

Definition at line 60 of file descriptor.c.

References plasma_desc_t::i, plasma_desc_t::j, plasma_desc_t::m, plasma_desc_t::mb, plasma_desc_t::mt, plasma_desc_t::n, plasma_desc_t::nb, and plasma_desc_t::nt.

{
PLASMA_desc descB;
int mb, nb;
descB = descA;
mb = descA.mb;
nb = descA.nb;
// Submatrix parameters
descB.i = i;
descB.j = j;
descB.m = m;
descB.n = n;
// Submatrix derived parameters
descB.mt = (i+m-1)/mb - i/mb + 1;
descB.nt = (j+n-1)/nb - j/nb + 1;
return descB;
}