Changeset 444 for soft/giet_vm/applications/convol/main.c
- Timestamp:
- Nov 3, 2014, 12:40:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/convol/main.c
r432 r444 3 3 // Date : june 2014 4 4 // author : Alain Greiner 5 //////////////////////////////////////////////////////////////////////////////////////////// 6 // This multi-threaded application application implements a 2D convolution product. 7 // The convolution kernel is [201]*[35] pixels, but it can be factored in two 8 // independant line and column convolution products. 9 // It can run on a multi-processors, multi-clusters architecture, with one thread 10 // per processor. It uses the he following hardware parameters, that must be defined 11 // in the hard_config.h file: 12 // - X_SIZE : number of clusters in a row 13 // - Y_SIZE : number of clusters in a column 14 // - NB_PROCS_MAX : number of processors per cluster 15 // - FBUF_X_SIZE : number of pixels per line in frame buffer 16 // - FBUF_Y_SIZE : number of lines in frame buffer 17 // 18 // The (1024 * 1024) pixels image is read from a file (2 bytes per pixel). 5 19 // 6 // The "convol" application implements a 2D convolution product. 20 // - The number of clusters containing processors must be a power of 2. 21 // - The number of processors per cluster must be a power of 2. 7 22 //////////////////////////////////////////////////////////////////////////////////////////// 8 23 … … 106 121 unsigned int task_id = (cluster_id * nprocs) + lpid; // continuous task index 107 122 unsigned int ntasks = nclusters * nprocs; // number of tasks 108 unsigned int npixels = NB_PIXELS; // pixels per frame109 123 unsigned int frame_size = FRAME_SIZE; // total size (bytes) 110 124 unsigned int nblocks = frame_size / 512; // number of blocks per frame … … 126 140 // parameters checking 127 141 142 if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) ) 143 { 144 giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size"); 145 } 128 146 if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4)) 129 147 giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n"); … … 148 166 if ( (x==0) && (y==0) && (lpid==0) ) 149 167 { 168 // parameters checking 169 if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) ) 170 giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size"); 171 172 if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4)) 173 giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n"); 174 175 if ((X_SIZE!=1) && (X_SIZE!=2) && (X_SIZE!=4) && (X_SIZE!=8) && (X_SIZE!=16)) 176 giet_exit( "[CONVOL ERROR] X_SIZE must be 1, 2, 4, 8, 16\n"); 177 178 if ((Y_SIZE!=1) && (Y_SIZE!=2) && (Y_SIZE!=4) && (Y_SIZE!=8) && (Y_SIZE!=16)) 179 giet_exit( "[CONVOL ERROR] Y_SIZE must be 1, 2, 4, 8, 16\n"); 180 181 if ( NL % nclusters != 0 ) 182 giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NL"); 183 184 if ( NP % nclusters != 0 ) 185 giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NP"); 186 187 150 188 giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n" 151 189 "- NB_CLUSTERS = %d\n" 152 "- NB_ LOCAL_PROCS= %d\n"190 "- NB_PROCS_MAX = %d\n" 153 191 "- NB_TASKS = %d\n" 154 "- NB_PIXELS = %x\n"155 "- FRAME_SIZE = %x\n"156 192 "- NB_BLOCKS = %x\n", 157 giet_proctime(), nclusters, nprocs, ntasks, 158 npixels, frame_size, nblocks ); 193 giet_proctime(), nclusters, nprocs, ntasks, nblocks ); 159 194 #if USE_SBT_BARRIER 160 195 sbt_barrier_init( &barrier, ntasks ); … … 294 329 } 295 330 296 giet_fb _sync_write( NP*(l + (task_id * lines_per_task) ),297 &TZ(cluster_id, line, 0),298 NP);331 giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ), 332 &TZ(cluster_id, line, 0), 333 NP); 299 334 } 300 335 … … 572 607 } 573 608 574 giet_fb _sync_write( NP*(l + (task_id * lines_per_task) ),575 &TZ(cluster_id, line, 0),576 NP);609 giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ), 610 &TZ(cluster_id, line, 0), 611 NP); 577 612 } 578 613
Note: See TracChangeset
for help on using the changeset viewer.