Ignore:
Timestamp:
Feb 12, 2014, 1:42:52 PM (10 years ago)
Author:
alain
Message:

Introducing support for RAMDISK in giet_tsar

File:
1 edited

Legend:

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

    r629 r631  
    88#define NP              128
    99#define NB_IMAGES       5
    10 
     10 
     11// Only processor 0 in each cluster access TTY
    1112#define PRINTF(...)      ({ if (lpid == 0) { _tty_printf(__VA_ARGS__); } })
    1213
    13 #define DISPLAY_OK
    14 
    15 // tricks to read parameters from ldscript
     14#define DISPLAY_OK          1   // enable display on frame buffer when non zero
     15#define CHECK_VERBOSE       1   // display a detailed check on TTY  when non zero
     16#define INSTRUMENTATION_OK  0   // display statistcs on TTY when non zero
     17
     18// tricks to read some addresses from ldscript
    1619extern struct plaf seg_ioc_base;
    1720extern struct plaf seg_heap_base;
     
    1922// global variables stored in seg_data (cluster 0)
    2023
    21 // instrumentation counters for each processor
     24// instrumentation counters (for each processor)
    2225unsigned int LOAD_START[256][4];
    2326unsigned int LOAD_END  [256][4];
     
    2730unsigned int DISP_END  [256][4];
    2831
    29 // checksum variables
     32// checksum variables (used by proc(0,0,0) only
    3033unsigned check_line_before[NL];
    3134unsigned check_line_after[NL];
     
    5861    unsigned int cluster_id  = (x * Y_SIZE) + y;               
    5962
    60     PRINTF("\n *** Proc 0 in cluster [%d,%d] enters main at cycle %d ***\n\n",
     63    PRINTF("\n *** Proc [%d,%d,0] enters main at cycle %d ***\n\n",
    6164           x, y, _proctime());
    6265
     
    9699   _barrier_init(3, ntasks);
    97100
    98    PRINTF("*** Proc 0 in cluster [%d,%d] completes barrier init at cycle %d\n",
     101   PRINTF("*** Proc [%d,%d,0] completes barrier init at cycle %d\n",
    99102          x, y, _proctime());
    100103
     
    109112      if (lpid == 0)
    110113      {
     114         PRINTF("\n*** Proc [%d,%d,0] starts load for image %d at cycle %d\n",
     115                x, y, image, _proctime() );
     116
    111117         _ioc_read( ((image * nblocks) + ((nblocks * cluster_id) / nclusters)),
    112118                    buf_in,
     
    114120                    cluster_xy );
    115121
    116          PRINTF("\n*** Proc 0 in cluster [%d,%d] starts load for image %d at cycle %d\n",
    117                 x, y, image, _proctime() );
    118 
    119122         _ioc_completed();
    120123
    121          PRINTF("*** Proc 0 in cluster [%d,%d] completes load for image %d at cycle %d\n",
     124         PRINTF("*** Proc [%d,%d,0] completes load for image %d at cycle %d\n",
    122125                x, y, image, _proctime() );
    123126      }
     
    131134      // (p,l) are the pixel coordinates in the source image
    132135
    133       PRINTF("\n*** proc 0 in cluster [%d,%d] starts transpose for image %d at cycle %d\n",
     136      PRINTF("\n*** proc [%d,%d,0] starts transpose for image %d at cycle %d\n",
    134137             x, y, image, _proctime());
    135138
     
    203206      }
    204207
    205       PRINTF("*** proc 0 in cluster [%d,%d] complete transpose for image %d at cycle %d\n",
     208      PRINTF("*** proc [%d,%d,0] complete transpose for image %d at cycle %d\n",
    206209             x, y, image, _proctime() );
    207210
     
    212215      // optional parallel display from local buf_out to frame buffer
    213216
    214 #ifdef DISPLAY_OK
    215 
    216       PRINTF("\n*** proc 0 in cluster [%d,%d] starts display for image %d at cycle %d\n",
    217              x, y, image, _proctime() );
    218 
    219       DISP_START[cluster_id][lpid] = _proctime();
    220 
    221       unsigned int npxt = npixels / ntasks;   // number of pixels per task
    222       unsigned int buffer = (unsigned int)buf_out + npxt*lpid;
    223 
    224       _fb_sync_write( npxt * task_id, buffer, npxt, cluster_xy );
    225 
    226       PRINTF("*** Proc 0 in cluster [%d,%d] completes display for image %d at cycle %d\n",
    227              x, y, image, _proctime() );
    228 
    229       DISP_END[cluster_id][lpid] = _proctime();
    230 
    231       _barrier_wait(2);
    232 
    233 #endif
    234 
    235       // Instrumentation and checksum (done by processor 0 in cluster 0)
    236       if (proc_id == 0)
    237       { 
    238          PRINTF("\n*** Proc [0,0,0] starts checks for image %d at cycle %d\n\n",
    239                   image, _proctime() );
     217      if ( DISPLAY_OK )
     218      {
     219          PRINTF("\n*** proc [%d,%d,0] starts display for image %d at cycle %d\n",
     220                 x, y, image, _proctime() );
     221
     222          DISP_START[cluster_id][lpid] = _proctime();
     223
     224          unsigned int npxt = npixels / ntasks;   // number of pixels per task
     225          unsigned int buffer = (unsigned int)buf_out + npxt*lpid;
     226
     227          _fb_sync_write( npxt * task_id, buffer, npxt, cluster_xy );
     228
     229          PRINTF("*** Proc [%d,%d,0] completes display for image %d at cycle %d\n",
     230                 x, y, image, _proctime() );
     231
     232          DISP_END[cluster_id][lpid] = _proctime();
     233
     234          _barrier_wait(2);
     235      }
     236
     237      // checksum (done by processor 0 in each cluster)
     238
     239      if ( lpid == 0 )
     240      {
     241         PRINTF("\n*** Proc [%d,%d,0] starts checks for image %d at cycle %d\n\n",
     242                x, y, image, _proctime() );
    240243
    241244         unsigned int success = 1;
    242 
    243          for ( l = 0 ; l < NL ; l++ )
     245         unsigned int start   = cluster_id * (NL / nclusters);
     246         unsigned int stop    = start + (NL / nclusters);
     247
     248         for ( l = start ; l < stop ; l++ )
    244249         {
    245250            check_line_after[l] = 0;
     
    258263            }
    259264
    260             PRINTF(" - l = %d / before = %d / after = %d \n",
    261                    l, check_line_before[l], check_line_after[l] );
     265            if( CHECK_VERBOSE )
     266            {
     267                PRINTF(" - l = %d / before = %d / after = %d \n",
     268                       l, check_line_before[l], check_line_after[l] );
     269            }
    262270
    263271            if ( check_line_before[l] != check_line_after[l] ) success = 0;
    264272         }
    265273
    266          if ( success ) PRINTF("\n*** proc [0,0,0] : CHECKSUM OK \n\n");
    267          else           PRINTF("\n*** proc [0,0,0] : CHECKSUM KO \n\n");
    268 
     274         if ( success ) PRINTF("\n*** proc [%d,%d,0] : CHECKSUM OK \n\n", x, y);
     275         else           PRINTF("\n*** proc [%d,%d,0] : CHECKSUM KO \n\n", x, y);
     276      }
     277
     278      // instrumentation ( done by processor [0,0,0]
     279
     280      if ( (proc_id == 0) && INSTRUMENTATION_OK )
     281      {
    269282         int cc, pp;
    270283         unsigned int min_load_start = INT_MAX;
Note: See TracChangeset for help on using the changeset viewer.