Changeset 442 for trunk/user/sort
- Timestamp:
- May 16, 2018, 4:13:12 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/sort/sort.c
r441 r442 27 27 #include <pthread.h> 28 28 29 #define ARRAY_LENGTH 0x 100 // 256values29 #define ARRAY_LENGTH 0x400 // 1024 values 30 30 31 31 #define MAX_THREADS 1024 // 16 * 16 * 4 32 32 33 33 #define DISPLAY_ARRAY 0 34 #define DISPLAY_THREADS134 #define INTERACTIVE_MODE 1 35 35 36 36 /////////////////////////////////////////////////////// … … 159 159 unsigned int stages = __builtin_ctz( threads ) + 1; 160 160 161 printf("\n[SORT] thread[%d] : start\n", thread_uid ); 162 161 163 bubbleSort( array0, items, items * thread_uid ); 162 164 … … 165 167 ///////////////////////////////// 166 168 pthread_barrier_wait( &barrier ); 167 168 169 printf("\n[SORT] thread[%d] exit barrier\n", thread_uid ); 169 170 … … 201 202 ///////////////////////////////// 202 203 pthread_barrier_wait( &barrier ); 204 printf("\n[SORT] thread[%d] exit barrier\n", thread_uid ); 203 205 204 206 } … … 316 318 &arg[thread_uid] ) ) // sort arguments 317 319 { 318 printf("\n[SORT ERROR] main c reatedthread %x \n", thread_uid );320 printf("\n[SORT ERROR] main cannot create thread %x \n", thread_uid ); 319 321 exit( 0 ); 320 322 } 323 else 324 { 325 printf("\n[SORT] main created thread %x \n", thread_uid ); 326 } 321 327 } 322 323 #if DISPLAY_THREADS324 display_sched( CXY_FROM_XY(x,y) , lid);328 329 #if INTERACTIVE_MODE 330 idbg(); 325 331 #endif 326 332 } 327 333 } 328 334 } 329 335 330 336 get_cycle( &cycle ); 331 337 printf("\n[SORT] main completes threads create at cycle %d\n", (unsigned int)cycle ); … … 334 340 sort( &arg[main_uid] ); 335 341 336 while( 1 ) asm volatile( "nop" ); 342 #if INTERACTIVE_MODE 343 idbg(); 344 #endif 337 345 338 346 // Check result
Note: See TracChangeset
for help on using the changeset viewer.