WildRiver
Classes | Macros | Typedefs | Enumerations | Functions
wildriver.h File Reference

Top level C include for WildRiver. More...

#include <stdlib.h>
#include <stdint.h>
Include dependency graph for wildriver.h:

Go to the source code of this file.

Classes

struct  wildriver_matrix_handle
 
struct  wildriver_graph_handle
 
struct  wildriver_vector_handle
 

Macros

#define WILDRIVER_VER_MAJOR   1
 
#define WILDRIVER_VER_MINOR   0
 
#define WILDRIVER_VER_SUBMINOR   0
 
#define WILDRIVER_INDEX_TYPE   size_t
 
#define WILDRIVER_DIMENSION_TYPE   uint32_t
 
#define WILDRIVER_VALUE_TYPE   double
 

Typedefs

typedef WILDRIVER_INDEX_TYPE wildriver_ind_t
 
typedef WILDRIVER_DIMENSION_TYPE wildriver_dim_t
 
typedef WILDRIVER_VALUE_TYPE wildriver_val_t
 

Enumerations

enum  wildriver_format_t {
  WILDRIVER_FORMAT_AUTO, WILDRIVER_FORMAT_METIS, WILDRIVER_FORMAT_CHACO, WILDRIVER_FORMAT_GRAPH,
  WILDRIVER_FORMAT_MATRIXMARKET, WILDRIVER_FORMAT_CSR, WILDRIVER_FORMAT_BCSR, WILDRIVER_FORMAT_CLUTO,
  WILDRIVER_FORMAT_HMETIS, WILDRIVER_FORMAT_PATOH
}
 
enum  wildriver_mode_t { WILDRIVER_IN = 1, WILDRIVER_OUT = 2 }
 

Functions

wildriver_matrix_handlewildriver_open_matrix (char const *fname, int mode)
 Open a matrix for reading. The returned handle must be closed. More...
 
int wildriver_load_matrix (wildriver_matrix_handle *handle, wildriver_ind_t *rowptr, wildriver_dim_t *rowind, wildriver_val_t *rowval, double *progress)
 Load the matrix into the given memory locations. More...
 
int wildriver_save_matrix (wildriver_matrix_handle *handle, wildriver_ind_t const *rowptr, wildriver_dim_t const *rowind, wildriver_val_t const *rowval, double *progress)
 Save the matrix after setting nrows, ncols, and nnz in the handle. More...
 
void wildriver_close_matrix (wildriver_matrix_handle *handle)
 Close an open matrix. More...
 
wildriver_graph_handlewildriver_open_graph (char const *fname, int mode)
 Open a graph for reading. The returned handle must be closed. More...
 
int wildriver_load_graph (wildriver_graph_handle *handle, wildriver_ind_t *xadj, wildriver_dim_t *adjncy, wildriver_val_t *vwgt, wildriver_val_t *adjwgt, double *progress)
 Load the graph into the given memory locations. More...
 
void wildriver_close_graph (wildriver_graph_handle *handle)
 Close an open graph. More...
 
wildriver_vector_handlewildriver_open_vector (char const *fname, int mode)
 Open a vector for reading. The returned handle must be closed. More...
 
int wildriver_load_vector (wildriver_vector_handle *handle, wildriver_val_t *vals, double *progress)
 Load a vector into the given memory location. More...
 
int wildriver_save_vector (wildriver_vector_handle *handle, wildriver_val_t const *vals, double *progress)
 Save a vactor from the given memory location. More...
 
void wildriver_close_vector (wildriver_vector_handle *handle)
 Close an open vector. More...
 
int wildriver_read_matrix (char const *fname, wildriver_dim_t *r_nrows, wildriver_dim_t *r_ncols, wildriver_ind_t *r_nnz, wildriver_ind_t **r_rowptr, wildriver_dim_t **r_rowind, wildriver_val_t **r_rowval)
 Read a matrix from the given path into a CSR data-structure. More...
 
int wildriver_write_matrix (char const *fname, wildriver_dim_t nrows, wildriver_dim_t ncols, wildriver_ind_t nnz, wildriver_ind_t const *rowptr, wildriver_dim_t const *rowind, wildriver_val_t const *rowval)
 Write a matrix file to the given path from a CSR data-structure. More...
 
int wildriver_read_graph (char const *fname, wildriver_dim_t *r_nvtxs, wildriver_ind_t *r_nedges, int *r_nvwgts, int *r_ewgts, wildriver_ind_t **r_xadj, wildriver_dim_t **r_adjncy, wildriver_val_t **r_vwgt, wildriver_val_t **r_adjwgt)
 Read a graph from the given path into a CSR data-structure. More...
 
int wildriver_write_graph (char const *fname, wildriver_dim_t nvtxs, wildriver_ind_t nedges, int nvwgts, wildriver_ind_t const *xadj, wildriver_dim_t const *adjncy, wildriver_val_t const *vwgt, wildriver_val_t const *adjwgt)
 Write a graph to the given path from a CSR data-structure. More...
 

Detailed Description

Top level C include for WildRiver.

Author
Dominique LaSalle lasal.nosp@m.le@c.nosp@m.s.umn.nosp@m..edu Copyright 2015-2018
Version
1

Macro Definition Documentation

#define WILDRIVER_DIMENSION_TYPE   uint32_t
#define WILDRIVER_INDEX_TYPE   size_t
#define WILDRIVER_VALUE_TYPE   double
#define WILDRIVER_VER_MAJOR   1
#define WILDRIVER_VER_MINOR   0
#define WILDRIVER_VER_SUBMINOR   0

Typedef Documentation

Enumeration Type Documentation

Enumerator
WILDRIVER_FORMAT_AUTO 
WILDRIVER_FORMAT_METIS 
WILDRIVER_FORMAT_CHACO 
WILDRIVER_FORMAT_GRAPH 
WILDRIVER_FORMAT_MATRIXMARKET 
WILDRIVER_FORMAT_CSR 
WILDRIVER_FORMAT_BCSR 
WILDRIVER_FORMAT_CLUTO 
WILDRIVER_FORMAT_HMETIS 
WILDRIVER_FORMAT_PATOH 
Enumerator
WILDRIVER_IN 
WILDRIVER_OUT 

Function Documentation

void wildriver_close_graph ( wildriver_graph_handle handle)

Close an open graph.

Parameters
handleThe open graph.
void wildriver_close_matrix ( wildriver_matrix_handle handle)

Close an open matrix.

Parameters
handleThe open matrix.
void wildriver_close_vector ( wildriver_vector_handle handle)

Close an open vector.

Parameters
handleThe open vector.
int wildriver_load_graph ( wildriver_graph_handle handle,
wildriver_ind_t xadj,
wildriver_dim_t adjncy,
wildriver_val_t vwgt,
wildriver_val_t adjwgt,
double *  progress 
)

Load the graph into the given memory locations.

Parameters
handleThe pointer to the open graph.
xadjThe edge list pointer indicating where each vertex's edges start in the edge list.
adjncyThe edge list.
vwgtThe weight of each vertex.
adjwgtThe weight of each edge.
progressThe memory address to write progress updates to (can be null).
Returns
1 if the graph was read successfully, 0 otherwise.
int wildriver_load_matrix ( wildriver_matrix_handle handle,
wildriver_ind_t rowptr,
wildriver_dim_t rowind,
wildriver_val_t rowval,
double *  progress 
)

Load the matrix into the given memory locations.

Parameters
handleThe pointer to the open matrix.
rowptrThe the starting index for each row (must be of length nrows+1).
rowindThe column indices for entries in each row (must be of length nnz)).
rowvalThe value of the entries in each row (must be of length nnz).
progressA variable to update as the matrix is loaded (will start at 0 and go to 1.0 when the matrix is fully loaded). This may be null if progress tracking is not required.
Returns
1 on success, 0 if an error occurs while loading.
int wildriver_load_vector ( wildriver_vector_handle handle,
wildriver_val_t vals,
double *  progress 
)

Load a vector into the given memory location.

Parameters
handleThe handle of the open vector.
valsThe memory location to load the vector to.
progressA variable to update as the vector is loaded (will start at 0 and go to 1.0 when the vector is fully loaded). This may be null if progress tracking is not required.
Returns
1 on success, 0 if an error occurs while loading.
wildriver_graph_handle* wildriver_open_graph ( char const *  fname,
int  mode 
)

Open a graph for reading. The returned handle must be closed.

Parameters
fnameThe filename/path of the graph file.
modeThe mode to open the file in (WILDRIVER_IN or WILDRIVER_OUT).
Returns
A pointer to the open graph, or nullptr if there was an error.
wildriver_matrix_handle* wildriver_open_matrix ( char const *  fname,
int  mode 
)

Open a matrix for reading. The returned handle must be closed.

Parameters
fnameThe filename/path of the matrix file.
modeThe mode to open the file in (WILDRIVER_IN or WILDRIVER_OUT).
Returns
A pointer to the open matrix, or nullptr if there was an error.
wildriver_vector_handle* wildriver_open_vector ( char const *  fname,
int  mode 
)

Open a vector for reading. The returned handle must be closed.

