Changeset 669 for soft/giet_vm/applications/convol
- Timestamp:
- Jul 27, 2015, 8:40:45 PM (9 years ago)
- Location:
- soft/giet_vm/applications/convol
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/convol/convol.py
r610 r669 40 40 41 41 data_base = 0x20000000 42 data_size = 0x000 10000 # 64Kbytes (non replicated)42 data_size = 0x00020000 # 128 Kbytes (non replicated) 43 43 44 44 heap_base = 0x40000000 … … 49 49 50 50 # create Vspace 51 vspace = mapping.addVspace( name = 'convol', startname = 'conv_data' )51 vspace = mapping.addVspace( name = 'convol', startname = 'conv_data', active = False ) 52 52 53 53 # data vseg in cluster[0,0] : non local -
soft/giet_vm/applications/convol/main.c
r589 r669 1 1 /////////////////////////////////////////////////////////////////////////////////////// 2 // File : main.c ( forconvol application)2 // File : main.c (convol application) 3 3 // Date : june 2014 4 4 // author : Alain Greiner … … 22 22 23 23 #define USE_SQT_BARRIER 1 24 #define VERBOSE 024 #define VERBOSE 1 25 25 #define SUPER_VERBOSE 0 26 26 … … 49 49 #define max(x,y) ((x) > (y) ? (x) : (y)) 50 50 #define min(x,y) ((x) < (y) ? (x) : (y)) 51 52 // macro to use a shared TTY 53 #define printf(...) lock_acquire( &tty_lock ); \ 54 giet_tty_printf(__VA_ARGS__); \ 55 lock_release( &tty_lock ) 51 56 52 57 // global instrumentation counters (cluster_id, lpid] … … 60 65 unsigned int D_END[CLUSTERS_MAX][PROCS_MAX]; 61 66 62 // global synchronization barrier 67 // global synchronization barriers 63 68 64 69 #if USE_SQT_BARRIER … … 71 76 volatile unsigned int load_image_ok = 0; 72 77 volatile unsigned int instrumentation_ok = 0; 78 79 // lock protecting access to shared TTY 80 user_lock_t tty_lock; 73 81 74 82 // global pointers on distributed buffers in all clusters … … 138 146 START[cluster_id][lpid] = date; 139 147 140 #if VERBOSE141 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts at cycle %d\n", x,y,lpid, date );142 #endif143 144 148 // parameters checking 145 149 … … 161 165 162 166 /////////////////////////////////////////////////////////////////// 163 // task[0][0][0] makes barrier initialisation167 // task[0][0][0] makes various initialisations 164 168 /////////////////////////////////////////////////////////////////// 165 169 166 170 if ( (x==0) && (y==0) && (lpid==0) ) 167 171 { 168 giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n" 169 "- CLUSTERS = %d\n" 170 "- PROCS = %d\n" 171 "- TASKS = %d\n" 172 "- LINES/TASK = %d\n", 173 giet_proctime(), nclusters, nprocs, ntasks, lines_per_task ); 172 // get a shared TTY 173 giet_tty_alloc( 1 ); 174 175 // initializes TTY lock 176 lock_init( &tty_lock ); 177 178 // initializes the distributed heap[x,y] 179 unsigned int cx; 180 unsigned int cy; 181 for ( cx = 0 ; cx < x_size ; cx++ ) 182 { 183 for ( cy = 0 ; cy < y_size ; cy++ ) 184 { 185 heap_init( cx , cy ); 186 } 187 } 188 174 189 #if USE_SQT_BARRIER 175 190 sqt_barrier_init( &barrier, x_size , y_size , nprocs ); … … 178 193 #endif 179 194 180 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes barrier init at cycle %d\n", 181 giet_proctime() ); 195 printf("\n[CONVOL] task[0,0,0] completes initialisation at cycle %d\n" 196 "- CLUSTERS = %d\n" 197 "- PROCS = %d\n" 198 "- TASKS = %d\n" 199 "- LINES/TASK = %d\n", 200 giet_proctime(), nclusters, nprocs, ntasks, lines_per_task ); 182 201 183 202 barrier_init_ok = 1; … … 196 215 197 216 #if VERBOSE 198 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] enters malloc at cycle %d\n",217 printf( "\n[CONVOL] task[%d,%d,%d] enters malloc at cycle %d\n", 199 218 x,y,lpid, date ); 200 219 #endif … … 207 226 208 227 #if VERBOSE 209 giet_shr_printf( "\n[CONVOL] Shared Buffer Virtual Addresses in cluster(%d,%d)\n"210 211 212 213 214 215 216 217 218 219 220 228 printf( "\n[CONVOL] Shared Buffer Virtual Addresses in cluster(%d,%d)\n" 229 "### GA = %x\n" 230 "### GB = %x\n" 231 "### GC = %x\n" 232 "### GD = %x\n" 233 "### GZ = %x\n", 234 x, y, 235 GA[cluster_id], 236 GB[cluster_id], 237 GC[cluster_id], 238 GD[cluster_id], 239 GZ[cluster_id] ); 221 240 #endif 222 241 } … … 257 276 { 258 277 // open file 259 file = giet_fat_open( " misc/philips_image.raw" , 0 );278 file = giet_fat_open( "/misc/philips_1024.raw" , 0 ); 260 279 if ( file < 0 ) giet_exit( "[CONVOL ERROR] task[0,0,0] cannot open" 261 " file misc/philips_image.raw" );280 " file /misc/philips_1024.raw" ); 262 281 263 giet_shr_printf( "\n[CONVOL] task[0,0,0] open file misc/philips_image.raw"264 282 printf( "\n[CONVOL] task[0,0,0] open file /misc/philips_1024.raw" 283 " at cycle %d\n", giet_proctime() ); 265 284 266 285 for ( c = 0 ; c < nclusters ; c++ ) 267 286 { 268 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts load "269 287 printf( "\n[CONVOL] task[0,0,0] starts load " 288 "for cluster %d at cycle %d\n", c, giet_proctime() ); 270 289 271 290 giet_fat_lseek( file, … … 277 296 frame_size/nclusters ); 278 297 279 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes load "280 298 printf( "\n[CONVOL] task[0,0,0] completes load " 299 "for cluster %d at cycle %d\n", c, giet_proctime() ); 281 300 } 282 301 load_image_ok = 1; … … 296 315 297 316 #if VERBOSE 298 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts initial display"299 300 317 printf( "\n[CONVOL] task[%d,%d,%d] starts initial display" 318 " at cycle %d\n", 319 x, y, lpid, giet_proctime() ); 301 320 #endif 302 321 … … 319 338 320 339 #if VERBOSE 321 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] completes initial display"322 323 340 printf( "\n[CONVOL] task[%d,%d,%d] completes initial display" 341 " at cycle %d\n", 342 x, y, lpid, giet_proctime() ); 324 343 #endif 325 344 … … 347 366 348 367 #if VERBOSE 349 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts horizontal filter"350 351 368 printf( "\n[CONVOL] task[%d,%d,%d] starts horizontal filter" 369 " at cycle %d\n", 370 x, y, lpid, date ); 352 371 #else 353 372 if ( (x==0) && (y==0) && (lpid==0) ) 354 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts horizontal filter"355 373 printf( "\n[CONVOL] task[0,0,0] starts horizontal filter" 374 " at cycle %d\n", date ); 356 375 #endif 357 376 … … 412 431 413 432 #if SUPER_VERBOSE 414 giet_shr_printf(" - line %d computed at cycle %d\n", l, giet_proctime() );433 printf(" - line %d computed at cycle %d\n", l, giet_proctime() ); 415 434 #endif 416 435 … … 421 440 422 441 #if VERBOSE 423 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] completes horizontal filter"424 425 442 printf( "\n[CONVOL] task[%d,%d,%d] completes horizontal filter" 443 " at cycle %d\n", 444 x, y, lpid, date ); 426 445 #else 427 446 if ( (x==0) && (y==0) && (lpid==0) ) 428 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes horizontal filter"429 447 printf( "\n[CONVOL] task[0,0,0] completes horizontal filter" 448 " at cycle %d\n", date ); 430 449 #endif 431 450 … … 451 470 452 471 #if VERBOSE 453 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts vertical filter"454 455 472 printf( "\n[CONVOL] task[%d,%d,%d] starts vertical filter" 473 " at cycle %d\n", 474 x, y, lpid, date ); 456 475 #else 457 476 if ( (x==0) && (y==0) && (lpid==0) ) 458 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts vertical filter"459 477 printf( "\n[CONVOL] task[0,0,0] starts vertical filter" 478 " at cycle %d\n", date ); 460 479 #endif 461 480 … … 532 551 533 552 #if SUPER_VERBOSE 534 giet_shr_printf(" - column %d computed at cycle %d\n", p, giet_proctime());553 printf(" - column %d computed at cycle %d\n", p, giet_proctime()); 535 554 #endif 536 555 … … 541 560 542 561 #if VERBOSE 543 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] completes vertical filter"544 545 562 printf( "\n[CONVOL] task[%d,%d,%d] completes vertical filter" 563 " at cycle %d\n", 564 x, y, lpid, date ); 546 565 #else 547 566 if ( (x==0) && (y==0) && (lpid==0) ) 548 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes vertical filter"549 567 printf( "\n[CONVOL] task[0,0,0] completes vertical filter" 568 " at cycle %d\n", date ); 550 569 #endif 551 570 … … 568 587 569 588 #if VERBOSE 570 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] starts final display"571 572 589 printf( "\n[CONVOL] task[%d,%d,%d] starts final display" 590 " at cycle %d\n", 591 x, y, lpid, date); 573 592 #else 574 593 if ( (x==0) && (y==0) && (lpid==0) ) 575 giet_shr_printf( "\n[CONVOL] task[0,0,0] starts final display"576 594 printf( "\n[CONVOL] task[0,0,0] starts final display" 595 " at cycle %d\n", date ); 577 596 #endif 578 597 … … 600 619 601 620 #if VERBOSE 602 giet_shr_printf( "\n[CONVOL] task[%d,%d,%d] completes final display"603 604 621 printf( "\n[CONVOL] task[%d,%d,%d] completes final display" 622 " at cycle %d\n", 623 x, y, lpid, date); 605 624 #else 606 625 if ( (x==0) && (y==0) && (lpid==0) ) 607 giet_shr_printf( "\n[CONVOL] task[0,0,0] completes final display"608 626 printf( "\n[CONVOL] task[0,0,0] completes final display" 627 " at cycle %d\n", date ); 609 628 #endif 610 629 … … 625 644 { 626 645 date = giet_proctime(); 627 giet_shr_printf("\n[CONVOL] task[0,0,0] starts instrumentation"628 646 printf("\n[CONVOL] task[0,0,0] starts instrumentation" 647 " at cycle %d\n\n", date ); 629 648 630 649 int cc, pp; … … 678 697 } 679 698 680 giet_shr_printf(" - START : min = %d / max = %d / med = %d / delta = %d\n",699 printf(" - START : min = %d / max = %d / med = %d / delta = %d\n", 681 700 min_start, max_start, (min_start+max_start)/2, max_start-min_start); 682 701 683 giet_shr_printf(" - H_BEG : min = %d / max = %d / med = %d / delta = %d\n",702 printf(" - H_BEG : min = %d / max = %d / med = %d / delta = %d\n", 684 703 min_h_beg, max_h_beg, (min_h_beg+max_h_beg)/2, max_h_beg-min_h_beg); 685 704 686 giet_shr_printf(" - H_END : min = %d / max = %d / med = %d / delta = %d\n",705 printf(" - H_END : min = %d / max = %d / med = %d / delta = %d\n", 687 706 min_h_end, max_h_end, (min_h_end+max_h_end)/2, max_h_end-min_h_end); 688 707 689 giet_shr_printf(" - V_BEG : min = %d / max = %d / med = %d / delta = %d\n",708 printf(" - V_BEG : min = %d / max = %d / med = %d / delta = %d\n", 690 709 min_v_beg, max_v_beg, (min_v_beg+max_v_beg)/2, max_v_beg-min_v_beg); 691 710 692 giet_shr_printf(" - V_END : min = %d / max = %d / med = %d / delta = %d\n",711 printf(" - V_END : min = %d / max = %d / med = %d / delta = %d\n", 693 712 min_v_end, max_v_end, (min_v_end+max_v_end)/2, max_v_end-min_v_end); 694 713 695 giet_shr_printf(" - D_BEG : min = %d / max = %d / med = %d / delta = %d\n",714 printf(" - D_BEG : min = %d / max = %d / med = %d / delta = %d\n", 696 715 min_d_beg, max_d_beg, (min_d_beg+max_d_beg)/2, max_d_beg-min_d_beg); 697 716 698 giet_shr_printf(" - D_END : min = %d / max = %d / med = %d / delta = %d\n",717 printf(" - D_END : min = %d / max = %d / med = %d / delta = %d\n", 699 718 min_d_end, max_d_end, (min_d_end+max_d_end)/2, max_d_end-min_d_end); 700 719 701 giet_shr_printf( "\n General Scenario (Kcycles for each step)\n" );702 giet_shr_printf( " - BOOT OS = %d\n", (min_start )/1000 );703 giet_shr_printf( " - LOAD IMAGE = %d\n", (min_h_beg - min_start)/1000 );704 giet_shr_printf( " - H_FILTER = %d\n", (max_h_end - min_h_beg)/1000 );705 giet_shr_printf( " - BARRIER HORI/VERT = %d\n", (min_v_beg - max_h_end)/1000 );706 giet_shr_printf( " - V_FILTER = %d\n", (max_v_end - min_v_beg)/1000 );707 giet_shr_printf( " - BARRIER VERT/DISP = %d\n", (min_d_beg - max_v_end)/1000 );708 giet_shr_printf( " - DISPLAY = %d\n", (max_d_end - min_d_beg)/1000 );720 printf( "\n General Scenario (Kcycles for each step)\n" ); 721 printf( " - BOOT OS = %d\n", (min_start )/1000 ); 722 printf( " - LOAD IMAGE = %d\n", (min_h_beg - min_start)/1000 ); 723 printf( " - H_FILTER = %d\n", (max_h_end - min_h_beg)/1000 ); 724 printf( " - BARRIER HORI/VERT = %d\n", (min_v_beg - max_h_end)/1000 ); 725 printf( " - V_FILTER = %d\n", (max_v_end - min_v_beg)/1000 ); 726 printf( " - BARRIER VERT/DISP = %d\n", (min_d_beg - max_v_end)/1000 ); 727 printf( " - DISPLAY = %d\n", (max_d_end - min_d_beg)/1000 ); 709 728 710 729 instrumentation_ok = 1;
Note: See TracChangeset
for help on using the changeset viewer.