COMBINATORIAL_BLAS  1.6
graph_generator.h
Go to the documentation of this file.
1 /* Copyright (C) 2009-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 GRAPH_GENERATOR_H
11 #define GRAPH_GENERATOR_H
12 
13 #include <stdlib.h>
14 #include <stdint.h>
15 #include <stdio.h>
16 
17 #ifndef __STDC_FORMAT_MACROS
18 #define __STDC_FORMAT_MACROS
19 #endif
20 #include <inttypes.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
26 /* Settings for user modification ----------------------------------- */
27 
28 #ifndef MODIFY_PARAMS_AT_EACH_LEVEL
29 /* Add noise into each subblock's Kronecker parameters (as is done in SSCA #2,
30  * but here the same mutation is used for all edges within a block) */
31 /* #define MODIFY_PARAMS_AT_EACH_LEVEL */
32 #endif
33 
34 #define INT64_T_MPI_TYPE MPI_LONG_LONG /* Should be MPI_INT64_T */
35 
36 /* End of user settings ----------------------------------- */
37 
38 /* Graph generator #define settings -- set with benchmark configuration, but
39  * should not be changed by individual runners of the benchmark (other than
40  * GRAPHGEN_DISTRIBUTED_MEMORY). */
41 
42 #ifndef GRAPHGEN_SETTINGS_DEFINED
43 #define GRAPHGEN_SETTINGS_DEFINED
44 
45 /* Define if output array is local to each rank (and the output array pointer
46  * points to the beginning of the local part) instead of being global (i.e.,
47  * having the output array pointer pointing to the same place on all ranks); in
48  * either case, the output array is still broken into independent pieces). */
49 /* #define GRAPHGEN_DISTRIBUTED_MEMORY -- Set this in your Makefile */
50 
51 /* Define if Kronecker parameters should be modified within each sub-block of
52  * the adjacency matrix (like SSCA #2 does). */
53 /* #define GRAPHGEN_MODIFY_PARAMS_AT_EACH_LEVEL */
54 
55 /* Size of Kronecker initiator matrix. */
56 #define GRAPHGEN_INITIATOR_SIZE 2
57 
58 /* Define to clip edges to one half of adjacency matrix to create undirected
59  * graphs. */
60 #define GRAPHGEN_UNDIRECTED
61 
62 /* Define to return graph edges in a struct that contains multiplicities,
63  * rather than just as an array of endpoints with duplicates and self-loops
64  * removed. */
65 /* #define GRAPHGEN_KEEP_MULTIPLICITIES */
66 
67 /* Define to keep self-loops in output array rather than marking them as unused
68  * slots. */
69 #define GRAPHGEN_KEEP_SELF_LOOPS
70 
71 /* Define to keep duplicate edges in output array rather than marking them as
72  * unused slots. */
73 #define GRAPHGEN_KEEP_DUPLICATES
74 
75 #endif /* GRAPHGEN_SETTINGS_DEFINED */
76 
77 #ifdef GRAPHGEN_KEEP_MULTIPLICITIES
78 typedef struct generated_edge {
79  int64_t src;
80  int64_t tgt;
81  int64_t multiplicity;
82 } generated_edge;
83 #endif
84 
86  int rank, int size,
87  int64_t M);
88 
90  int rank, int size,
91  const uint_fast32_t seed[5] /* All values in [0, 2^31 - 1) */,
92  int logN /* In base initiator_size */,
93  int64_t M,
94  const double initiator[ /* initiator_size * initiator_size */ ],
95 #ifdef GRAPHGEN_KEEP_MULTIPLICITIES
96  generated_edge* const edges /* Size >= compute_edge_array_size(rank,
97  size, M), must be zero-initialized; points to beginning of local chunk
98  when output_array_is_local is 1 and beginning of global array when
99  output_array_is_local is 0 */
100 #else
101  int64_t* const edges /* Size >= 2 * compute_edge_array_size(rank, size,
102  M); two endpoints per edge (= -1 when slot is unused); points to
103  beginning of local chunk when output_array_is_local is 1 and beginning
104  of global array when output_array_is_local is 0 */
105 #endif
106 );
107 
108 #ifdef __cplusplus
109 }
110 #endif
111 
112 #endif /* GRAPH_GENERATOR_H */
int size
int64_t compute_edge_array_size(int rank, int size, int64_t M)
long int64_t
Definition: compat.h:21
void generate_kronecker(int rank, int size, const uint_fast32_t seed[5], int logN, int64_t M, const double initiator[], int64_t *const edges)
int rank