PandA-2024.02
examples
MachSuite
MachSuite
bfs
bulk
bfs.h
Go to the documentation of this file.
1
/*
2
Implementations based on:
3
Harish and Narayanan. "Accelerating large graph algorithms on the GPU using CUDA." HiPC, 2007.
4
Hong, Oguntebi, Olukotun. "Efficient Parallel Graph Exploration on Multi-Core CPU and GPU." PACT, 2011.
5
*/
6
7
#include <stdlib.h>
8
#include <inttypes.h>
9
#include <stdio.h>
10
#include <string.h>
11
#include "support.h"
12
13
// Terminology (but not values) from graph500 spec
14
// graph density = 2^-(2*SCALE - EDGE_FACTOR)
15
#define SCALE 8
16
#define EDGE_FACTOR 16
17
18
#define N_NODES (1LL<<SCALE)
19
#define N_EDGES (N_NODES*EDGE_FACTOR)
20
21
// upper limit
22
#define N_LEVELS 10
23
24
// Larger than necessary for small graphs, but appropriate for large ones
25
typedef
uint64_t
edge_index_t
;
26
typedef
uint64_t
node_index_t
;
27
28
typedef
struct
edge_t_struct
{
29
// These fields are common in practice, but we elect not to use them.
30
//weight_t weight;
31
//node_index_t src;
32
node_index_t
dst
;
33
}
edge_t
;
34
35
typedef
struct
node_t_struct
{
36
edge_index_t
edge_begin
;
37
edge_index_t
edge_end
;
38
}
node_t
;
39
40
typedef
int8_t
level_t
;
41
#define MAX_LEVEL INT8_MAX
42
44
// Test harness interface code.
45
46
struct
bench_args_t
{
47
node_t
nodes
[
N_NODES
];
48
edge_t
edges
[
N_EDGES
];
49
node_index_t
starting_node
;
50
level_t
level
[
N_NODES
];
51
edge_index_t
level_counts[
N_LEVELS
];
52
};
53
54
void
bfs
(
node_t
nodes
[
N_NODES
],
edge_t
edges
[
N_EDGES
],
node_index_t
starting_node,
level_t
level
[N_NODES],
edge_index_t
level_counts[
N_LEVELS
]);
55
nodes
struct Node nodes[7]
Definition:
simple_raytrace.c:62
N_NODES
#define N_NODES
Definition:
bfs.h:18
bench_args_t::starting_node
node_index_t starting_node
Definition:
bfs.h:49
node_t
struct node_t_struct node_t
node_index_t
uint64_t node_index_t
Definition:
bfs.h:26
edge_t_struct::dst
node_index_t dst
Definition:
bfs.h:32
level_t
int8_t level_t
Definition:
bfs.h:40
edges
unsigned edges[4545]
Definition:
graph.h:25
N_LEVELS
#define N_LEVELS
Definition:
bfs.h:22
node_t_struct::edge_begin
edge_index_t edge_begin
Definition:
bfs.h:36
edge_index_t
uint64_t edge_index_t
Definition:
bfs.h:25
edge_t
struct edge_t_struct edge_t
node_t_struct
Definition:
bfs.h:35
level
int level
Definition:
main.c:98
bfs
void bfs(node_t nodes[N_NODES], edge_t edges[N_EDGES], node_index_t starting_node, level_t level[N_NODES], edge_index_t level_counts[N_LEVELS])
Definition:
bfs.c:9
edge_t_struct
Definition:
bfs.h:28
bench_args_t
Definition:
aes.h:18
N_EDGES
#define N_EDGES
Definition:
bfs.h:19
node_t_struct::edge_end
edge_index_t edge_end
Definition:
bfs.h:37
Generated on Mon Feb 12 2024 13:02:49 for PandA-2024.02 by
1.8.13