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
auxiliary.c File Reference
#include "common.h"
#include "auxiliary.h"
#include <stdio.h>
#include <stdlib.h>
Include dependency graph for auxiliary.c:

Go to the source code of this file.

Functions

void plasma_warning (const char *func_name, char *msg_text)
void plasma_error (const char *func_name, char *msg_text)
void plasma_fatal_error (const char *func_name, char *msg_text)
int plasma_element_size (int type)
void plasma_memcpy (void *dst, void *src, PLASMA_size size, int type)
void plasma_memzero (void *memptr, PLASMA_size size, int type)
void plasma_memset_int (int *mem, int size, int value)
int plasma_rank (plasma_context_t *plasma)
int plasma_tune (PLASMA_enum func, int M, int N, int NRHS)
int PLASMA_Version (int *ver_major, int *ver_minor, int *ver_micro)

Function Documentation

int plasma_element_size ( int  type)

Definition at line 95 of file auxiliary.c.

References PLASMA_ERR_ILLEGAL_VALUE, plasma_fatal_error(), PlasmaByte, PlasmaComplexDouble, PlasmaComplexFloat, PlasmaInteger, PlasmaRealDouble, and PlasmaRealFloat.

{
switch(type) {
case PlasmaByte: return 1;
case PlasmaInteger: return sizeof(int);
case PlasmaRealFloat: return sizeof(float);
case PlasmaRealDouble: return sizeof(double);
case PlasmaComplexFloat: return 2*sizeof(float);
case PlasmaComplexDouble: return 2*sizeof(double);
default: plasma_fatal_error("plasma_element_size", "undefined type");
}
}

Here is the call graph for this function:

Here is the caller graph for this function:

void plasma_error ( const char *  func_name,
char *  msg_text 
)

Indicates a recoverable problem. User's erroneous action with potentially severe consequences. Problems occuring due to incorrect use of PLASMA. Context aware.

Parameters:
[in]func_nameFunction location where warning occurred
[in]msg_textWarning message to display.

Definition at line 61 of file auxiliary.c.

References plasma_context_struct::errors_enabled, plasma_context_self(), and plasma_fatal_error().

{
plasma = plasma_context_self();
if (plasma == NULL)
plasma_fatal_error("plasma_error", "PLASMA not initialized");
if (plasma->errors_enabled)
fprintf(stderr, "PLASMA ERROR: %s(): %s\n", func_name, msg_text);
}

Here is the call graph for this function:

void plasma_fatal_error ( const char *  func_name,
char *  msg_text 
)

Unexpected behavior within the library. Unrecoverable user errors. Context oblivious.

Parameters:
[in]func_nameFunction location where warning occurred
[in]msg_textWarning message to display.

Definition at line 86 of file auxiliary.c.

{
fprintf(stderr, "PLASMA FATAL ERROR: %s(): %s\n", func_name, msg_text);
exit(0);
}
void plasma_memcpy ( void *  dst,
void *  src,
PLASMA_size  size,
int  type 
)

Definition at line 113 of file auxiliary.c.

References plasma_element_size().

{
memcpy(dst, src, size*plasma_element_size(type));
}

Here is the call graph for this function:

void plasma_memset_int ( int *  mem,
int  size,
int  value 
)

Definition at line 129 of file auxiliary.c.

{
int i;
for (i = 0; i < size; i++)
mem[i] = value;
}
void plasma_memzero ( void *  memptr,
PLASMA_size  size,
int  type 
)

Definition at line 121 of file auxiliary.c.

References plasma_element_size().

{
memset(memptr, 0, size*plasma_element_size(type));
}

Here is the call graph for this function:

Here is the caller graph for this function:

int plasma_rank ( plasma_context_t plasma)

Returns core id

Definition at line 140 of file auxiliary.c.

References PLASMA_ERR_NOT_FOUND, pthread_equal(), pthread_self(), plasma_context_struct::thread_id, and plasma_context_struct::world_size.

