Changeset 656 for trunk/user
- Timestamp:
- Dec 6, 2019, 12:07:51 PM (5 years ago)
- Location:
- trunk/user
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/convol/convol.c
r652 r656 65 65 66 66 #define VERBOSE_MAIN 1 67 #define VERBOSE_EXEC 1 67 #define VERBOSE_EXEC 0 68 #define SUPER_VERBOSE 0 68 69 69 70 #define X_MAX 16 … … 159 160 ///////////////////////////////////////////////////////////////////////////////////// 160 161 161 void execute( pthread_parallel_work_args_t* args );162 void * execute( void * args ); 162 163 163 164 void instrument( FILE * f , char * filename ); … … 173 174 174 175 char instru_name[32]; // instrumentation file name 175 char instru_path[64]; // instrumentation path name176 char instru_path[64]; // instrumentation path name 176 177 177 178 ///////////////////////////////////////////////////////////////////////////////// … … 255 256 // build instrumentation file name 256 257 if( USE_DQT_BARRIER ) 257 snprintf( instru_name , 32 , "conv_dqt_explicit_%d_%d _%d", x_size * y_size , ncores );258 snprintf( instru_name , 32 , "conv_dqt_explicit_%d_%d", x_size * y_size , ncores ); 258 259 else 259 snprintf( instru_name , 32 , "conv_smp_explicit_%d_%d _%d", x_size * y_size , ncores );260 snprintf( instru_name , 32 , "conv_smp_explicit_%d_%d", x_size * y_size , ncores ); 260 261 } 261 262 … … 267 268 // build instrumentation file name 268 269 if( USE_DQT_BARRIER ) 269 snprintf( instru_name , 32 , "conv_dqt_parallel_%d_%d _%d", x_size * y_size , ncores );270 snprintf( instru_name , 32 , "conv_dqt_parallel_%d_%d", x_size * y_size , ncores ); 270 271 else 271 snprintf( instru_name , 32 , "conv_smp_parallel_%d_%d _%d", x_size * y_size , ncores );272 snprintf( instru_name , 32 , "conv_smp_parallel_%d_%d", x_size * y_size , ncores ); 272 273 } 273 274 … … 380 381 ///////////////////////////////////////////////////////////////////////////////////// 381 382 382 ////////////////// 383 if( NO_PLACEMENT ) 384 { 385 // the tid value for the main thread is always 0 386 // main thread creates new threads with tid in [1,nthreads-1] 387 unsigned int tid; 388 for ( tid = 0 ; tid < nthreads ; tid++ ) 389 { 390 // register tid value in exec_args[tid] array 391 exec_args[tid].tid = tid; 392 393 // create other threads 394 if( tid > 0 ) 383 ////////////////// 384 #if NO_PLACEMENT 385 { 386 // the tid value for the main thread is always 0 387 // main thread creates new threads with tid in [1,nthreads-1] 388 unsigned int tid; 389 for ( tid = 0 ; tid < nthreads ; tid++ ) 390 { 391 // register tid value in exec_args[tid] array 392 exec_args[tid].tid = tid; 393 394 // create other threads 395 if( tid > 0 ) 396 { 397 if ( pthread_create( &exec_trdid[tid], 398 NULL, // no attribute 399 &execute, 400 &exec_args[tid] ) ) 395 401 { 396 if ( pthread_create( &exec_trdid[tid], 397 NULL, // no attribute 398 &execute, 399 &exec_args[tid] ) ) 400 { 401 printf("\n[convol error] cannot create thread %d\n", tid ); 402 exit( 0 ); 403 } 402 printf("\n[convol error] cannot create thread %d\n", tid ); 403 exit( 0 ); 404 } 404 405 405 406 #if VERBOSE_MAIN … … 407 408 #endif 408 409 410 } 411 else 412 { 413 tid_main = 0; 414 } 415 } // end for tid 416 417 // main thread calls itself the execute() function 418 execute( &exec_args[0] ); 419 420 // main thread wait other threads completion 421 for ( tid = 1 ; tid < nthreads ; tid++ ) 422 { 423 unsigned int * status; 424 425 // main wait thread[tid] status 426 if ( pthread_join( exec_trdid[tid], (void*)(&status)) ) 427 { 428 printf("\n[convol error] main cannot join thread %d\n", tid ); 429 exit( 0 ); 430 } 431 432 // check status 433 if( *status != THREAD_EXIT_SUCCESS ) 434 { 435 printf("\n[convol error] thread %x returned failure\n", tid ); 436 exit( 0 ); 437 } 438 439 #if VERBOSE_MAIN 440 printf("\n[convol] main successfully joined thread %x\n", tid ); 441 #endif 442 443 } // end for tid 444 } 445 #endif // end no_placement 446 447 ////////////////////// 448 #if EXPLICIT_PLACEMENT 449 { 450 // main thread places each other threads on a specific core[cxy][lid] 451 // but the actual thread creation is sequencial 452 unsigned int x; 453 unsigned int y; 454 unsigned int l; 455 unsigned int cxy; // cluster identifier 456 unsigned int tid; // thread continuous index 457 458 for( x = 0 ; x < x_size ; x++ ) 459 { 460 for( y = 0 ; y < y_size ; y++ ) 461 { 462 cxy = HAL_CXY_FROM_XY( x , y ); 463 for( l = 0 ; l < ncores ; l++ ) 464 { 465 // compute thread continuous index 466 tid = (((x * y_size) + y) * ncores) + l; 467 468 // register tid value in exec_args[tid] array 469 exec_args[tid].tid = tid; 470 471 // no thread created on the core running the main 472 if( (cxy != cxy_main) || (l != lid_main) ) 473 { 474 // define thread attributes 475 exec_attr[tid].attributes = PT_ATTR_CLUSTER_DEFINED | 476 PT_ATTR_CORE_DEFINED; 477 exec_attr[tid].cxy = cxy; 478 exec_attr[tid].lid = l; 479 480 // create thread[tid] on core[cxy][l] 481 if ( pthread_create( &exec_trdid[tid], 482 &exec_attr[tid], 483 &execute, 484 &exec_args[tid] ) ) 485 { 486 printf("\n[convol error] cannot create thread %d\n", tid ); 487 exit( 0 ); 488 } 489 #if VERBOSE_MAIN 490 printf("\n[convol] main created thread[%d] on core[%x,%d]\n", tid, cxy, l ); 491 #endif 492 } 493 else 494 { 495 tid_main = tid; 496 } 409 497 } 410 else411 {412 tid_main = 0; 413 }414 } // end for tid415 416 // main thread calls itself the execute() function417 execute( &exec_args[0] );418 419 // main thread wait other threads completion420 for ( tid = 1 ; tid < nthreads ; tid++)498 } 499 } 500 501 // main thread calls itself the execute() function 502 execute( &exec_args[tid_main] ); 503 504 // main thread wait other threads completion 505 for( tid = 0 ; tid < nthreads ; tid++ ) 506 { 507 // no other thread on the core running the main 508 if( tid != tid_main ) 421 509 { 422 510 unsigned int * status; 423 511 424 // main wait thread[tid] status425 if ( pthread_join( exec_trdid[tid], (void*)(&status)) )512 // wait thread[tid] 513 if( pthread_join( exec_trdid[tid] , (void*)(&status) ) ) 426 514 { 427 515 printf("\n[convol error] main cannot join thread %d\n", tid ); 428 516 exit( 0 ); 429 517 } 430 518 431 519 // check status 432 520 if( *status != THREAD_EXIT_SUCCESS ) 433 521 { 434 printf("\n[convol error] thread % xreturned failure\n", tid );522 printf("\n[convol error] thread %d returned failure\n", tid ); 435 523 exit( 0 ); 436 524 } 437 438 #if VERBOSE_MAIN439 printf("\n[convol] main successfully joined thread %x\n", tid );440 #endif441 442 } // end for tid443 444 } // end if no_placement445 446 ////////////////////////447 if( EXPLICIT_PLACEMENT )448 {449 // main thread places each other threads on a specific core[cxy][lid]450 // but the actual thread creation is sequencial451 unsigned int x;452 unsigned int y;453 unsigned int l;454 unsigned int cxy; // cluster identifier455 unsigned int tid; // thread continuous index456 457 for( x = 0 ; x < x_size ; x++ )458 {459 for( y = 0 ; y < y_size ; y++ )460 {461 cxy = HAL_CXY_FROM_XY( x , y );462 for( l = 0 ; l < ncores ; l++ )463 {464 // compute thread continuous index465 tid = (((x * y_size) + y) * ncores) + l;466 467 // register tid value in exec_args[tid] array468 exec_args[tid].tid = tid;469 470 // no thread created on the core running the main471 if( (cxy != cxy_main) || (l != lid_main) )472 {473 // define thread attributes474 exec_attr[tid].attributes = PT_ATTR_CLUSTER_DEFINED |475 PT_ATTR_CORE_DEFINED;476 exec_attr[tid].cxy = cxy;477 exec_attr[tid].lid = l;478 479 // create thread[tid] on core[cxy][l]480 if ( pthread_create( &exec_trdid[tid],481 &exec_attr[tid],482 &execute,483 &exec_args[tid] ) )484 {485 printf("\n[convol error] cannot create thread %d\n", tid );486 exit( 0 );487 }488 #if VERBOSE_MAIN489 printf("\n[convol] main created thread[%d] on core[%x,%d]\n", tid, cxy, l );490 #endif491 }492 else493 {494 tid_main = tid;495 }496 }497 }498 }499 500 // main thread calls itself the execute() function501 execute( &exec_args[tid_main] );502 503 // main thread wait other threads completion504 for( tid = 0 ; tid < nthreads ; tid++ )505 {506 // no other thread on the core running the main507 if( tid != tid_main )508 {509 unsigned int * status;510 511 // wait thread[tid]512 if( pthread_join( exec_trdid[tid] , (void*)(&status) ) )513 {514 printf("\n[convol error] main cannot join thread %d\n", tid );515 exit( 0 );516 }517 518 // check status519 if( *status != THREAD_EXIT_SUCCESS )520 {521 printf("\n[convol error] thread %d returned failure\n", tid );522 exit( 0 );523 }524 525 #if VERBOSE_MAIN 525 526 printf("\n[convol] main joined thread %d on core[%x,%d]\n", tid , cxy , l ); 526 527 #endif 527 } 528 } 529 } // end if explicit_placement 530 531 //////////////////////// 532 if( PARALLEL_PLACEMENT ) 533 { 534 // compute covering DQT size an level 535 unsigned int z = (x_size > y_size) ? x_size : y_size; 536 unsigned int root_level = ((z == 1) ? 0 : 537 ((z == 2) ? 1 : 538 ((z == 4) ? 2 : 539 ((z == 8) ? 3 : 4)))); 540 541 // create & execute the working threads 542 if( pthread_parallel_create( root_level , &execute ) ) 543 { 544 printf("\n[convol error] in %s\n", __FUNCTION__ ); 545 exit( 0 ); 546 } 547 } // end if parallel_placement 528 } 529 } 530 } 531 #endif // end explicit_placement 532 533 ////////////////////// 534 #if PARALLEL_PLACEMENT 535 { 536 // compute covering DQT size an level 537 unsigned int z = (x_size > y_size) ? x_size : y_size; 538 unsigned int root_level = ((z == 1) ? 0 : 539 ((z == 2) ? 1 : 540 ((z == 4) ? 2 : 541 ((z == 8) ? 3 : 4)))); 542 543 // create & execute the working threads 544 if( pthread_parallel_create( root_level , &execute ) ) 545 { 546 printf("\n[convol error] in %s\n", __FUNCTION__ ); 547 exit( 0 ); 548 } 549 } 550 #endif // end parallel_placement 548 551 549 552 ///////////////////////////////////////////////////////////////////////////// … … 555 558 instrument( f_instru , instru_name ); 556 559 560 #if VERBOSE_MAIN 561 printf("\n[convol] main registered instrumentation info\n" ); 562 #endif 563 557 564 // main thread close input file 558 565 close( fd_in ); 559 566 567 #if VERBOSE_MAIN 568 printf("\n[convol] main closed input file\n" ); 569 #endif 570 560 571 // main thread close output file 561 572 close( fd_out ); 562 573 574 #if VERBOSE_MAIN 575 printf("\n[convol] main closed output file\n" ); 576 #endif 577 563 578 // main thread close instrumentation file 564 579 fclose( f_instru ); 580 581 #if VERBOSE_MAIN 582 printf("\n[convol] main closed instrumentation file\n" ); 583 #endif 565 584 566 585 // main thread suicide … … 574 593 575 594 576 /////////////////////////////////////////////////// 577 void execute( pthread_parallel_work_args_t * args ) 595 ////////////////////////////////// 596 void * execute( void * arguments ) 597 578 598 { 579 599 unsigned long long date; 600 601 pthread_parallel_work_args_t * args = (pthread_parallel_work_args_t *)arguments; 580 602 581 603 // Each thread initialises the convolution kernel parameters in local stack. … … 610 632 unsigned int cxy; // core cluster identifier 611 633 unsigned int lpid; // core local identifier 634 get_cycle( &date ); 612 635 get_core_id( &cxy , &lpid ); 613 printf("\n[convol] exec[%d] on core[%x,%d] enters parallel exec \n",614 tid , cxy , lpid );636 printf("\n[convol] exec[%d] on core[%x,%d] enters parallel exec / cycle %d\n", 637 tid , cxy , lpid , (unsigned int)date ); 615 638 #endif 616 639 … … 639 662 640 663 // Each thread[cid][0] allocates 5 local buffers, 641 // shared by all threads that have the same cid664 // and registers these 5 pointers in the global arrays 642 665 if ( lid == 0 ) 643 666 { … … 656 679 657 680 #if VERBOSE_EXEC 658 printf( "\n[convol] exec[%d] on core[%x,%d] allocated shared buffers\n" 659 "### GA = %x\n" 660 "### GB = %x\n" 661 "### GC = %x\n" 662 "### GD = %x\n" 663 "### GZ = %x\n", 664 tid, cxy , lpid, GA[cid], GB[cid], GC[cid], GD[cid], GZ[cid] ); 681 get_cycle( &date ); 682 printf( "\n[convol] exec[%d] on core[%x,%d] allocated shared buffers / cycle %d\n" 683 " GA %x / GB %x / GC %x / GD %x / GZ %x\n", 684 tid, cxy , lpid, (unsigned int)date, GA[cid], GB[cid], GC[cid], GD[cid], GZ[cid] ); 665 685 #endif 666 686 … … 700 720 #if VERBOSE_EXEC 701 721 get_cycle( &date ); 702 printf( "\n[convol] thread %d on core[%x,%d] load input file in A[%d]\n",703 tid , cxy , lpid , cid );722 printf( "\n[convol] exec[%d] on core[%x,%d] loaded input file in A[%d] / cycle %d\n", 723 tid , cxy , lpid , cid , (unsigned int)date); 704 724 #endif 705 725 … … 729 749 NP*(l + (tid * lines_per_thread)))) // offset in FBF 730 750 { 731 printf("\n[convol error] in %s : thread[% x,%d] cannot access FBF\n",732 __FUNCTION__ , cxy , lid );751 printf("\n[convol error] in %s : thread[%d] cannot access FBF\n", 752 __FUNCTION__ , tid ); 733 753 pthread_exit( &THREAD_EXIT_FAILURE ); 734 754 } … … 737 757 #if VERBOSE_EXEC 738 758 get_cycle( &date ); 739 printf( "\n[convol] thread[%d] on core[%x,%d] completes initial display\n",740 tid , cxy , lpid );759 printf( "\n[convol] exec[%d] on core[%x,%d] completed initial display / cycle %d\n", 760 tid , cxy , lpid , (unsigned int)date ); 741 761 #endif 742 762 … … 758 778 H_BEG[cid][lid] = (unsigned int)date; 759 779 760 #if VERBOSE_EXEC761 printf( "\n[convol] thread[%d] on core[%x,%d] starts horizontal filter\n",762 tid , cxy , lpid );763 #else764 if ( tid == tid_main )765 printf( "\n[convol] thread[%d] on core[%x,%d] starts horizontal filter\n",766 tid , cxy , lpid );767 #endif768 769 780 // l = absolute line index / p = absolute pixel index 770 781 // first & last define which lines are handled by a given thread … … 833 844 834 845 #if VERBOSE_EXEC 835 printf( "\n[convol] thread[%d] on core[%x,%d] completes horizontal filter\n", 836 tid , cxy , lpid ); 837 #else 838 if ( tid == tid_main ) 839 printf( "\n[convol] thread[%d] on core[%x,%d] completes horizontal filter\n", 840 tid , cxy , lpid ); 846 get_cycle( &date ); 847 printf( "\n[convol] exec[%d] on core[%x,%d] completed horizontal filter / cycle %d\n", 848 tid , cxy , lpid , (unsigned int)date ); 841 849 #endif 842 850 … … 855 863 get_cycle( &date ); 856 864 V_BEG[cid][lid] = (unsigned int)date; 857 858 #if VERBOSE_EXEC859 printf( "\n[convol] thread[%d] on core[%x,%d] starts vertical filter\n",860 tid , cxy , lpid );861 #else862 if ( tid == tid_main )863 printf( "\n[convol] thread[%d] on core[%x,%d] starts vertical filter\n",864 tid , cxy , lpid );865 #endif866 865 867 866 // l = absolute line index / p = absolute pixel index … … 947 946 948 947 #if VERBOSE_EXEC 949 printf( "\n[convol] thread[%d] on core[%x,%d] completes vertical filter\n", 950 tid , cxy , lid ); 951 #else 952 if ( tid == tid_main ) 953 printf( "\n[convol] thread[%d] on core[%x,%d] completes vertical filter\n", 954 tid , cxy , lid ); 948 get_cycle( &date ); 949 printf( "\n[convol] exec[%d] on core[%x,%d] completed vertical filter / cycle %d\n", 950 tid , cxy , lid , (unsigned int)date ); 955 951 #endif 956 952 … … 965 961 get_cycle( &date ); 966 962 D_BEG[cid][lid] = (unsigned int)date; 967 968 #if VERBOSE_EXEC969 printf( "\n[convol] thread[%d] on core[%x,%d] starts final display\n",970 tid , cxy , lid );971 #else972 if ( tid == tid_main )973 printf( "\n[convol] thread[%d] on core[%x,%d] starts final display\n",974 tid , cxy , lid );975 #endif976 963 977 964 unsigned int line; … … 1002 989 1003 990 #if VERBOSE_EXEC 1004 printf( "\n[convol] thread[%d] on core[%x,%d] completes final display\n", 1005 tid , cxy , lid ); 1006 #else 1007 if ( tid == tid_main ) 1008 printf( "\n[convol] thread[%d] on core[%x,%d] completes final display\n", 1009 tid , cxy , lid ); 1010 #endif 1011 1012 } 1013 1014 // all threads (but the one executing main) exit 1015 if ( tid != tid_main ) 1016 { 991 get_cycle( &date ); 992 printf( "\n[convol] exec[%d] on core[%x,%d] completed final display / cycle %d\n", 993 tid , cxy , lid , (unsigned int)date ); 994 #endif 995 996 } 997 998 // Each thread[cid,0] releases the 5 local buffers 999 if( lid == 0 ) 1000 { 1001 free( A[cid] ); 1002 free( B[cid] ); 1003 free( C[cid] ); 1004 free( D[cid] ); 1005 free( Z[cid] ); 1006 } 1007 1008 // thread termination depends on the placement policy 1009 if( PARALLEL_PLACEMENT ) 1010 { 1011 // <exec> threads are runing in detached mode, and 1012 // each thread must signal completion by calling barrier 1013 // passed in arguments before exit 1014 1015 pthread_barrier_wait( args->barrier ); 1016 1017 1017 pthread_exit( &THREAD_EXIT_SUCCESS ); 1018 1018 } 1019 else 1020 { 1021 // <exec> threads are running in attached mode 1022 // all threads (but the one executing main) exit 1023 if ( tid != tid_main ) pthread_exit( &THREAD_EXIT_SUCCESS ); 1024 } 1025 1026 return NULL; 1019 1027 1020 1028 } // end execute() … … 1102 1110 min_d_end, max_d_end, (min_d_end+max_d_end)/2, max_d_end-min_d_end); 1103 1111 1104 printf( "\n General Scenario (Kcycles for each step)\n" );1112 printf( "\n General Scenario (Kcycles)\n" ); 1105 1113 printf( " - LOAD IMAGE = %d\n", (min_h_beg - min_start)/1000 ); 1106 1114 printf( " - H_FILTER = %d\n", (max_h_end - min_h_beg)/1000 ); … … 1109 1117 printf( " - BARRIER VERT/DISP = %d\n", (min_d_beg - max_v_end)/1000 ); 1110 1118 printf( " - DISPLAY = %d\n", (max_d_end - min_d_beg)/1000 ); 1111 printf( " \nSEQUENCIAL = %d / PARALLEL = %d\n", SEQUENCIAL_TIME, PARALLEL_TIME ); 1119 printf( " \nSEQUENCIAL = %d / PARALLEL = %d\n", 1120 SEQUENCIAL_TIME/1000, PARALLEL_TIME/1000 ); 1112 1121 1113 1122 // save on disk … … 1142 1151 fprintf( f , " - BARRIER VERT/DISP = %d\n", (min_d_beg - max_v_end)/1000 ); 1143 1152 fprintf( f , " - DISPLAY = %d\n", (max_d_end - min_d_beg)/1000 ); 1144 fprintf( f , " \nSEQUENCIAL = %d / PARALLEL = %d\n", SEQUENCIAL_TIME, PARALLEL_TIME ); 1153 fprintf( f , " \nSEQUENCIAL = %d / PARALLEL = %d\n", 1154 SEQUENCIAL_TIME/1000, PARALLEL_TIME/1000 ); 1145 1155 1146 1156 } // end instrument() -
trunk/user/convol/convol.ld
r645 r656 4 4 5 5 seg_code_base = 0x400000; 6 7 /*************************************************************************** 8 * Define code entry point (e_entry field in .elf file) 9 ***************************************************************************/ 10 11 ENTRY( main ) 6 12 7 13 /*************************************************************************** -
trunk/user/display/Makefile
r644 r656 22 22 build/display.elf : $(OBJS) display.ld 23 23 $(LD) -o $@ -T display.ld $(OBJS) -L$(LIBC) -L$(LIBPTHREAD) -L$(LIBALMOSMKH) \ 24 -lc -lpthread -lalmosmkh -lpthread -lc24 -lc -lpthread -lalmosmkh -lpthread -lc 25 25 $(DU) -D $@ > $@.txt 26 26 … … 35 35 36 36 .PHONY: dirs clean 37 37 -
trunk/user/display/display.c
r644 r656 56 56 } 57 57 } 58 //////////// 59 void main()58 //////////////// 59 int main( void ) 60 60 { 61 61 … … 141 141 142 142 exit(0); 143 144 return 0; 143 145 } -
trunk/user/fft/fft.c
r652 r656 177 177 178 178 // array of kernel thread identifiers / indexed by [tid] 179 pthread_t work_trdid[CLUSTERS_MAX * CORES_MAX];179 pthread_t work_trdid[CLUSTERS_MAX * CORES_MAX]; 180 180 181 181 // array of thread attributes / indexed by [tid] 182 pthread_attr_t work_attr[CLUSTERS_MAX * CORES_MAX];182 pthread_attr_t work_attr[CLUSTERS_MAX * CORES_MAX]; 183 183 184 184 // array of work function arguments / indexed by [tid] 185 pthread_parallel_work_args_t work_args[CLUSTERS_MAX * CORES_MAX];185 pthread_parallel_work_args_t work_args[CLUSTERS_MAX * CORES_MAX]; 186 186 187 187 ///////////////////////////////////////////////////////////////////////////////////// … … 189 189 ///////////////////////////////////////////////////////////////////////////////////// 190 190 191 void work( pthread_parallel_work_args_t* args );191 void * work( void * args ); 192 192 193 193 double CheckSum( void ); … … 254 254 // launch the parallel execution, and makes the instrumentation. 255 255 /////////////////////////////////////////////////////////////////// 256 voidmain ( void )256 int main ( void ) 257 257 { 258 258 int error; … … 699 699 exit( 0 ); 700 700 701 return 0; 702 701 703 } // end main() 702 704 … … 704 706 // This function is executed in parallel by all <work> threads. 705 707 ///////////////////////////////////////////////////////////////// 706 void work( pthread_parallel_work_args_t * args )708 void * work( void * arguments ) 707 709 { 708 710 unsigned int tid; // this thread continuous index 709 711 unsigned int lid; // core local index 710 712 unsigned int cid; // cluster continuous index 711 pthread_barrier_t * parent_barrier; // pointer on parent barrier712 713 713 714 unsigned int MyFirst; // index first row allocated to thread … … 723 724 724 725 // get thread arguments 725 tid = args->tid; 726 parent_barrier = args->barrier; 726 pthread_parallel_work_args_t * args = (pthread_parallel_work_args_t *)arguments; 727 728 tid = args->tid; 729 pthread_barrier_t * parent_barrier = args->barrier; 727 730 728 731 // compute lid and cid from tid … … 861 864 // work thread exit 862 865 pthread_exit( NULL ); 866 867 return NULL; 863 868 864 869 } // end work() -
trunk/user/ksh/ksh.c
r652 r656 1234 1234 else 1235 1235 { 1236 strcpy( cmd , "load bin/user/ transpose.elf" );1236 strcpy( cmd , "load bin/user/kleenex.elf" ); 1237 1237 printf("[ksh] %s\n", cmd ); 1238 1238 execute( cmd ); -
trunk/user/sort/sort.c
r652 r656 153 153 } // end merge() 154 154 155 /////////////////////////////// ////////////////156 void sort( pthread_parallel_work_args_t * ptr)155 /////////////////////////////// 156 void * sort( void * arguments ) 157 157 { 158 158 unsigned int i; … … 161 161 162 162 // get arguments 163 pthread_parallel_work_args_t * ptr = (pthread_parallel_work_args_t *)arguments; 164 163 165 unsigned int tid = ptr->tid; 164 166 pthread_barrier_t * parent_barrier = ptr->barrier; … … 237 239 pthread_exit( NULL ); 238 240 241 return NULL; 242 239 243 } // end sort() 240 244 241 245 242 //////////////// /243 voidmain( void )246 //////////////// 247 int main( void ) 244 248 { 245 249 int error; … … 452 456 exit( 0 ); 453 457 458 return 0; 459 454 460 } // end main() 455 461 -
trunk/user/transpose/transpose.c
r652 r656 154 154 //////////////////////////////////////////////////////////////// 155 155 156 void execute( pthread_parallel_work_args_t * args );156 void * execute( void * arguments ); 157 157 158 158 void instrument( FILE * f , char * filename ); 159 159 160 //////////////// /161 voidmain( void )160 //////////////// 161 int main( void ) 162 162 { 163 163 unsigned long long start_cycle; … … 586 586 exit( 0 ); 587 587 588 return 0; 589 588 590 } // end main() 589 591 … … 591 593 592 594 593 ////////////////////////////////// /////////////////594 void execute( pthread_parallel_work_args_t * args )595 ////////////////////////////////// 596 void * execute( void * arguments ) 595 597 { 596 598 unsigned long long date; … … 598 600 unsigned int l; // line index for loop 599 601 unsigned int p; // pixel index for loop 602 603 pthread_parallel_work_args_t * args = (pthread_parallel_work_args_t *)arguments; 600 604 601 605 // WARNING … … 813 817 if( PARALLEL_PLACEMENT ) 814 818 { 815 // <work> threads are runing in detached mode 819 // <work> threads are runing in detached mode, and 816 820 // each thread must signal completion by calling barrier 817 821 // passed in arguments before exit … … 827 831 if ( tid != tid_main ) pthread_exit( &THREAD_EXIT_SUCCESS ); 828 832 } 833 834 return NULL; 829 835 830 836 } // end execute()
Note: See TracChangeset
for help on using the changeset viewer.