Changeset 487 for soft/giet_vm/giet_libs/barrier.c
- Timestamp:
- Jan 8, 2015, 11:50:25 AM (10 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.