MAGMA  1.2.0
MatrixAlgebraonGPUandMulticoreArchitectures
 All Classes 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.

Macros

#define BLKLDD(A, k)   ( ( (k) + (A)->desc.i/(A)->desc.mb) < (A)->desc.lm1 ? (A)->desc.mb : (A)->desc.lm%(A)->desc.mb )

Functions

static void * magma_geteltaddr (const magma_desc_t *A, int m, int n, int eltsize)
static void * magma_getaddr (magma_desc_t *A, int m, int n)
magma_desc_t magma_desc_init (MAGMA_enum dtyp, int mb, int nb, int bsiz, int lm, int ln, int i, int j, int m, int n)
magma_desc_t magma_desc_submatrix (magma_desc_t descA, int i, int j, int m, int n)
int magma_desc_check (magma_desc_t *desc)
int magma_desc_mat_alloc (magma_desc_t *desc)
int magma_desc_mat_free (magma_desc_t *desc)
int plasma_element_size (int type)

Detailed Description

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

Version:
1.1.0
Author:
Jakub Kurzak
Mathieu Faverge
Date:
2010-11-15

Definition in file descriptor.h.


Macro Definition Documentation

#define BLKLDD (   A,
 
)    ( ( (k) + (A)->desc.i/(A)->desc.mb) < (A)->desc.lm1 ? (A)->desc.mb : (A)->desc.lm%(A)->desc.mb )

Definition at line 35 of file descriptor.h.


Function Documentation

int magma_desc_check ( magma_desc_t desc)

Check for descriptor correctness

Definition at line 88 of file descriptor.c.

References magma_desc_s::desc, MAGMA_ERR_ILLEGAL_VALUE, MAGMA_ERR_UNALLOCATED, magma_error, and MAGMA_SUCCESS.

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

Here is the caller graph for this function:

magma_desc_t magma_desc_init ( MAGMA_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 20 of file descriptor.c.

References magma_desc_s::desc, morse_desc_init(), and magma_desc_s::occurences.

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

Here is the call graph for this function:

Here is the caller graph for this function:

int magma_desc_mat_alloc ( magma_desc_t desc)

Definition at line 127 of file descriptor.c.

References magma_desc_s::desc, MAGMA_ERR_OUT_OF_RESOURCES, magma_error, MAGMA_SUCCESS, morse_desc_create(), and plasma_element_size().

{
size_t size;
size = (size_t)desc->desc.lm * (size_t)desc->desc.ln * (size_t)plasma_element_size(desc->desc.dtyp);
if ((desc->desc.mat = malloc(size)) == NULL) {
magma_error("magma_desc_mat_alloc", "malloc() failed");
}
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

int magma_desc_mat_free ( magma_desc_t desc)

Definition at line 145 of file descriptor.c.

References magma_desc_s::desc, MAGMA_SUCCESS, and morse_desc_destroy().

{
if (desc->desc.mat != NULL) {
free(desc->desc.mat);
desc->desc.mat = NULL;
}
return MAGMA_SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

magma_desc_t magma_desc_submatrix ( magma_desc_t  descA,
int  i,
int  j,
int  m,
int  n 
)

Internal static descriptor initializer for submatrices

Definition at line 62 of file descriptor.c.

References magma_desc_s::desc, and morse_desc_submatrix().

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

Here is the call graph for this function:

static void * magma_getaddr ( magma_desc_t descA,
int  m,
int  n 
)
inlinestatic

Internal function to return adress of block (m,n)

Definition at line 40 of file descriptor.h.

References A, magma_desc_s::desc, and plasma_element_size().

{
PLASMA_desc *A = &(descA->desc);
size_t mm = m+A->i/A->mb;
size_t nn = n+A->j/A->nb;
size_t eltsize = plasma_element_size(A->dtyp);
size_t offset = 0;
if (mm < A->lm1) {
if (nn < A->ln1)
offset = A->bsiz*(mm+A->lm1*nn);
else
offset = A->A12 + (A->mb*(A->ln%A->nb)*mm);
}
else {
if (nn < A->ln1)
offset = A->A21 + ((A->lm%A->mb)*A->nb*nn);
else
offset = A->A22;
}
return (void*)((intptr_t)A->mat + (offset*eltsize) );
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void * magma_geteltaddr ( const magma_desc_t descA,
int  m,
int  n,
int  eltsize 
)
inlinestatic

Internal routines

Internal function to return adress of element A(m,n)

Definition at line 67 of file descriptor.h.

References A, and magma_desc_s::desc.

{
const PLASMA_desc *A = &(descA->desc);
size_t mm = m/A->mb;
size_t nn = n/A->nb;
size_t offset = 0;
if (mm < A->lm1) {
if (nn < A->ln1)
offset = A->bsiz*(mm+A->lm1*nn) + m%A->mb + A->mb*(n%A->nb);
else
offset = A->A12 + (A->mb*(A->ln%A->nb)*mm) + m%A->mb + A->mb*(n%A->nb);
}
else {
if (nn < A->ln1)
offset = A->A21 + ((A->lm%A->mb)*A->nb*nn) + m%A->mb + (A->lm%A->mb)*(n%A->nb);
else
offset = A->A22 + m%A->mb + (A->lm%A->mb)*(n%A->nb);
}
return (void*)((intptr_t)A->mat + (offset*eltsize) );
}
int plasma_element_size ( int  type)

Here is the caller graph for this function: