Changeset 170 for trunk


Ignore:
Timestamp:
May 16, 2011, 10:02:30 AM (14 years ago)
Author:
alain
Message:

Introducing instrumentation in the filter application

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/softs/soft_filter_giet/main.c

    r162 r170  
    146146    unsigned char*      Z[256];
    147147   
     148    // Arrays of pointers on the instrumentation arrays
     149    // These arrays are indexed by the cluster index (sized for the worst case : 256 clusters)
     150    // each pointer points on the base adress of an array of 4 (NPROCS max) unsigned int
     151    unsigned int*       LOAD_START[256];
     152    unsigned int*       LOAD_ENDED[256];
     153    unsigned int*       VERT_START[256];
     154    unsigned int*       VERT_ENDED[256];
     155    unsigned int*       HORI_START[256];
     156    unsigned int*       HORI_ENDED[256];
     157    unsigned int*       DISP_START[256];
     158    unsigned int*       DISP_ENDED[256];
     159
    148160    // The shared, distributed buffers addresses are computed
    149161    // from the seg_heap_base value defined in the ldscript file
     
    153165    for( c=0 ; c<nclusters ; c++)
    154166    {
    155         A[c] = (unsigned short*)(base                           + increment*c);
    156         Z[c] = (unsigned char*) (base + 2*NP*NL/nclusters       + increment*c);
    157         B[c] = (int*)           (base + 4*NP*NL/nclusters       + increment*c);
    158         C[c] = (int*)           (base + 8*NP*NL/nclusters       + increment*c);
    159         D[c] = (int*)           (base + 12*NP*NL/nclusters      + increment*c);
     167        A[c] = (unsigned short*)        (base                           + increment*c);
     168        Z[c] = (unsigned char*)         (base + 2*NP*NL/nclusters       + increment*c);
     169        B[c] = (int*)                   (base + 4*NP*NL/nclusters       + increment*c);
     170        C[c] = (int*)                   (base + 8*NP*NL/nclusters       + increment*c);
     171        D[c] = (int*)                   (base + 12*NP*NL/nclusters      + increment*c);
     172
     173        LOAD_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters       + increment*c);
     174        LOAD_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 16  + increment*c);
     175        VERT_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 32  + increment*c);
     176        VERT_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 48  + increment*c);
     177        HORI_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 64  + increment*c);
     178        HORI_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 80  + increment*c);
     179        DISP_START[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 96  + increment*c);
     180        DISP_ENDED[c] = (unsigned int*) (base + 3*NL*NP/nclusters + 112 + increment*c);
    160181    }
    161182
     
    169190    barrier_init(1, ntasks);
    170191    barrier_init(2, ntasks);
     192    barrier_init(3, ntasks);
    171193
    172194    PRINTF("*** Completing barrier init at cycle %d ***\n", proctime());
     
    179201    if ( lid == 0 )
    180202    {
     203        int p;
    181204        delta = proctime() - date;
    182205        date  = date + delta;
    183206        PRINTF("\n*** Starting load at cycle %d (%d)\n", date, delta);
     207        for ( p=0 ; p<nprocs ; p++ ) LOAD_START[cid][p] = date;
    184208
    185209        if( ioc_read(nblocks*cid/nclusters,
     
    199223        date  = date + delta;
    200224        PRINTF("*** Completing load at cycle %d (%d)\n", date, delta);
     225        for ( p=0 ; p<nprocs ; p++ ) LOAD_ENDED[cid][p] = date;
    201226    }
    202227
     
    215240    date  = date + delta;
    216241    PRINTF("\n*** Starting horizontal filter at cycle %d (%d)\n", date, delta);
     242    HORI_START[cid][lid] = date;
    217243
    218244    // l = absolute line index / p = absolute pixel index 
     
    272298    date  = date + delta;
    273299    PRINTF("*** Completing horizontal filter at cycle %d (%d)\n", date, delta);
     300    HORI_ENDED[cid][lid] = date;
    274301
    275302    barrier_wait(1);
     
    286313    date  = date + delta;
    287314    PRINTF("\n*** starting vertical filter at cycle %d (%d)\n", date, delta);
     315    VERT_START[cid][lid] = date;
    288316
    289317    // l = absolute line index / p = absolute pixel index
     
    361389    date  = date + delta;
    362390    PRINTF("*** Completing vertical filter at cycle %d (%d)\n", date, delta);
     391    VERT_ENDED[cid][lid] = date;
    363392
    364393    barrier_wait(2);
     
    374403    date  = date + delta;
    375404    PRINTF("\n*** Starting display at cycle %d (%d)\n", date, delta);
     405    DISP_START[cid][lid] = date;
    376406
    377407    first = lid*lines_per_task;
     
    390420    date  = date + delta;
    391421    PRINTF("*** Completing display at cycle %d (%d)\n", date, delta);
     422    DISP_ENDED[cid][lid] = date;
     423
     424    barrier_wait(3);
     425
     426    PRINTF("\n*** Starting Instrumentation at cycle %d (%d)\n\n", date, delta);
     427
     428    // Instrumentation (done by processor 0 in all clusters)
     429    int cc, pp;
     430    unsigned int min_load_start = 1000000000;
     431    unsigned int max_load_start = 0;
     432    unsigned int min_load_ended = 1000000000;
     433    unsigned int max_load_ended = 0;
     434
     435    unsigned int min_hori_start = 1000000000;
     436    unsigned int max_hori_start = 0;
     437    unsigned int min_hori_ended = 1000000000;
     438    unsigned int max_hori_ended = 0;
     439
     440    unsigned int min_vert_start = 1000000000;
     441    unsigned int max_vert_start = 0;
     442    unsigned int min_vert_ended = 1000000000;
     443    unsigned int max_vert_ended = 0;
     444
     445    unsigned int min_disp_start = 1000000000;
     446    unsigned int max_disp_start = 0;
     447    unsigned int min_disp_ended = 1000000000;
     448    unsigned int max_disp_ended = 0;
     449
     450    if ( lid == 0 )
     451    {
     452        for ( cc=0 ; cc<nclusters ; cc++ )
     453        {
     454            for ( pp=0 ; pp<nprocs ; pp++ )
     455            {
     456                if ( LOAD_START[cc][pp] < min_load_start ) min_load_start = LOAD_START[cc][pp];
     457                if ( LOAD_START[cc][pp] > max_load_start ) max_load_start = LOAD_START[cc][pp];
     458                if ( LOAD_ENDED[cc][pp] < min_load_ended ) min_load_ended = LOAD_ENDED[cc][pp];
     459                if ( LOAD_ENDED[cc][pp] > max_load_ended ) max_load_ended = LOAD_ENDED[cc][pp];
     460
     461                if ( HORI_START[cc][pp] < min_hori_start ) min_hori_start = HORI_START[cc][pp];
     462                if ( HORI_START[cc][pp] > max_hori_start ) max_hori_start = HORI_START[cc][pp];
     463                if ( HORI_ENDED[cc][pp] < min_hori_ended ) min_hori_ended = HORI_ENDED[cc][pp];
     464                if ( HORI_ENDED[cc][pp] > max_hori_ended ) max_hori_ended = HORI_ENDED[cc][pp];
     465
     466                if ( VERT_START[cc][pp] < min_vert_start ) min_vert_start = VERT_START[cc][pp];
     467                if ( VERT_START[cc][pp] > max_vert_start ) max_vert_start = VERT_START[cc][pp];
     468                if ( VERT_ENDED[cc][pp] < min_vert_ended ) min_vert_ended = VERT_ENDED[cc][pp];
     469                if ( VERT_ENDED[cc][pp] > max_vert_ended ) max_vert_ended = VERT_ENDED[cc][pp];
     470
     471                if ( DISP_START[cc][pp] < min_disp_start ) min_disp_start = DISP_START[cc][pp];
     472                if ( DISP_START[cc][pp] > max_disp_start ) max_disp_start = DISP_START[cc][pp];
     473                if ( DISP_ENDED[cc][pp] < min_disp_ended ) min_disp_ended = DISP_ENDED[cc][pp];
     474                if ( DISP_ENDED[cc][pp] > max_disp_ended ) max_disp_ended = DISP_ENDED[cc][pp];
     475            }
     476        }
     477    }
     478    PRINTF(" - LOAD_START : min = %d / max = %d / med = %d / delta = %d\n",
     479    min_load_start, max_load_start, (min_load_start+max_load_start)/2, max_load_start-min_load_start);
     480    PRINTF(" - LOAD_END   : min = %d / max = %d / med = %d / delta = %d\n",
     481    min_load_ended, max_load_ended, (min_load_ended+max_load_ended)/2, max_load_ended-min_load_ended);
     482
     483    PRINTF(" - HORI_START : min = %d / max = %d / med = %d / delta = %d\n",
     484    min_hori_start, max_hori_start, (min_hori_start+max_hori_start)/2, max_hori_start-min_hori_start);
     485    PRINTF(" - HORI_END   : min = %d / max = %d / med = %d / delta = %d\n",
     486    min_hori_ended, max_hori_ended, (min_hori_ended+max_hori_ended)/2, max_hori_ended-min_hori_ended);
     487
     488    PRINTF(" - VERT_START : min = %d / max = %d / med = %d / delta = %d\n",
     489    min_vert_start, max_vert_start, (min_vert_start+max_vert_start)/2, max_vert_start-min_vert_start);
     490    PRINTF(" - VERT_END   : min = %d / max = %d / med = %d / delta = %d\n",
     491    min_vert_ended, max_vert_ended, (min_vert_ended+max_vert_ended)/2, max_vert_ended-min_vert_ended);
     492
     493    PRINTF(" - DISP_START : min = %d / max = %d / med = %d / delta = %d\n",
     494    min_disp_start, max_disp_start, (min_disp_start+max_disp_start)/2, max_disp_start-min_disp_start);
     495    PRINTF(" - DISP_END   : min = %d / max = %d / med = %d / delta = %d\n",
     496    min_disp_ended, max_disp_ended, (min_disp_ended+max_disp_ended)/2, max_disp_ended-min_disp_ended);
     497
     498    PRINTF(" - BARRIER LOAD/HORI = %d\n", min_hori_start - max_load_ended);
     499    PRINTF(" - BARRIER HORI/VERT = %d\n", min_vert_start - max_hori_ended);
     500    PRINTF(" - BARRIER VERT/DISP = %d\n", min_disp_start - max_vert_ended);
    392501
    393502    while(1);
Note: See TracChangeset for help on using the changeset viewer.