Skylark (Sketching Library)  0.1
Defines | Typedefs | Functions
/var/lib/jenkins/jobs/Skylark/workspace/sketch/capi/capi.cpp File Reference
#include "boost/property_tree/ptree.hpp"
#include "sketchc.hpp"
#include "../../base/exception.hpp"
#include "../../base/sparse_matrix.hpp"
#include "CombBLAS.h"
#include "SpParMat.h"
#include "SpParVec.h"
#include "DenseParVec.h"
Include dependency graph for capi.cpp:

Go to the source code of this file.

Defines

#define STRCMP_TYPE(STR, TYPE)
#define QUOTE(x)   #x
#define SKDEF(t, i, o)   "(\"" QUOTE(t) "\",\"" QUOTE(i) "\",\"" QUOTE(o) "\") "
#define AUTO_NEW_DISPATCH(T, C)
#define AUTO_NEW_DISPATCH_1P(T, C)
#define AUTO_DELETE_DISPATCH(T, C)
#define AUTO_APPLY_DISPATCH(T, I, O, C, IT, OT, CD)

Typedefs

typedef elem::Matrix< double > Matrix
typedef elem::DistMatrix
< double, elem::STAR,
elem::STAR > 
SharedMatrix
typedef elem::DistMatrix
< double, elem::CIRC,
elem::CIRC > 
RootMatrix
typedef elem::DistMatrix< double > DistMatrix
typedef elem::DistMatrix
< double, elem::VR, elem::STAR > 
DistMatrix_VR_STAR
typedef elem::DistMatrix
< double, elem::VC, elem::STAR > 
DistMatrix_VC_STAR
typedef elem::DistMatrix
< double, elem::STAR, elem::VR > 
DistMatrix_STAR_VR
typedef elem::DistMatrix
< double, elem::STAR, elem::VC > 
DistMatrix_STAR_VC
typedef base::sparse_matrix_t
< double > 
SparseMatrix
typedef SpDCCols< size_t, double > col_t
typedef SpParMat< size_t,
double, col_t
DistSparseMatrix

Functions

SKYLARK_EXTERN_API char * sl_supported_sketch_transforms ()
SKYLARK_EXTERN_API const char * sl_strerror (const int error_code)
SKYLARK_EXTERN_API bool sl_has_elemental ()
SKYLARK_EXTERN_API bool sl_has_combblas ()
SKYLARK_EXTERN_API int sl_create_default_context (int seed, base::context_t **ctxt)
SKYLARK_EXTERN_API int sl_create_context (int seed, MPI_Comm comm, base::context_t **ctxt)
SKYLARK_EXTERN_API int sl_free_context (base::context_t *ctxt)
SKYLARK_EXTERN_API int sl_create_sketch_transform (base::context_t *ctxt, char *type_, int n, int s, sketchc::sketch_transform_t **sketch,...)
SKYLARK_EXTERN_API int sl_deserialize_sketch_transform (const char *data, sketchc::sketch_transform_t **sketch)
SKYLARK_EXTERN_API int sl_serialize_sketch_transform (const sketchc::sketch_transform_t *sketch, char **data)
SKYLARK_EXTERN_API int sl_free_sketch_transform (sketchc::sketch_transform_t *S)
SKYLARK_EXTERN_API int sl_apply_sketch_transform (sketchc::sketch_transform_t *S_, char *input_, void *A_, char *output_, void *SA_, int dim)
SKYLARK_EXTERN_API int sl_wrap_raw_matrix (double *data, int m, int n, void **A)
SKYLARK_EXTERN_API int sl_free_raw_matrix_wrap (void *A_)
SKYLARK_EXTERN_API int sl_wrap_raw_sp_matrix (int *indptr, int *ind, double *data, int nnz, int n_rows, int n_cols, void **A)
SKYLARK_EXTERN_API int sl_free_raw_sp_matrix_wrap (void *A_)
SKYLARK_EXTERN_API int sl_raw_sp_matrix_struct_updated (void *A_, bool *struct_updated)
SKYLARK_EXTERN_API int sl_raw_sp_matrix_reset_update_flag (void *A_)
SKYLARK_EXTERN_API int sl_raw_sp_matrix_nnz (void *A_, int *nnz)
SKYLARK_EXTERN_API int sl_raw_sp_matrix_data (void *A_, int32_t *indptr, int32_t *indices, double *values)

Define Documentation

