BeBOP Optimized Sparse Kernel Interface Library  1.0.1h
Defines | Functions
mattypes.h File Reference

Matrix type management routines. More...

Go to the source code of this file.

Defines

#define INC_OSKI_MATTYPES_H
 oski/mattypes.h has been included.
#define OSKI_MATTYPE_ID(type)   oski_LookupMatTypeId((const char *)(type), OSKI_IND_ID, OSKI_VAL_ID)
 Lookup the id of a matrix type, assuming the current compile-time default scalar types (OSKI_IND_ID and OSKI_VAL_ID).

Functions

void oski_InitMatTypeManager (void)
 Initialize the matrix type manager.
void oski_CloseMatTypeManager (void)
 Shutdown the matrix type manager.
oski_id_t oski_RegisterMatType (const char *type_name, oski_id_t id_ind_type, oski_id_t id_val_type)
 Register a new matrix type, making it available to the entire library system.
oski_id_t oski_LookupMatTypeId (const char *type_name, oski_id_t id_ind_type, oski_id_t id_val_type)
 Lookup the id of a matrix type.

Method lookup.

Routines to assist in finding methods within a module that following the BeBOP shared library naming scheme, and obtaining their function pointers.

#define OSKI_MATTYPE_METHOD(type, name)
 Retrieve the method for a particular matrix type.
#define OSKI_MATTYPEID_METHOD(type_id, name)
 Retrieve the method for a particular matrix type given the matrix type id.
void * oski_LookupMatTypeMethod (const char *type_name, oski_id_t id_ind_type, oski_id_t id_val_type, const char *method_name)
 Lookup a method by raw matrix type information and method name.
void * oski_LookupMatTypeIdMethod (oski_id_t id, const char *method_name)
 Lookup a method by matrix type ID and method name.

Detailed Description

Matrix type management routines.

The library maintains internal tables of modules containing actual kernel implementations instantiated for particular matrix types. This module defines an interface for registering new matrix types and retrieving function pointers to registered kernel implementations.

See also:
Matrix Types
oski/scalinfo.h

Define Documentation

oski/mattypes.h has been included.

#define OSKI_MATTYPE_ID (   type)    oski_LookupMatTypeId((const char *)(type), OSKI_IND_ID, OSKI_VAL_ID)

Lookup the id of a matrix type, assuming the current compile-time default scalar types (OSKI_IND_ID and OSKI_VAL_ID).

The implementation is just a wrapper around a call to oski_LookupMatTypeId with the default scalar types OSKI_IND_ID and OSKI_VAL_ID.

Parameters:
[in]typeString type name (e.g., "CSR").

Referenced by oski_CreateLuaMatReprGeneric2IndexFromCSR(), oski_CreateLuaMatReprGenericFromCSR(), oski_CreateMatCSC_arr(), and oski_CreateMatCSR_arr().

#define OSKI_MATTYPE_METHOD (   type,
  name 
)
Value:

Retrieve the method for a particular matrix type.

Relies on the compile-time default scalar type macros, OSKI_IND_ID and OSKI_VAL_ID.

Parameters:
[in]typeMatrix type name, as a string.
[in]nameMethod base name (not as a string constant).
Returns:
A function pointer of the appropriate type, or NULL on error.

Referenced by CalcMatRepr1NormViaCSR(), CanBeExecuted(), ConvertCSRLeftoverRows(), DestroySubmatBCSR(), GetBCSREntryRaw(), MeasureStreamTimeCSR(), oski_ConditionallyExpandCSRToFull(), oski_ConvertMatReprToCSR(), oski_CopyMatRepr(), oski_CreateLuaMatReprGeneric2IndexFromCSR(), oski_CreateLuaMatReprGenericFromCSR(), oski_CreateMatCSC_arr(), oski_CreateMatCSR_arr(), oski_CreateMatReprFromCSR(), oski_DestroyMatRepr(), oski_MatReprMult(), oski_MatReprTrisolve(), oski_WrapCSC(), and SetBCSREntryRaw().

#define OSKI_MATTYPEID_METHOD (   type_id,
  name 
)
Value:

