Changeset 336 for soft/giet_vm/transpose/main.c
- Timestamp:
- Jun 19, 2014, 1:35:35 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/transpose/main.c
r317 r336 19 19 #include "hard_config.h" 20 20 #include "stdio.h" 21 #include "malloc.h"22 21 #include "barrier.h" 23 22 … … 26 25 #define FILE_PATHNAME "misc/images.raw" // file pathname on disk 27 26 28 #define INSTRUMENTATION_OK 0 // display statist cs on TTY when non zero27 #define INSTRUMENTATION_OK 0 // display statistics on TTY when non zero 29 28 30 29 /////////////////////////////////////////////////////// … … 57 56 giet_barrier_t barrier_3; 58 57 giet_barrier_t barrier_4; 58 giet_barrier_t barrier_5; 59 59 60 60 volatile unsigned int init_ok = 1; … … 64 64 { 65 65 66 int file; // file descriptor for images66 int file; // file descriptor 67 67 unsigned int l; // line index for loops 68 68 unsigned int p; // pixel index for loops 69 69 70 unsigned int proc_id = giet_procid(); //processor id71 unsigned int lpid = proc_id % NB_PROCS_MAX;// local processor id72 unsigned int cluster_xy = proc_id / NB_PROCS_MAX;// cluster index (8 bits format)73 unsigned int x = cluster_xy >> Y_WIDTH;// x coordinate74 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);// y coordinate75 76 unsigned int npixels = NN * NN; // number of pixelper image77 unsigned int nblocks = npixels / 512; // number ofblocks per image78 unsigned int image = 0;// image counter79 80 unsigned int nclusters = X_SIZE * Y_SIZE; // number ofclusters with procs81 unsigned int cluster_id = (x * Y_SIZE) + y;// "continuous" cluster index82 unsigned int ntasks = nclusters * NB_PROCS_MAX;// number of tasks83 unsigned int task_id = (cluster_id * NB_PROCS_MAX) +lpid; // "continuous" task index70 unsigned int proc_id = giet_procid(); // global processor id 71 unsigned int lpid = proc_id % NB_PROCS_MAX; // local processor id 72 unsigned int cluster_xy = proc_id / NB_PROCS_MAX; // cluster index (8 bits format) 73 unsigned int x = cluster_xy >> Y_WIDTH; // x coordinate 74 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); // y coordinate 75 76 unsigned int npixels = NN * NN; // pixels per image 77 unsigned int nblocks = npixels / 512; // blocks per image 78 unsigned int image = 0; // image counter 79 80 unsigned int nclusters = X_SIZE * Y_SIZE; // clusters with procs 81 unsigned int cluster_id = (x * Y_SIZE) + y; // "continuous" cluster index 82 unsigned int ntasks = nclusters * NB_PROCS_MAX; // number of tasks 83 unsigned int task_id = (cluster_id * NB_PROCS_MAX) + lpid; // "continuous" task index 84 84 85 85 // processor [0,0,0] makes parameters checking and barriers initialization … … 100 100 } 101 101 102 if ( ntasks > 1 ) 103 { 104 barrier_init( &barrier_0, ntasks ); 105 barrier_init( &barrier_1, ntasks ); 106 barrier_init( &barrier_2, ntasks ); 107 barrier_init( &barrier_3, ntasks ); 108 barrier_init( &barrier_4, ntasks ); 109 } 102 barrier_init( &barrier_0, ntasks ); 103 barrier_init( &barrier_1, ntasks ); 104 barrier_init( &barrier_2, ntasks ); 105 barrier_init( &barrier_3, ntasks ); 106 barrier_init( &barrier_4, ntasks ); 107 barrier_init( &barrier_5, ntasks ); 110 108 111 109 giet_shr_printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes barrier init at cycle %d\n", 112 0, 0, 0, giet_proctime() ); 110 x, y, lpid, giet_proctime() ); 111 112 giet_shr_printf(" - x_size = %d\n", X_SIZE ); 113 giet_shr_printf(" - y_size = %d\n", Y_SIZE ); 114 giet_shr_printf(" - y_size = %d\n", Y_SIZE ); 115 giet_shr_printf(" - nprocs = %d\n", NB_PROCS_MAX ); 113 116 giet_shr_printf(" - nclusters = %d\n", nclusters ); 114 117 giet_shr_printf(" - ntasks = %d\n", ntasks ); … … 160 163 } 161 164 162 /////////////////////////// //////////////////163 if ( ntasks > 1 )barrier_wait( &barrier_0 );165 /////////////////////////// 166 barrier_wait( &barrier_0 ); 164 167 165 168 // Main loop (on images) … … 185 188 LOAD_END[cluster_id][lpid] = giet_proctime(); 186 189 187 /////////////////////////// //////////////////188 if ( ntasks > 1 )barrier_wait( &barrier_1 );190 /////////////////////////// 191 barrier_wait( &barrier_1 ); 189 192 190 193 // parallel transpose from buf_in to buf_out … … 240 243 TRSP_END[cluster_id][lpid] = giet_proctime(); 241 244 242 /////////////////////////// //////////////////243 if ( ntasks > 1 )barrier_wait( &barrier_2 );245 /////////////////////////// 246 barrier_wait( &barrier_2 ); 244 247 245 248 // optional parallel display from local buf_out to frame buffer … … 265 268 DISP_END[cluster_id][lpid] = giet_proctime(); 266 269 267 /////////////////////////// //////////////////268 if ( ntasks > 1 )barrier_wait( &barrier_3 );270 /////////////////////////// 271 barrier_wait( &barrier_3 ); 269 272 } 270 273 … … 298 301 { 299 302 giet_shr_printf("\n[TRANSPOSE] proc [%d,%d,0] checksum OK" 300 " for image %d \n",301 x, y, image );303 " for image %d at cycle %d\n", 304 x, y, image, giet_proctime() ); 302 305 } 303 306 else 304 307 { 305 308 giet_shr_printf("\n[TRANSPOSE] proc [%d,%d,0] checksum KO" 306 " for image %d\n", 307 x, y, image ); 308 } 309 } 309 " for image %d at cycle %d\n", 310 x, y, image, giet_proctime() ); 311 } 312 } 313 314 /////////////////////////// 315 barrier_wait( &barrier_4 ); 310 316 311 317 // instrumentation done by processor [0,0,0] … … 374 380 375 381 ////////////////////////////////////////////////// 376 // all tasks wait instrumentation completion382 // all tasks must wait instrumentation completion 377 383 ////////////////////////////////////////////////// 378 if ( ntasks > 1 ) barrier_wait( &barrier_4);384 barrier_wait( &barrier_5 ); 379 385 380 386 } // end while image
Note: See TracChangeset
for help on using the changeset viewer.