Skylark (Sketching Library)
0.1
|
#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"
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 AUTO_APPLY_DISPATCH | ( | T, | |
I, | |||
O, | |||
C, | |||
IT, | |||
OT, | |||
CD | |||
) |
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, | |
C | |||
) |
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, | |
C | |||
) |
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, | |
C | |||
) |
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 |
Referenced by sl_supported_sketch_transforms().
#define STRCMP_TYPE | ( | STR, | |
TYPE | |||
) |
typedef elem::DistMatrix<double> DistMatrix |
typedef elem::DistMatrix<double, elem::STAR, elem::VC> DistMatrix_STAR_VC |
typedef elem::DistMatrix<double, elem::STAR, elem::VR> DistMatrix_STAR_VR |
typedef elem::DistMatrix<double, elem::VC, elem::STAR> DistMatrix_VC_STAR |
typedef elem::DistMatrix<double, elem::VR, elem::STAR> DistMatrix_VR_STAR |
typedef SpParMat< size_t, double, col_t > DistSparseMatrix |
typedef elem::Matrix<double> Matrix |
typedef elem::DistMatrix<double, elem::CIRC, elem::CIRC> RootMatrix |
typedef elem::DistMatrix<double, elem::STAR, elem::STAR> SharedMatrix |
typedef base::sparse_matrix_t<double> SparseMatrix |
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 | ||
) |
Apply the sketch transformation to a matrix.
S | sketch transform |
input_type | input matrix type |
A | input matrix |
output_type | output matrix type |
SA | sketched matrix |
dim | dimension on which to sketch (SL_COLUMNWISE/ROWWISE) |
Definition at line 336 of file capi.cpp.
References AUTO_APPLY_DISPATCH, skylark::sketch::c::CT, skylark::sketch::c::CWT, skylark::sketch::c::DIST_MATRIX, skylark::sketch::c::DIST_MATRIX_STAR_VC, skylark::sketch::c::DIST_MATRIX_STAR_VR, skylark::sketch::c::DIST_MATRIX_VC_STAR, skylark::sketch::c::DIST_MATRIX_VR_STAR, skylark::sketch::c::DIST_SPARSE_MATRIX, skylark::sketch::c::ExpSemigroupRLT, skylark::sketch::c::FastGaussianRFT, skylark::sketch::c::FJLT, skylark::sketch::c::GaussianRFT, skylark::sketch::c::JLT, skylark::sketch::c::LaplacianRFT, skylark::sketch::c::MATRIX, skylark::sketch::c::MMT, skylark::sketch::c::PPT, skylark::sketch::c::SPARSE_MATRIX, skylark::sketch::c::sketch_transform_t::type, and skylark::sketch::c::WZT.
SKYLARK_EXTERN_API int sl_create_context | ( | int | seed, |
MPI_Comm | cm, | ||
base::context_t ** | ctxt | ||
) |
Creating a Skylark context required for applying sketches.
seed | for the rng generator |
cm | MPI communicator used |
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 | ||
) |
Support for skylark::base::context_t.
Definition at line 192 of file capi.cpp.
References SKYLARK_BEGIN_TRY, SKYLARK_CATCH_AND_RETURN_ERROR_CODE, and SKYLARK_END_TRY.
SKYLARK_EXTERN_API int sl_create_sketch_transform | ( | base::context_t * | ctxt, |
char * | type_, | ||
int | n, | ||
int | s, | ||
sketchc::sketch_transform_t ** | sketch, | ||
... | |||
) |
Transforms
Definition at line 219 of file capi.cpp.
References AUTO_NEW_DISPATCH, AUTO_NEW_DISPATCH_1P, skylark::sketch::c::CT, skylark::sketch::c::CWT, skylark::sketch::c::ExpSemigroupRLT, skylark::sketch::c::FastGaussianRFT, skylark::sketch::c::FJLT, skylark::sketch::c::GaussianRFT, skylark::sketch::c::JLT, skylark::sketch::c::LaplacianRFT, skylark::sketch::c::MMT, skylark::sketch::c::PPT, SKYLARK_BEGIN_TRY, SKYLARK_CATCH_AND_RETURN_ERROR_CODE, SKYLARK_END_TRY, and skylark::sketch::c::WZT.
SKYLARK_EXTERN_API int sl_deserialize_sketch_transform | ( | const char * | data, |
sketchc::sketch_transform_t ** | sketch | ||
) |
Deserialize a sketch transformation.
data | string of serialized JSON structure |
sketch | the 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().
SKYLARK_EXTERN_API int sl_free_context | ( | base::context_t * | ctxt | ) |
Free resources hold by a Skylark context.
ctxt | Skylark 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_ | ) |
SKYLARK_EXTERN_API int sl_free_raw_sp_matrix_wrap | ( | void * | A_ | ) |
SKYLARK_EXTERN_API int sl_free_sketch_transform | ( | sketchc::sketch_transform_t * | S | ) |
Free resources hold by a sketch transformation.
S | sketch transform |
Definition at line 307 of file capi.cpp.
References AUTO_DELETE_DISPATCH, skylark::sketch::c::CT, skylark::sketch::c::CWT, skylark::sketch::c::ExpSemigroupRLT, skylark::sketch::c::FastGaussianRFT, skylark::sketch::c::FJLT, skylark::sketch::c::GaussianRFT, skylark::sketch::c::JLT, skylark::sketch::c::LaplacianRFT, skylark::sketch::c::MMT, skylark::sketch::c::PPT, skylark::sketch::c::sketch_transform_t::type, and skylark::sketch::c::WZT.
SKYLARK_EXTERN_API bool sl_has_combblas | ( | ) |
SKYLARK_EXTERN_API bool sl_has_elemental | ( | ) |
SKYLARK_EXTERN_API int sl_raw_sp_matrix_data | ( | void * | A_, |
int32_t * | indptr, | ||
int32_t * | indices, | ||
double * | values | ||
) |
SKYLARK_EXTERN_API int sl_raw_sp_matrix_nnz | ( | void * | A_, |
int * | nnz | ||
) |
SKYLARK_EXTERN_API int sl_raw_sp_matrix_reset_update_flag | ( | void * | A_ | ) |
SKYLARK_EXTERN_API int sl_raw_sp_matrix_struct_updated | ( | void * | A_, |
bool * | struct_updated | ||
) |
SKYLARK_EXTERN_API int sl_serialize_sketch_transform | ( | const sketchc::sketch_transform_t * | sketch, |
char ** | data | ||
) |
Serializes a sketch transformation.
sketch | the sketch to be serialized |
data | of 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.
SKYLARK_EXTERN_API const char* sl_strerror | ( | const int | errorcode | ) |
Converting an error code to a human readable string describing the failure
errorcode | the error code to resolve |
Definition at line 171 of file capi.cpp.
References skylark_strerror().
SKYLARK_EXTERN_API char* sl_supported_sketch_transforms | ( | ) |
Return string defining what is supported
Definition at line 70 of file capi.cpp.
References skylark::sketch::c::CT, skylark::sketch::c::CWT, skylark::sketch::c::ExpSemigroupRLT, skylark::sketch::c::FastGaussianRFT, skylark::sketch::c::FJLT, skylark::sketch::c::GaussianRFT, skylark::sketch::c::JLT, skylark::sketch::c::LaplacianRFT, skylark::sketch::c::MMT, skylark::sketch::c::PPT, SKDEF, and skylark::sketch::c::WZT.
SKYLARK_EXTERN_API int sl_wrap_raw_matrix | ( | double * | data, |
int | m, | ||
int | n, | ||
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 | ||
) |
Definition at line 736 of file capi.cpp.
References skylark::base::sparse_matrix_t< ValueType >::attach().