#define AUTO_APPLY_DISPATCH (   T,
  I,
  O,
  C,
  IT,
  OT,
  CD 
)
Value:
if (type == T && input == I && output == O) {                        \
        C<IT, OT> S(*static_cast<CD*>(S_->transform_obj));               \
        IT &A = * static_cast<IT*>(A_);                                  \
        OT &SA = * static_cast<OT*>(SA_);                                \
                                                                         \
        SKYLARK_BEGIN_TRY()                                              \
            if (dim == SL_COLUMNWISE)                                    \
                S.apply(A, SA, sketch::columnwise_tag());                \
            if (dim == SL_ROWWISE)                                       \
            S.apply(A, SA, sketch::rowwise_tag());                       \
        SKYLARK_END_TRY()                                                \
        SKYLARK_CATCH_AND_RETURN_ERROR_CODE();                           \
    }

Referenced by sl_apply_sketch_transform().

#define AUTO_DELETE_DISPATCH (   T,
 
)
Value:
SKYLARK_BEGIN_TRY()                                         \
        if (type == T)                                          \
            delete static_cast<C *>(S->transform_obj);          \
    SKYLARK_END_TRY()                                           \
    SKYLARK_CATCH_AND_RETURN_ERROR_CODE();

Referenced by sl_free_sketch_transform().

#define AUTO_NEW_DISPATCH (   T,
 
)
Value:
SKYLARK_BEGIN_TRY()                                             \
        if (type == T)                                              \
            *sketch = new sketchc::sketch_transform_t(type,         \
                          new C(n, s, *ctxt));                      \
    SKYLARK_END_TRY()                                               \
    SKYLARK_CATCH_AND_RETURN_ERROR_CODE();

Referenced by sl_create_sketch_transform().

#define AUTO_NEW_DISPATCH_1P (   T,
 
)
Value:
SKYLARK_BEGIN_TRY()                                              \
        if (type == T)  {                                            \
            va_list argp;                                            \
            va_start(argp, sketch);                                  \
            double p1 = va_arg(argp, double);                        \
            sketchc::sketch_transform_t *r =                         \
                new sketchc::sketch_transform_t(type,                \
                    new C(n, s, p1, *ctxt));                         \
            va_end(argp);                                            \
            *sketch = r;                                             \
        }                                                            \
    SKYLARK_END_TRY()                                                \
    SKYLARK_CATCH_AND_RETURN_ERROR_CODE();

Referenced by sl_create_sketch_transform().

