Ignore:
Timestamp:
Nov 3, 2014, 12:40:50 PM (10 years ago)
Author:
alain
Message:

Introducing application "display"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/convol/main.c

    r432 r444  
    33// Date   : june 2014
    44// author : Alain Greiner
     5////////////////////////////////////////////////////////////////////////////////////////////
     6// This multi-threaded application application implements a 2D convolution product. 
     7// The convolution kernel is [201]*[35] pixels, but it can be factored in two
     8// independant line and column convolution products.
     9// It can run on a multi-processors, multi-clusters architecture, with one thread
     10// per processor. It uses the he following hardware parameters, that must be defined
     11// in the hard_config.h file:
     12// - X_SIZE       : number of clusters in a row
     13// - Y_SIZE       : number of clusters in a column
     14// - NB_PROCS_MAX : number of processors per cluster
     15// - FBUF_X_SIZE  : number of pixels per line in frame buffer
     16// - FBUF_Y_SIZE  : number of lines  in frame buffer
     17//
     18// The (1024 * 1024) pixels image is read from a file (2 bytes per pixel).
    519//
    6 // The "convol" application implements a 2D convolution product. 
     20// - The number of clusters containing processors must be a power of 2.
     21// - The number of processors per cluster must be a power of 2.
    722////////////////////////////////////////////////////////////////////////////////////////////
    823
     
    106121    unsigned int task_id     = (cluster_id * nprocs) + lpid;  // continuous task index
    107122    unsigned int ntasks      = nclusters * nprocs;            // number of tasks
    108     unsigned int npixels     = NB_PIXELS;                     // pixels per frame
    109123    unsigned int frame_size  = FRAME_SIZE;                    // total size (bytes)
    110124    unsigned int nblocks     = frame_size / 512;              // number of blocks per frame
     
    126140     // parameters checking
    127141   
     142    if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) )
     143    {
     144        giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
     145    }
    128146    if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4))
    129147        giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n");
     
    148166    if ( (x==0) && (y==0) && (lpid==0) )
    149167    {
     168        // parameters checking
     169        if ( (NP != FBUF_X_SIZE) || (NL != FBUF_Y_SIZE) )
     170            giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
     171       
     172        if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4))
     173            giet_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2 or 4\n");
     174
     175        if ((X_SIZE!=1) && (X_SIZE!=2) && (X_SIZE!=4) && (X_SIZE!=8) && (X_SIZE!=16))
     176            giet_exit( "[CONVOL ERROR] X_SIZE must be 1, 2, 4, 8, 16\n");
     177       
     178        if ((Y_SIZE!=1) && (Y_SIZE!=2) && (Y_SIZE!=4) && (Y_SIZE!=8) && (Y_SIZE!=16))
     179            giet_exit( "[CONVOL ERROR] Y_SIZE must be 1, 2, 4, 8, 16\n");
     180
     181        if ( NL % nclusters != 0 )
     182            giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NL");
     183
     184        if ( NP % nclusters != 0 )
     185            giet_exit( "[CONVOL ERROR] NB_CLUSTERS must be a divider of NP");
     186
     187   
    150188        giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n"
    151189                        "- NB_CLUSTERS     = %d\n"
    152                         "- NB_LOCAL_PROCS  = %d\n"
     190                        "- NB_PROCS_MAX    = %d\n"
    153191                        "- NB_TASKS        = %d\n"
    154                         "- NB_PIXELS       = %x\n"           
    155                         "- FRAME_SIZE      = %x\n"             
    156192                        "- NB_BLOCKS       = %x\n",
    157                         giet_proctime(), nclusters, nprocs, ntasks,
    158                         npixels, frame_size, nblocks );
     193                        giet_proctime(), nclusters, nprocs, ntasks, nblocks );
    159194#if USE_SBT_BARRIER
    160195        sbt_barrier_init( &barrier, ntasks );
     
    294329            }
    295330
    296             giet_fb_sync_write( NP*(l + (task_id * lines_per_task) ),
    297                                 &TZ(cluster_id, line, 0),
    298                                 NP);
     331            giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ),
     332                                 &TZ(cluster_id, line, 0),
     333                                 NP);
    299334        }
    300335
     
    572607            }
    573608
    574             giet_fb_sync_write( NP*(l + (task_id * lines_per_task) ),
    575                                 &TZ(cluster_id, line, 0),
    576                                 NP);
     609            giet_fbf_sync_write( NP*(l + (task_id * lines_per_task) ),
     610                                 &TZ(cluster_id, line, 0),
     611                                 NP);
    577612        }
    578613
Note: See TracChangeset for help on using the changeset viewer.