{
int rank;
pthread_t thread_id;
thread_id = pthread_self();
for (rank = 0; rank < plasma->world_size; rank++)
if (pthread_equal(plasma->thread_id[rank], thread_id))
return rank;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int plasma_tune ( PLASMA_enum  func,
int  M,
int  N,
int  NRHS 
)

Tune block size nb and internal block size ib

Definition at line 155 of file auxiliary.c.

References plasma_context_struct::autotuning_enabled, plasma_context_struct::ib, plasma_context_struct::ibnbsize, plasma_context_struct::nb, plasma_context_struct::nbnbsize, plasma_context_self(), PLASMA_ERR_ILLEGAL_VALUE, PLASMA_ERR_NOT_INITIALIZED, plasma_fatal_error(), PLASMA_FUNC_CGEBRD, PLASMA_FUNC_CGEEV, PLASMA_FUNC_CGEHRD, PLASMA_FUNC_CGELS, PLASMA_FUNC_CGEMM, PLASMA_FUNC_CGESV, PLASMA_FUNC_CGESVD, PLASMA_FUNC_CHEEV, PLASMA_FUNC_CHEGST, PLASMA_FUNC_CHEGV, PLASMA_FUNC_CHEMM, PLASMA_FUNC_CHERK, PLASMA_FUNC_CHETRD, PLASMA_FUNC_CPOSV, PLASMA_FUNC_CSYMM, PLASMA_FUNC_CSYRK, PLASMA_FUNC_DGEBRD, PLASMA_FUNC_DGEEV, PLASMA_FUNC_DGEHRD, PLASMA_FUNC_DGELS, PLASMA_FUNC_DGEMM, PLASMA_FUNC_DGESV, PLASMA_FUNC_DGESVD, PLASMA_FUNC_DPOSV, PLASMA_FUNC_DSGELS, PLASMA_FUNC_DSGESV, PLASMA_FUNC_DSPOSV, PLASMA_FUNC_DSYEV, PLASMA_FUNC_DSYGST, PLASMA_FUNC_DSYGV, PLASMA_FUNC_DSYMM, PLASMA_FUNC_DSYRK, PLASMA_FUNC_DSYTRD, PLASMA_FUNC_SGEBRD, PLASMA_FUNC_SGEEV, PLASMA_FUNC_SGEHRD, PLASMA_FUNC_SGELS, PLASMA_FUNC_SGEMM, PLASMA_FUNC_SGESV, PLASMA_FUNC_SGESVD, PLASMA_FUNC_SPOSV, PLASMA_FUNC_SSYEV, PLASMA_FUNC_SSYGST, PLASMA_FUNC_SSYGV, PLASMA_FUNC_SSYMM, PLASMA_FUNC_SSYRK, PLASMA_FUNC_SSYTRD, PLASMA_FUNC_ZCGELS, PLASMA_FUNC_ZCGESV, PLASMA_FUNC_ZCPOSV, PLASMA_FUNC_ZGEBRD, PLASMA_FUNC_ZGEEV, PLASMA_FUNC_ZGEHRD, PLASMA_FUNC_ZGELS, PLASMA_FUNC_ZGEMM, PLASMA_FUNC_ZGESV, PLASMA_FUNC_ZGESVD, PLASMA_FUNC_ZHEEV, PLASMA_FUNC_ZHEGST, PLASMA_FUNC_ZHEGV, PLASMA_FUNC_ZHEMM, PLASMA_FUNC_ZHERK, PLASMA_FUNC_ZHETRD, PLASMA_FUNC_ZPOSV, PLASMA_FUNC_ZSYMM, PLASMA_FUNC_ZSYRK, and PLASMA_SUCCESS.

{
plasma = plasma_context_self();
if (plasma == NULL) {
plasma_fatal_error("plasma_tune", "PLASMA not initialized");
}
if (!plasma->autotuning_enabled)
switch (func) {
plasma->nb = 120;
plasma->ib = 120; // not used in GEMM
break;
plasma->nb = 120;
plasma->ib = 120; // not used in Cholesky
break;
plasma->nb = 144;
plasma->ib = 48;
break;
plasma->nb = 200;
plasma->ib = 40;
break;
plasma->nb = 120;
plasma->ib = 20;
break;
plasma->nb = 120;
plasma->ib = 20;
break;
plasma->nb = 120;
plasma->ib = 20;
break;
default:
plasma_fatal_error("plasma_tune", "illegal parameter value");
}
/* Calculate A, B tile size and round up to cache line size */
/* round up for the smallest type (float) - will hold for all */
plasma->nbnbsize = plasma->nb * plasma->nb; // * sizeof(float);
// plasma->nbnbsize = roundup(plasma->nbnbsize, CACHE_LINE_SIZE);
// plasma->nbnbsize /= sizeof(float);
/* Calculate T, L tile size and round up to cache line size */
/* round up for the smallest type (float) - will hold for all */
plasma->ibnbsize = plasma->ib * plasma->nb; // * sizeof(float);
// plasma->ibnbsize = roundup(plasma->ibnbsize, CACHE_LINE_SIZE);
// plasma->ibnbsize /= sizeof(float);
}

Here is the call graph for this function:

int PLASMA_Version ( int *  ver_major,
int *  ver_minor,
int *  ver_micro 
)

PLASMA_Version - Reports PLASMA version number.

Parameters:
[out]ver_majorPLASMA major version number.
[out]ver_minorPLASMA minor version number.
[out]ver_microPLASMA micro version number.
Returns:
Return values:
PLASMA_SUCCESSsuccessful exit

Definition at line 296 of file auxiliary.c.

References PLASMA_ERR_ILLEGAL_VALUE, PLASMA_SUCCESS, PLASMA_VERSION_MAJOR, PLASMA_VERSION_MICRO, and PLASMA_VERSION_MINOR.

{
if (! ver_major && ! ver_minor && ! ver_micro)
if (ver_major)
*ver_major = PLASMA_VERSION_MAJOR;
if (ver_minor)
*ver_minor = PLASMA_VERSION_MINOR;
if (ver_micro)
*ver_micro = PLASMA_VERSION_MICRO;
}
void plasma_warning ( const char *  func_name,
char *  msg_text 
)

Indicates a recoverable problem. User's erroneous action without severe consequences. Problems occuring while PLASMA is being used correctly. Context aware.

Parameters:
[in]func_nameFunction location where warning occurred
[in]msg_textWarning message to display.

Definition at line 36 of file auxiliary.c.

References plasma_context_self(), plasma_fatal_error(), and plasma_context_struct::warnings_enabled.

{
plasma = plasma_context_self();
if (plasma == NULL)
plasma_fatal_error("plasma_warning", "PLASMA not initialized");
if (plasma->warnings_enabled)
fprintf(stderr, "PLASMA WARNING: %s(): %s\n", func_name, msg_text);
}

Here is the call graph for this function:

Here is the caller graph for this function: