- Timestamp:
- Oct 20, 2019, 11:10:55 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1aa6ecb
- Parents:
- 1f7324f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/examples/quickSort.cfa
r1f7324f rfdf4efb 11 11 // Created On : Wed Dec 6 12:15:52 2017 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Fri Jun 21 08:27:45201914 // Update Count : 17 213 // Last Modified On : Thu Oct 10 13:58:18 2019 14 // Update Count : 176 15 15 // 16 16 … … 66 66 if ( depth > 0 ) { 67 67 depth -= 1; 68 Quicksort rqs = { values, low, right, depth }; // concurrently sort upper half 69 //Quicksort lqs( values, left, high, depth ); // concurrently sort lower half 70 sort( values, left, high, depth ); // concurrently sort lower half 68 Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 69 Quicksort rqs = { values, left, high, depth }; // concurrently sort upper half 70 // Quicksort lqs = { values, low, right, depth }; // concurrently sort lower half 71 // sort( values, left, high, depth ); // concurrently sort upper half 71 72 } else { 72 73 sort( values, low, right, 0 ); // sequentially sort lower half … … 162 163 processor processors[ (1 << depth) - 1 ] __attribute__(( unused )); // create 2^depth-1 kernel threads 163 164 164 int * values = alloc( size ); // values to be sorted, too large to put on stack165 for ( counter; size ) { // generate unsorted numbers165 int * values = alloc( size ); // values to be sorted, too large to put on stack 166 for ( counter; size ) { // generate unsorted numbers 166 167 values[counter] = size - counter; // descending values 168 } // for 169 for ( int i = 0; i < 200; i +=1 ) { // random shuffle a few values 170 swap( values[rand() % size], values[rand() % size] ); 167 171 } // for 168 172 { … … 178 182 } // main 179 183 184 // for depth in 0 1 2 3 4 5 ; do echo "sort 500000000 values with ${depth} depth" ; time -f "%Uu %Ss %E %Mkb" a.out -t 500000000 ${depth} ; done 185 180 186 // Local Variables: // 181 187 // tab-width: 4 //
Note: See TracChangeset
for help on using the changeset viewer.