Parameters
fnameThe filename/path of the vector file.
modeThe mode to open the file in (WILDRIVER_IN or WILDRIVER_OUT).
Returns
A pointer to the open vector, or nullptr if there was an error.
int wildriver_read_graph ( char const *  fname,
wildriver_dim_t r_nvtxs,
wildriver_ind_t r_nedges,
int *  r_nvwgts,
int *  r_ewgts,
wildriver_ind_t **  r_xadj,
wildriver_dim_t **  r_adjncy,
wildriver_val_t **  r_vwgt,
wildriver_val_t **  r_adjwgt 
)

Read a graph from the given path into a CSR data-structure.

Parameters
fnameThe filename/path of the graph file.
r_nvtxsThe number of vertices in the graph (output).
r_nedgesThe number of edges in the graph (output, optional).
r_nvwgtsThe number of vertex weights in the graph (output, optional).
r_ewgtsWhether or not edge weights are present in the graph file (output, optional).
r_xadjThe adjacency list pointer (output).
r_adjncyThe adjacency list (output).
r_vwgtThe vertex weights (output, optional).
r_adjwgtThe edge weights (output, optional).
Returns
1 on success, 0 otherwise.
int wildriver_read_matrix ( char const *  fname,
wildriver_dim_t r_nrows,
wildriver_dim_t r_ncols,
wildriver_ind_t r_nnz,
wildriver_ind_t **  r_rowptr,
wildriver_dim_t **  r_rowind,
wildriver_val_t **  r_rowval 
)

Read a matrix from the given path into a CSR data-structure.

Parameters
fnameThe filename/path of the matrix file.
r_nrowsThe number of rows in the matrix (output).
r_ncolsThe number of columns in the matrix (output).
r_nnzThe number of non-zeros in the matrix (output).
r_rowptrThe the starting index for each row (output).
r_rowindThe column indices for entries in each row (output).
r_rowvalThe value of the entries in each row (output).
Returns
1 on success, 0 otherwise.
int wildriver_save_matrix ( wildriver_matrix_handle handle,
wildriver_ind_t const *  rowptr,
wildriver_dim_t const *  rowind,
wildriver_val_t const *  rowval,
double *  progress 
)

Save the matrix after setting nrows, ncols, and nnz in the handle.

Parameters
handleThe pointer to the open matrix.
rowptrThe the starting index for each row (must be of length nrows+1).
rowindThe column indices for entries in each row (must be of length nnz)).
rowvalThe value of the entries in each row (must be of length nnz).
progressA variable to update as the matrix is saved (will start at 0 and go to 1.0 when the matrix is fully saved). This may be null if progress tracking is not required.
Returns
1 on success, 0 if an error occurs while saving.
int wildriver_save_vector ( wildriver_vector_handle handle,
wildriver_val_t const *  vals,
double *  progress 
)

Save a vactor from the given memory location.

Parameters
handleThe handle to the open vector.
valsThe memory location of the vector to write.
progressA variable to update as the vector is saved (will start at 0 and go to 1.0 when the vector is fully saved). This may be null if progress tracking is not required.
Returns
1 on success, 0 if an error occurs while saving.
int wildriver_write_graph ( char const *  fname,
wildriver_dim_t  nvtxs,
wildriver_ind_t  nedges,
int  nvwgts,
wildriver_ind_t const *  xadj,
wildriver_dim_t const *  adjncy,
wildriver_val_t const *  vwgt,
wildriver_val_t const *  adjwgt 
)

Write a graph to the given path from a CSR data-structure.

Parameters
fnameThe filename/path of the graph file.
nvtxsThe number of vertices in the graph.
nedgesThe number of edges in the graph.
nvwgtsThe number of vertex weights.
xadjThe adjacency list pointer.
adjncyThe adjacency list.
vwgtThe vertex weights.
adjwgtThe edge weights.
Returns
1 on success, 0 otherwise.
int wildriver_write_matrix ( char const *  fname,
wildriver_dim_t  nrows,
wildriver_dim_t  ncols,
wildriver_ind_t  nnz,
wildriver_ind_t const *  rowptr,
wildriver_dim_t const *  rowind,
wildriver_val_t const *  rowval 
)

Write a matrix file to the given path from a CSR data-structure.

Parameters
fnameThe filename/path of the matrix file.
nrowsThe number of rows in the matrix.
ncolsThe number of columns in the matrix.
nnzThe number of non-zeros in the matrix.
rowptrThe starting index for each row.
rowindThe column indices for entries in each row.
rowvalThe value of the entries in each row.
Returns
1 on success, 0 otherwise.