Changeset 487 for soft/giet_vm/giet_libs
- Timestamp:
- Jan 8, 2015, 11:50:25 AM (10 years ago)
- Location:
- soft/giet_vm/giet_libs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_libs/barrier.c
r468 r487 98 98 //////////////////////////////////////////////////// 99 99 void sbt_barrier_init( giet_sbt_barrier_t* barrier, 100 unsigned int ntasks ) 100 unsigned int nclusters, // number of clusters 101 unsigned int ntasks ) // tasks per clusters 101 102 { 102 103 unsigned int x; // x coordinate for one SBT node … … 107 108 unsigned int levels; // depth of the SBT (number of levels) 108 109 109 110 110 // compute SBT characteristics 111 if ( n tasks == NB_PROCS_MAX) // mesh 1*1111 if ( nclusters == 1 ) // mesh 1*1 112 112 { 113 113 x_size = 1; … … 115 115 levels = 1; 116 116 } 117 else if ( n tasks == NB_PROCS_MAX * 2) // mesh 2*1117 else if ( nclusters == 2 ) // mesh 2*1 118 118 { 119 119 x_size = 2; … … 121 121 levels = 2; 122 122 } 123 else if ( n tasks == NB_PROCS_MAX * 4) // mesh 2*2123 else if ( nclusters == 4 ) // mesh 2*2 124 124 { 125 125 x_size = 2; … … 127 127 levels = 3; 128 128 } 129 else if ( n tasks == NB_PROCS_MAX * 8) // mesh 4*2129 else if ( nclusters == 8 ) // mesh 4*2 130 130 { 131 131 x_size = 4; … … 133 133 levels = 4; 134 134 } 135 else if ( n tasks == NB_PROCS_MAX * 16) // mesh 4*4135 else if ( nclusters == 16 ) // mesh 4*4 136 136 { 137 137 x_size = 4; … … 139 139 levels = 5; 140 140 } 141 else if ( n tasks == NB_PROCS_MAX * 32) // mesh 8*4141 else if ( nclusters == 32 ) // mesh 8*4 142 142 { 143 143 x_size = 8; … … 145 145 levels = 6; 146 146 } 147 else if ( n tasks == NB_PROCS_MAX * 64) // mesh 8*8147 else if ( nclusters == 64 ) // mesh 8*8 148 148 { 149 149 x_size = 8; … … 151 151 levels = 7; 152 152 } 153 else if ( n tasks == NB_PROCS_MAX *128 ) // mesh 16*8153 else if ( nclusters == 128 ) // mesh 16*8 154 154 { 155 155 x_size = 16; … … 157 157 levels = 8; 158 158 } 159 else if ( n tasks == NB_PROCS_MAX *256 ) // mesh 16*16159 else if ( nclusters == 256 ) // mesh 16*16 160 160 { 161 161 x_size = 16; … … 168 168 y_size = 0; 169 169 levels = 0; 170 giet_exit("error in tree_barrier_init() : n umber of tasks must be power of 2\n");170 giet_exit("error in tree_barrier_init() : nclusters must be power of 2\n"); 171 171 } 172 172 173 173 // ntasks initialisation 174 barrier->ntasks = ntasks ;174 barrier->ntasks = ntasks * nclusters; 175 175 176 176 #if GIET_DEBUG_USER_BARRIER … … 214 214 215 215 // recursively initialize all SBT nodes from root to bottom 216 sbt_build( barrier, 0, 0, levels-1, NULL );216 sbt_build( barrier, 0, 0, levels-1, NULL, ntasks ); 217 217 218 218 asm volatile ("sync" ::: "memory"); … … 240 240 unsigned int y, 241 241 unsigned int level, 242 sbt_node_t* parent ) 242 sbt_node_t* parent, 243 unsigned int ntasks ) 243 244 { 244 245 // This recursive function initializes the SBT notes … … 251 252 { 252 253 // initializes target node 253 node->arity = NB_PROCS_MAX;254 node->count = NB_PROCS_MAX;254 node->arity = ntasks; 255 node->count = ntasks; 255 256 node->sense = 0; 256 257 node->level = 0; … … 308 309 309 310 // recursive calls for children nodes 310 sbt_build( barrier , x0 , y0 , level-1 , node );311 sbt_build( barrier , x1 , y1 , level-1 , node );311 sbt_build( barrier , x0 , y0 , level-1 , node , ntasks ); 312 sbt_build( barrier , x1 , y1 , level-1 , node , ntasks ); 312 313 } 313 314 -
soft/giet_vm/giet_libs/barrier.h
r468 r487 18 18 // and is implemented as a physically distributed Sliced-Binary-Tree (SBT). 19 19 // WARNING: The following placement constraints must be respected: 20 // - The number of tasks must be a power of 2.21 // - The re is one task per processor in a given cluster.20 // - The number of involved clusters must be a power of 2. 21 // - The number of involved tasks in a cluster is the same in all clusters. 22 22 // - The involved clusters form a mesh[N][N] or a mesh[N][N/2] 23 23 // - The lower left involved cluster is cluster(0,0) … … 81 81 /////////////////////////////////////////////////////////// 82 82 extern void sbt_barrier_init( giet_sbt_barrier_t* barrier, 83 unsigned int nclusters, 83 84 unsigned int ntasks ); 84 85 … … 91 92 unsigned int y, 92 93 unsigned int level, 93 sbt_node_t* parent ); 94 sbt_node_t* parent, 95 unsigned int ntasks ); 94 96 95 97 /////////////////////////////////////// -
soft/giet_vm/giet_libs/stdio.c
r461 r487 541 541 ////////////////////////////////////////////////////////////////////////////////// 542 542 543 //////////////////////// 544 int giet_nic_rx_alloc()543 //////////////////////////////// 544 unsigned int giet_nic_rx_alloc() 545 545 { 546 546 int channel = sys_call( SYSCALL_NIC_ALLOC, 547 547 1, 548 548 0, 0, 0 ); 549 if ( channel < 0 ) giet_exit("error in giet_nic_ tx_alloc()");550 551 return channel;552 } 553 554 /////////////////////// 555 int giet_nic_tx_alloc()549 if ( channel < 0 ) giet_exit("error in giet_nic_rx_alloc()"); 550 551 return (unsigned int)channel; 552 } 553 554 //////////////////////////////// 555 unsigned int giet_nic_tx_alloc() 556 556 { 557 557 int channel = sys_call( SYSCALL_NIC_ALLOC, … … 560 560 if ( channel < 0 ) giet_exit("error in giet_nic_tx_alloc()"); 561 561 562 return channel;563 } 564 565 //////////////////////// 566 void giet_nic_rx_start( )562 return (unsigned int)channel; 563 } 564 565 ////////////////////////////////////////////// 566 void giet_nic_rx_start( unsigned int channel ) 567 567 { 568 568 if ( sys_call( SYSCALL_NIC_START, 569 569 1, 570 0, 0, 0 ) ) giet_exit("error in giet_nic_rx_start()"); 571 } 572 573 //////////////////////// 574 void giet_nic_tx_start() 570 channel, 571 0, 0 ) ) giet_exit("error in giet_nic_rx_start()"); 572 } 573 574 ////////////////////////////////////////////// 575 void giet_nic_tx_start( unsigned int channel ) 575 576 { 576 577 if ( sys_call( SYSCALL_NIC_START, 577 578 0, 578 0, 0, 0 ) ) giet_exit("error in giet_nic_tx_start()"); 579 channel, 580 0, 0 ) ) giet_exit("error in giet_nic_tx_start()"); 579 581 } 580 582 … … 599 601 } 600 602 601 /////////////////////// 602 void giet_nic_rx_stop( )603 ///////////////////////////////////////////// 604 void giet_nic_rx_stop( unsigned int channel ) 603 605 { 604 606 if ( sys_call( SYSCALL_NIC_STOP, 605 607 1, 606 0, 0, 0 ) ) giet_exit("error in giet_nic_rx_stop()"); 607 } 608 609 /////////////////////// 610 void giet_nic_tx_stop() 608 channel, 609 0, 0 ) ) giet_exit("error in giet_nic_rx_stop()"); 610 } 611 612 ///////////////////////////////////////////// 613 void giet_nic_tx_stop( unsigned int channel ) 611 614 { 612 615 if ( sys_call( SYSCALL_NIC_STOP, 613 616 0, 614 0, 0, 0 ) ) giet_exit("error in giet_nic_tx_stop()"); 615 } 616 617 //////////////////////// 618 void giet_nic_rx_stats() 617 channel, 618 0, 0 ) ) giet_exit("error in giet_nic_tx_stop()"); 619 } 620 621 ////////////////////////////////////////////// 622 void giet_nic_rx_stats( unsigned int channel ) 619 623 { 620 624 if ( sys_call( SYSCALL_NIC_STATS, 621 625 1, 622 0, 0, 0 ) ) giet_exit("error in giet_nic_rx_stats()"); 623 } 624 625 //////////////////////// 626 void giet_nic_tx_stats() 626 channel, 627 0, 0 ) ) giet_exit("error in giet_nic_rx_stats()"); 628 } 629 630 ////////////////////////////////////////////// 631 void giet_nic_tx_stats( unsigned int channel ) 627 632 { 628 633 if ( sys_call( SYSCALL_NIC_STATS, 629 634 0, 630 0, 0, 0 ) ) giet_exit("error in giet_nic_tx_stats()"); 631 } 632 633 //////////////////////// 634 void giet_nic_rx_clear() 635 channel, 636 0, 0 ) ) giet_exit("error in giet_nic_tx_stats()"); 637 } 638 639 ////////////////////////////////////////////// 640 void giet_nic_rx_clear( unsigned int channel ) 635 641 { 636 642 if ( sys_call( SYSCALL_NIC_CLEAR, 637 643 1, 638 0, 0, 0 ) ) giet_exit("error in giet_nic_rx_clear()"); 639 } 640 641 //////////////////////// 642 void giet_nic_tx_clear() 644 channel, 645 0, 0 ) ) giet_exit("error in giet_nic_rx_clear()"); 646 } 647 648 ////////////////////////////////////////////// 649 void giet_nic_tx_clear( unsigned int channel ) 643 650 { 644 651 if ( sys_call( SYSCALL_NIC_CLEAR, 645 652 0, 646 0, 0, 0 ) ) giet_exit("error in giet_nic_tx_clear()"); 653 channel, 654 0, 0 ) ) giet_exit("error in giet_nic_tx_clear()"); 647 655 } 648 656 -
soft/giet_vm/giet_libs/stdio.h
r468 r487 212 212 ////////////////////////////////////////////////////////////////////////// 213 213 214 extern int giet_nic_rx_alloc();215 216 extern int giet_nic_tx_alloc();217 218 extern void giet_nic_rx_start( );219 220 extern void giet_nic_tx_start( );214 extern unsigned int giet_nic_rx_alloc(); 215 216 extern unsigned int giet_nic_tx_alloc(); 217 218 extern void giet_nic_rx_start( unsigned int channel ); 219 220 extern void giet_nic_tx_start( unsigned int channel ); 221 221 222 222 extern void giet_nic_rx_move( unsigned int channel, void* buffer ); … … 224 224 extern void giet_nic_tx_move( unsigned int channel, void* buffer ); 225 225 226 extern void giet_nic_rx_stop( );227 228 extern void giet_nic_tx_stop( );229 230 extern void giet_nic_rx_stats( );231 232 extern void giet_nic_tx_stats( );233 234 extern void giet_nic_rx_clear( );235 236 extern void giet_nic_tx_clear( );226 extern void giet_nic_rx_stop( unsigned int channel ); 227 228 extern void giet_nic_tx_stop( unsigned int channel ); 229 230 extern void giet_nic_rx_stats( unsigned int channel ); 231 232 extern void giet_nic_tx_stats( unsigned int channel ); 233 234 extern void giet_nic_rx_clear( unsigned int channel ); 235 236 extern void giet_nic_tx_clear( unsigned int channel ); 237 237 238 238 //////////////////////////////////////////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.