Retrieve the method for a particular matrix type given the matrix type id.

Parameters:
[in]type_idMatrix type, by ID.
[in]nameMethod base name (not as a string constant).
Returns:
A function pointer of the appropriate type, or NULL on error.

Referenced by CalcMatRepr1NormViaCSR(), CopyMatSpecific(), GetClique(), GetDiagValues(), GetMatEntry(), oski_CalcMat1Norm(), oski_DestroyMatStruct(), oski_FreeInputMatRepr(), oski_MatMult(), oski_MatMultAndMatTransMult(), oski_MatPowMult(), oski_MatTransMatMult(), oski_MatTrisolve(), oski_ReplaceTunedMatRepr(), SetClique(), SetDiagValues(), and SetMatEntry().


Function Documentation

void oski_CloseMatTypeManager ( void  )

Shutdown the matrix type manager.

Returns:
Destroys the list of available matrix types.
Postcondition:
g_avail_mattypes == NULL.

References oski_CloseMatTypeManager(), oski_GetNumMatTypes(), oski_PrintDebugMessage(), simplelist_Destroy(), and simplelist_GetElem().

Referenced by oski_Close(), and oski_CloseMatTypeManager().

void oski_InitMatTypeManager ( void  )

Initialize the matrix type manager.

Returns:
Initializes the list of available matrix types.
Todo:
Should call this routine during library initialization.

References oski_InitMatTypeManager(), oski_PrintDebugMessage(), and simplelist_Create().

Referenced by oski_Init(), and oski_InitMatTypeManager().

oski_id_t oski_LookupMatTypeId ( const char *  type_name,
oski_id_t  id_ind_type,
oski_id_t  id_val_type 
)

Lookup the id of a matrix type.

Parameters:
[in]type_nameString identifier of the general matrix type being sought.
[in]id_ind_typeInteger index type.
[in]id_val_typeNon-zero value type.
Returns:
Returns an id number that uniquely identifies the given matrix type, specialized using particular integer index and non-zero value types, if the type has been registered in the system. Otherwise, returns INVALID_ID.
See also:
oski_RegisterMatType

References tagBebop_mattype_t::id, tagBebop_mattype_t::id_index_type, tagBebop_mattype_t::id_value_type, INVALID_ID, tagBebop_mattype_t::name, oski_GetNumMatTypes(), oski_LookupMatTypeId(), and simplelist_GetElem().

Referenced by CheckArgs(), ConvertLuaMatToCSR(), oski_EstimateFillBCSR(), oski_HeurIsApplicable(), oski_LookupMatTypeId(), oski_LookupMatTypeMethod(), and oski_RegisterMatType().

oski_id_t oski_RegisterMatType ( const char *  type_name,
oski_id_t  id_ind_type,
oski_id_t  id_val_type 
)

Register a new matrix type, making it available to the entire library system.

Register a new matrix type, making it available to the entire library system.

Parameters:
[in]type_nameShort, unique string identifier. The name should match the regular expression, "[0-9a-zA-Z_]+".
[in]id_ind_typeInteger index type (see oski/scalinfo.h).
[in]id_val_typeNon-zero value type (see oski/scalinfo.h).
Returns:
A unique positive integer identifying this type, or INVALID_ID on error.
See also:
oski_LookupMatTypeId
Postcondition:
This routine creates a new registration record and fills in all of its fields, including loading its main shared library module.

References tagBebop_mattype_t::desc, tagBebop_mattype_t::id, tagBebop_mattype_t::id_index_type, tagBebop_mattype_t::id_value_type, INVALID_ID, tagBebop_mattype_t::modname, tagBebop_mattype_t::module, tagBebop_mattype_t::name, oski_DuplicateString(), oski_Free, oski_LoadModuleOptional(), oski_LookupMatTypeId(), oski_MakeModuleDesc(), oski_MakeModuleName(), oski_Malloc, oski_PrintDebugMessage(), oski_RegisterMatType(), and simplelist_Append().

Referenced by oski_LookupMatTypeMethod(), and oski_RegisterMatType().