#define QUOTE (   x)    #x
#define SKDEF (   t,
  i,
 
)    "(\"" QUOTE(t) "\",\"" QUOTE(i) "\",\"" QUOTE(o) "\") "
#define STRCMP_TYPE (   STR,
  TYPE 
)
Value:
if (std::strcmp(str, #STR) == 0) \
        return TYPE;

Definition at line 14 of file capi.cpp.


Typedef Documentation

typedef SpDCCols< size_t, double > col_t

Definition at line 62 of file capi.cpp.

typedef elem::DistMatrix<double> DistMatrix

Definition at line 54 of file capi.cpp.

typedef elem::DistMatrix<double, elem::STAR, elem::VC> DistMatrix_STAR_VC

Definition at line 58 of file capi.cpp.

typedef elem::DistMatrix<double, elem::STAR, elem::VR> DistMatrix_STAR_VR

Definition at line 57 of file capi.cpp.

typedef elem::DistMatrix<double, elem::VC, elem::STAR> DistMatrix_VC_STAR

Definition at line 56 of file capi.cpp.

typedef elem::DistMatrix<double, elem::VR, elem::STAR> DistMatrix_VR_STAR

Definition at line 55 of file capi.cpp.

typedef SpParMat< size_t, double, col_t > DistSparseMatrix

Definition at line 63 of file capi.cpp.

typedef elem::Matrix<double> Matrix

Definition at line 51 of file capi.cpp.

typedef elem::DistMatrix<double, elem::CIRC, elem::CIRC> RootMatrix

Definition at line 53 of file capi.cpp.

typedef elem::DistMatrix<double, elem::STAR, elem::STAR> SharedMatrix

Definition at line 52 of file capi.cpp.

Definition at line 60 of file capi.cpp.


Function Documentation

SKYLARK_EXTERN_API int sl_apply_sketch_transform ( sketchc::sketch_transform_t S,
char *  input_type,
void *  A,
char *  output_type,
void *  SA,
int  dim 
)
SKYLARK_EXTERN_API int sl_create_context ( int  seed,
MPI_Comm  cm,
base::context_t **  ctxt 
)

Creating a Skylark context required for applying sketches.

Parameters:
seedfor the rng generator
cmMPI communicator used
Returns:
a Skylark context

Definition at line 201 of file capi.cpp.

References SKYLARK_BEGIN_TRY, SKYLARK_CATCH_AND_RETURN_ERROR_CODE, and SKYLARK_END_TRY.

SKYLARK_EXTERN_API int sl_create_default_context ( int  seed,
base::context_t **  ctxt 
)
SKYLARK_EXTERN_API int sl_create_sketch_transform ( base::context_t ctxt,
char *  type_,
int  n,
int  s,
sketchc::sketch_transform_t **  sketch,
  ... 
)
SKYLARK_EXTERN_API int sl_deserialize_sketch_transform ( const char *  data,
sketchc::sketch_transform_t **  sketch 
)

Deserialize a sketch transformation.

Parameters:
datastring of serialized JSON structure
sketchthe deserialized sketch transformation

Definition at line 278 of file capi.cpp.

References skylark::sketch::sketch_transform_data_t::from_ptree(), and skylark::sketch::sketch_transform_data_t::get_type().

Here is the call graph for this function:

SKYLARK_EXTERN_API int sl_free_context ( base::context_t ctxt)

Free resources hold by a Skylark context.

Parameters:
ctxtSkylark context

Definition at line 210 of file capi.cpp.

References SKYLARK_BEGIN_TRY, SKYLARK_CATCH_AND_RETURN_ERROR_CODE, and SKYLARK_END_TRY.

SKYLARK_EXTERN_API int sl_free_raw_matrix_wrap ( void *  A_)

Definition at line 726 of file capi.cpp.

SKYLARK_EXTERN_API int sl_free_raw_sp_matrix_wrap ( void *  A_)

Definition at line 745 of file capi.cpp.

SKYLARK_EXTERN_API int sl_free_sketch_transform ( sketchc::sketch_transform_t S)
SKYLARK_EXTERN_API bool sl_has_combblas ( )

Definition at line 183 of file capi.cpp.

SKYLARK_EXTERN_API bool sl_has_elemental ( )

Provide mechanism to check for add-ons.

Returns:
a boolean if the add-on library is enabled

Definition at line 175 of file capi.cpp.

SKYLARK_EXTERN_API int sl_raw_sp_matrix_data ( void *  A_,
int32_t *  indptr,
int32_t *  indices,
double *  values 
)

Definition at line 766 of file capi.cpp.

SKYLARK_EXTERN_API int sl_raw_sp_matrix_nnz ( void *  A_,
int *  nnz 
)

Definition at line 761 of file capi.cpp.

SKYLARK_EXTERN_API int sl_raw_sp_matrix_reset_update_flag ( void *  A_)

Definition at line 756 of file capi.cpp.

SKYLARK_EXTERN_API int sl_raw_sp_matrix_struct_updated ( void *  A_,
bool *  struct_updated 
)

Definition at line 750 of file capi.cpp.

SKYLARK_EXTERN_API int sl_serialize_sketch_transform ( const sketchc::sketch_transform_t sketch,
char **  data 
)

Serializes a sketch transformation.

Parameters:
sketchthe sketch to be serialized
dataof the serialized JSON structure

Definition at line 294 of file capi.cpp.

References skylark::sketch::sketch_transform_data_t::to_ptree(), and skylark::sketch::c::sketch_transform_t::transform_obj.

Here is the call graph for this function:

SKYLARK_EXTERN_API const char* sl_strerror ( const int  errorcode)

Converting an error code to a human readable string describing the failure

Parameters:
errorcodethe error code to resolve
Returns:
a string containing the error message

Definition at line 171 of file capi.cpp.

References skylark_strerror().

Here is the call graph for this function:

SKYLARK_EXTERN_API char* sl_supported_sketch_transforms ( )
SKYLARK_EXTERN_API int sl_wrap_raw_matrix ( double *  data,
int  m,
int  n,
void **  A 
)

Definition at line 713 of file capi.cpp.

SKYLARK_EXTERN_API int sl_wrap_raw_sp_matrix ( int *  indptr,
int *  ind,
double *  data,
int  nnz,
int  n_rows,
int  n_cols,
void **  A 
)

Definition at line 736 of file capi.cpp.

References skylark::base::sparse_matrix_t< ValueType >::attach().

Here is the call graph for this function: