Skip to content

Commit 93e643c

Browse files
committed
---
yaml --- r: 13118 b: refs/heads/master c: f05040f h: refs/heads/master v: v3
1 parent 5dc3721 commit 93e643c

File tree

2 files changed

+8
-47
lines changed

2 files changed

+8
-47
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e5757923cd1ad20fdee7571aeaa0be445e51f379
2+
refs/heads/master: f05040f17af1f4fcd6cda2b9cfe3ee43dc9c18e4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/test/bench/graph500-bfs.rs

Lines changed: 7 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,6 @@ type node_id = i64;
2020
type graph = [[node_id]];
2121
type bfs_result = [node_id];
2222

23-
iface queue<T: send> {
24-
fn add_back(T);
25-
fn pop_front() -> T;
26-
fn size() -> uint;
27-
}
28-
29-
#[doc="Creates a queue based on ports and channels.
30-
31-
This is admittedly not ideal, but it will help us work around the deque
32-
bugs for the time being."]
33-
fn create_queue<T: send>() -> queue<T> {
34-
type repr<T: send> = {
35-
p : port<T>,
36-
c : chan<T>,
37-
mut s : uint,
38-
};
39-
40-
let p = port();
41-
let c = chan(p);
42-
43-
impl<T: copy send> of queue<T> for repr<T> {
44-
fn add_back(x : T) {
45-
let x = x;
46-
send(self.c, x);
47-
self.s += 1u;
48-
}
49-
50-
fn pop_front() -> T {
51-
self.s -= 1u;
52-
recv(self.p)
53-
}
54-
55-
fn size() -> uint { self.s }
56-
}
57-
58-
let Q : repr<T> = { p : p, c : c, mut s : 0u };
59-
Q as queue::<T>
60-
}
61-
6223
fn make_edges(scale: uint, edgefactor: uint) -> [(node_id, node_id)] {
6324
let r = rand::rng();
6425

@@ -145,7 +106,7 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
145106
let marks : [mut node_id]
146107
= vec::to_mut(vec::from_elem(vec::len(graph), -1i64));
147108

148-
let Q = create_queue();
109+
let Q = deque::create();
149110

150111
Q.add_back(key);
151112
marks[key] = key;
@@ -266,7 +227,7 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
266227
}
267228
}
268229

269-
let (res, graph) = arc::shared_arc(copy graph);
230+
let (_res, graph) = arc::shared_arc(copy graph);
270231

271232
let mut i = 0u;
272233
while par::any(colors, is_gray) {
@@ -275,24 +236,24 @@ fn pbfs(graph: graph, key: node_id) -> bfs_result {
275236
i += 1u;
276237
let old_len = colors.len();
277238

278-
let (res, color) = arc::shared_arc(copy colors);
239+
let (_res, color) = arc::shared_arc(copy colors);
279240

280241
colors = par::mapi(colors) {|i, c|
281242
let c : color = c;
282243
let colors = &arc::get_arc(color);
283-
let colors : [color] = *arc::get(colors);
244+
let colors = arc::get(colors);
284245
let graph = &arc::get_arc(graph);
285-
let graph : graph = *arc::get(graph);
246+
let graph = arc::get(graph);
286247
alt c {
287248
white {
288249
let i = i as node_id;
289250

290-
let neighbors = graph[i];
251+
let neighbors = (*graph)[i];
291252

292253
let mut color = white;
293254

294255
neighbors.each() {|k|
295-
if is_gray(colors[k]) {
256+
if is_gray((*colors)[k]) {
296257
color = gray(k);
297258
false
298259
}

0 commit comments

Comments
 (0)