Changeset 3d5701e for tests/concurrent/examples/quickSort.cfa
- Timestamp:
- Feb 25, 2020, 1:17:33 PM (6 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:
- 7dc2e015
- Parents:
- 9fb8f01 (diff), dd9e1ca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/concurrent/examples/quickSort.cfa
r9fb8f01 r3d5701e 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:45 201914 // Update Count : 17 213 // Last Modified On : Wed Feb 12 18:24:47 2020 14 // Update Count : 177 15 15 // 16 16 … … 27 27 28 28 void ?{}( Quicksort & qs, int values[], int size, int depth ) { 29 qs. values = values; qs.low = 0; qs.high = size; qs.depth = depth;29 qs.[values, low, high, depth] = [values, 0, size, depth]; 30 30 } // Quicksort 31 31 … … 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 ( i; 200 ) { // 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.