File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1
1
pub use inefficient_sort:: * ;
2
+ pub use priority_queue:: * ;
2
3
pub use sample_sort:: * ;
3
4
pub use selection:: * ;
4
5
5
6
mod util;
6
7
7
8
mod inefficient_sort;
9
+ mod priority_queue;
8
10
mod sample_sort;
9
11
mod selection;
Original file line number Diff line number Diff line change
1
+ use std:: cmp:: Reverse ;
2
+ use std:: collections:: BinaryHeap ;
3
+ use mpi:: topology:: SystemCommunicator ;
4
+ use rand:: { Rng , thread_rng} ;
5
+ use rand:: rngs:: ThreadRng ;
6
+
7
+ pub struct ParallelPriorityQueue < ' a > {
8
+ communicator : & ' a SystemCommunicator ,
9
+ bin_heap : BinaryHeap < Reverse < u64 > > ,
10
+ rng : ThreadRng ,
11
+ }
12
+
13
+ impl < ' a > ParallelPriorityQueue < ' a > {
14
+
15
+ pub fn new ( comm : & ' a SystemCommunicator ) -> ParallelPriorityQueue < ' a > {
16
+ ParallelPriorityQueue {
17
+ communicator : comm,
18
+ bin_heap : BinaryHeap :: new ( ) ,
19
+ rng : thread_rng ( ) ,
20
+ }
21
+ }
22
+
23
+ /// insert an element into the local queue
24
+ fn local_insert ( & mut self , e : u64 ) {
25
+ self . bin_heap . push ( Reverse ( e) )
26
+ }
27
+
28
+ /// Insert a constant amount of elements per processing unit. Insertion will redistribute the items among
29
+ /// processors to ensure uniform data distribution
30
+ pub fn insert ( & mut self , elements : & [ u64 ] ) {
31
+ todo ! ( "not yet implemented" ) ;
32
+ }
33
+
34
+ /// Delete the p smallest elements in the priority queue and distribute them among all p processing units.
35
+ pub fn delete_min ( & mut self ) -> u64 {
36
+ todo ! ( "not yet implemented" )
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments