COMBINATORIAL_BLAS 1.6
 
Loading...
Searching...
No Matches
common.h
Go to the documentation of this file.
1/* Copyright (C) 2010 The Trustees of Indiana University. */
2/* */
3/* Use, modification and distribution is subject to the Boost Software */
4/* License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at */
5/* http://www.boost.org/LICENSE_1_0.txt) */
6/* */
7/* Authors: Jeremiah Willcock */
8/* Andrew Lumsdaine */
9
10#ifndef COMMON_H
11#define COMMON_H
12
13#include <stdint.h>
14#include <stddef.h>
15
16#define INT64_T_MPI_TYPE MPI_LONG_LONG
17
18#define SIZE_MUST_BE_A_POWER_OF_TWO
19
20extern int rank, size;
21#ifdef SIZE_MUST_BE_A_POWER_OF_TWO
23#endif
24
25/* Distribute edges by their endpoints (make two directed copies of each input
26 * undirected edge); distribution is 1-d and cyclic. */
27#ifdef SIZE_MUST_BE_A_POWER_OF_TWO
28#define MOD_SIZE(v) ((v) & size_minus_one)
29#define DIV_SIZE(v) ((v) >> lgsize)
30#else
31#define MOD_SIZE(v) ((v) % size)
32#define DIV_SIZE(v) ((v) / size)
33#endif
34#define VERTEX_OWNER(v) ((int)(MOD_SIZE(v)))
35#define VERTEX_LOCAL(v) ((size_t)(DIV_SIZE(v)))
36#define VERTEX_TO_GLOBAL(i) ((int64_t)((i) * size + rank))
37
45
46#ifdef __cplusplus
47extern "C" {
48#endif
49
50void setup_globals(void); /* In utils.c */
51void free_csr_graph(csr_graph* const g); /* In utils.c */
52void* xMPI_Alloc_mem(size_t nbytes); /* In utils.c */
53void* xmalloc(size_t nbytes); /* In utils.c */
54void* xcalloc(size_t n, size_t unit); /* In utils.c */
55void* xrealloc(void* p, size_t nbytes); /* In utils.c */
56
57void convert_graph_to_csr(const int64_t nedges, const int64_t* const edges, csr_graph* const g); /* In convert_to_csr.c */
58void find_bfs_roots(int *num_bfs_roots, const csr_graph* const g, const uint64_t seed1, const uint64_t seed2, int64_t* const bfs_roots); /* In find_roots.c */
59int validate_bfs_result(const csr_graph* const g, const int64_t root, const int64_t* const pred, const int64_t nvisited); /* In validate.c */
60
61void run_mpi_bfs(const csr_graph* const g, int64_t root, int64_t* pred, int64_t* nvisited); /* Provided by user */
62
63#ifdef __cplusplus
64}
65#endif
66
67#endif /* COMMON_H */
void * xMPI_Alloc_mem(size_t nbytes)
int size
Definition common.h:20
void * xrealloc(void *p, size_t nbytes)
void find_bfs_roots(int *num_bfs_roots, const csr_graph *const g, const uint64_t seed1, const uint64_t seed2, int64_t *const bfs_roots)
int rank
void * xcalloc(size_t n, size_t unit)
void * xmalloc(size_t nbytes)
int size_minus_one
Definition common.h:22
void run_mpi_bfs(const csr_graph *const g, int64_t root, int64_t *pred, int64_t *nvisited)
int lgsize
void setup_globals(void)
int validate_bfs_result(const csr_graph *const g, const int64_t root, const int64_t *const pred, const int64_t nvisited)
void convert_graph_to_csr(const int64_t nedges, const int64_t *const edges, csr_graph *const g)
void free_csr_graph(csr_graph *const g)
long int64_t
Definition compat.h:21
unsigned __int64 uint64_t
Definition stdint.h:90
int64_t * column
Definition common.h:43
size_t nlocalverts
Definition common.h:39
size_t * rowstarts
Definition common.h:42
int64_t nglobalverts
Definition common.h:41
size_t nlocaledges
Definition common.h:40