Changeset 432 for soft/giet_vm/applications
- Timestamp:
- Oct 4, 2014, 4:33:31 PM (10 years ago)
- Location:
- soft/giet_vm/applications
- Files:
-
- 1 added
- 7 edited
- 5 copied
- 9 moved
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/convol/main.c
r402 r432 94 94 int z; // vertical filter index for loops 95 95 96 // processor identifiers 97 unsigned int x; // x coordinate 98 unsigned int y; // y coordinate 99 unsigned int lpid; // local proc/task id 100 giet_proc_xyp( &x, &y, &lpid ); 101 96 102 int file = 0; // file descriptor 97 unsigned int pid = giet_procid(); // processor id98 103 unsigned int nprocs = NB_PROCS_MAX; // procs per cluster 99 104 unsigned int nclusters = NB_CLUSTERS; // number of clusters 100 unsigned int lpid = pid % nprocs; // local task id101 unsigned int cluster_xy = pid / nprocs; // cluster index102 unsigned int x = cluster_xy >> Y_WIDTH; // x coordinate103 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); // y coordinate104 105 unsigned int cluster_id = (x * Y_SIZE) + y; // continuous cluster index 105 106 unsigned int task_id = (cluster_id * nprocs) + lpid; // continuous task index … … 145 146 /////////////////////////////////////////////////////////////////// 146 147 147 if ( pid == 0)148 if ( (x==0) && (y==0) && (lpid==0) ) 148 149 { 149 150 giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n" … … 237 238 // Other tasks are waiting on the init_ok condition. 238 239 ////////////////////////////////////////////////////////////////////////// 239 if ( pid == 0)240 if ( (x==0) && (y==0) && (lpid==0) ) 240 241 { 241 242 // open file … … 331 332 x, y, lpid, date ); 332 333 #else 333 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts horizontal filter" 334 " at cycle %d\n", date ); 334 if ( (x==0) && (y==0) && (lpid==0) ) 335 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts horizontal filter" 336 " at cycle %d\n", date ); 335 337 #endif 336 338 … … 404 406 x, y, lpid, date ); 405 407 #else 406 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes horizontal filter" 407 " at cycle %d\n", date ); 408 if ( (x==0) && (y==0) && (lpid==0) ) 409 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes horizontal filter" 410 " at cycle %d\n", date ); 408 411 #endif 409 412 … … 433 436 x, y, lpid, date ); 434 437 #else 435 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts vertical filter" 436 " at cycle %d\n", date ); 438 if ( (x==0) && (y==0) && (lpid==0) ) 439 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts vertical filter" 440 " at cycle %d\n", date ); 437 441 #endif 438 442 … … 522 526 x, y, lpid, date ); 523 527 #else 524 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes vertical filter" 525 " at cycle %d\n", date ); 528 if ( (x==0) && (y==0) && (lpid==0) ) 529 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes vertical filter" 530 " at cycle %d\n", date ); 526 531 #endif 527 532 … … 548 553 x, y, lpid, date); 549 554 #else 550 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts final display" 551 " at cycle %d\n", date ); 555 if ( (x==0) && (y==0) && (lpid==0) ) 556 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts final display" 557 " at cycle %d\n", date ); 552 558 #endif 553 559 … … 579 585 x, y, lpid, date); 580 586 #else 581 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes final display" 582 " at cycle %d\n", date ); 587 if ( (x==0) && (y==0) && (lpid==0) ) 588 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes final display" 589 " at cycle %d\n", date ); 583 590 #endif 584 591 … … 596 603 ///////////////////////////////////////////////////////// 597 604 598 if ( pid == 0)605 if ( (x==0) && (y==0) && (lpid==0) ) 599 606 { 600 607 date = giet_proctime(); -
soft/giet_vm/applications/display/main_cma.c
r297 r432 9 9 __attribute__((constructor)) void main(void) 10 10 { 11 // get processor identifiers 12 unsigned int x; 13 unsigned int y; 14 unsigned int lpid; 15 giet_proc_xyp( &x, &y, &lpid ); 16 11 17 int fd; 12 18 unsigned int blocks_to_skip = 0; 13 unsigned int procid = giet_procid();14 unsigned int cluster_xy = procid/NB_PROCS_MAX;15 unsigned int lpid = procid%NB_PROCS_MAX;16 unsigned int x = cluster_xy >> Y_WIDTH;17 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);18 19 19 20 giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n", -
soft/giet_vm/applications/gameoflife/main.c
r388 r432 17 17 #define NB_ITERATION 1000000000 18 18 19 #define PRINTF(...) ({ if (giet_procid() ==0) { giet_tty_printf(__VA_ARGS__); } })19 #define PRINTF(...) ({ if ( proc_id==0) { giet_tty_printf(__VA_ARGS__); } }) 20 20 21 21 giet_barrier_t barriers[2]; … … 127 127 __attribute__((constructor)) void main() 128 128 { 129 unsigned int proc_id = giet_procid(); // processor id 129 // get processor identifier 130 unsigned int x; 131 unsigned int y; 132 unsigned int p; 133 giet_proc_xyp( &x, &y, &p ); 134 135 // compute continuous processor index 136 unsigned int proc_id = (((x * Y_SIZE) + y) * NB_PROCS_MAX) + p; 137 130 138 unsigned int nlocal_procs = NB_PROCS_MAX; // processors per cluster 131 139 unsigned int nclusters = X_SIZE*Y_SIZE; // number of clusters 132 unsigned int nglobal_procs = nclusters * nlocal_procs; // number of tasks140 unsigned int nglobal_procs = nclusters * nlocal_procs; // number of processors 133 141 size_t i; 134 142 … … 158 166 for (i = 0; i < NB_ITERATION; i++) 159 167 { 160 //PRINTF("\n*** Starting computation for iteration %d at cycle %d\n", i, giet_proctime());161 168 compute_new_gen(base_line, nb_line); 162 //PRINTF("\n*** Starting display for iteration %d at cycle %d\n", i, giet_proctime());163 169 grow_old_world(base_line, nb_line); 164 170 display_world(base_line, nb_line); -
soft/giet_vm/applications/hello/main.c
r387 r432 5 5 { 6 6 char byte; 7 unsigned int procid = giet_procid(); 8 unsigned int cluster_xy = procid/NB_PROCS_MAX; 9 unsigned int lpid = procid%NB_PROCS_MAX; 10 unsigned int x = cluster_xy >> Y_WIDTH; 11 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); 7 8 // get processor identifiers 9 unsigned int x; 10 unsigned int y; 11 unsigned int lpid; 12 giet_proc_xyp( &x, &y, &lpid ); 12 13 13 14 giet_tty_printf( "*** Starting task hello on processor[%d,%d,%d] at cycle %d\n\n", -
soft/giet_vm/applications/pgcd/main.c
r295 r432 8 8 unsigned int opy; 9 9 10 unsigned int procid = giet_procid();11 unsigned int cluster_xy = procid/NB_PROCS_MAX;12 unsigned int lpid = procid%NB_PROCS_MAX;13 unsigned int x = cluster_xy >> Y_WIDTH;14 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);10 // get processor identifiers 11 unsigned int x; 12 unsigned int y; 13 unsigned int lpid; 14 giet_proc_xyp( &x, &y, &lpid ); 15 15 16 16 giet_tty_printf( "*** Starting task pgcd on processor[%d,%d,%d] at cycle %d\n\n", -
soft/giet_vm/applications/router/main.c
r345 r432 20 20 mwmr_channel_t* mwmr; 21 21 22 unsigned int procid = giet_procid();23 unsigned int cluster_xy = procid/NB_PROCS_MAX;24 unsigned int lpid = procid%NB_PROCS_MAX;25 unsigned int x = cluster_xy >> Y_WIDTH;26 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);22 // get processor identifiers 23 unsigned int x; 24 unsigned int y; 25 unsigned int lpid; 26 giet_proc_xyp( &x, &y, &lpid ); 27 27 28 28 printf( "*** Starting task producer on processor[%d,%d,%d] at cycle %d\n\n", … … 52 52 mwmr_channel_t* mwmr; 53 53 54 unsigned int procid = giet_procid();55 unsigned int cluster_xy = procid/NB_PROCS_MAX;56 unsigned int lpid = procid%NB_PROCS_MAX;57 unsigned int x = cluster_xy >> Y_WIDTH;58 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);54 // get processor identifiers 55 unsigned int x; 56 unsigned int y; 57 unsigned int lpid; 58 giet_proc_xyp( &x, &y, &lpid ); 59 59 60 60 printf( "*** Starting task consumer on processor[%d,%d,%d] at cycle %d\n\n", … … 85 85 mwmr_channel_t* mwmr_out ; 86 86 87 unsigned int procid = giet_procid();88 unsigned int cluster_xy = procid/NB_PROCS_MAX;89 unsigned int lpid = procid%NB_PROCS_MAX;90 unsigned int x = cluster_xy >> Y_WIDTH;91 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1);87 // get processor identifiers 88 unsigned int x; 89 unsigned int y; 90 unsigned int lpid; 91 giet_proc_xyp( &x, &y, &lpid ); 92 92 93 93 printf( "*** Starting task router on processor[%d,%d,%d] at cycle %d\n\n", -
soft/giet_vm/applications/transpose/main.c
r398 r432 66 66 unsigned int c; // cluster index for loops 67 67 68 unsigned int proc_id = giet_procid(); // global processor id69 unsigned int lpid = proc_id % NB_PROCS_MAX; // local processor id70 unsigned int cluster_xy = proc_id / NB_PROCS_MAX; // 8 bits format71 unsigned int x = cluster_xy >> Y_WIDTH; // x coordinate72 unsigned int y = cluster_xy & ((1<<Y_WIDTH)-1); // y coordinate68 // get processor identifiers 69 unsigned int x; // x cluster coordinate 70 unsigned int y; // y cluster coordinate 71 unsigned int lpid; // local processor index 72 giet_proc_xyp( &x, &y, &lpid); 73 73 74 74 unsigned int npixels = NN * NN; // pixels per image … … 83 83 // It includes parameters checking, barriers initialization, 84 84 // distributed buffers allocation, and file open 85 if ( proc_id == 0)85 if ( (x==0) && (y==0) && (lpid==0) ) 86 86 { 87 87 // Parameters checking … … 140 140 if (file < 0) 141 141 { 142 giet_shr_printf("\n[TRANSPOSE ERROR] Proc essor[%d,%d,%d]"142 giet_shr_printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d]" 143 143 " cannot open file misc/images.raw", 144 144 x, y, lpid ); … … 147 147 else 148 148 { 149 giet_shr_printf("\n[TRANSPOSE] Proc essor[0,0,0] open file misc/images.raw\n");149 giet_shr_printf("\n[TRANSPOSE] Proc [0,0,0] open file misc/images.raw\n"); 150 150 } 151 151 init_ok = 0; … … 154 154 { 155 155 while ( init_ok == 1 ); 156 giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n", x, y, lpid); 156 157 } 157 158 158 159 159 ///////////////////////// 160 160 // Main loop (on images) … … 173 173 ((image*nblocks) + ((nblocks*cluster_id)/NB_CLUSTERS)) ); 174 174 175 giet_shr_printf("\n[TRANSPOSE] Proc [%d,%d, 0] completes load"175 giet_shr_printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes load" 176 176 " for image %d at cycle %d\n", 177 x, y, image, giet_proctime() );177 x, y, lpid, image, giet_proctime() ); 178 178 } 179 179 … … 307 307 barrier_wait( &barrier ); 308 308 309 // instrumentation done by processor [0,0,0] 310 311 if ( (proc_id == 0) && INSTRUMENTATION_OK ) 309 // instrumentation done by processor [0,0,0] 310 if ( (x==0) && (y==0) && (lpid==0) && INSTRUMENTATION_OK ) 312 311 { 313 312 int cc, pp; … … 377 376 378 377 // Processor[0,0,0] releases the Distributed buffers 379 if ( proc_id == 0)378 if ( (x==0) && (y==0) && (lpid==0) ) 380 379 { 381 380 for ( c = 0 ; c < NB_CLUSTERS ; c++ )
Note: See TracChangeset
for help on using the changeset viewer.