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/transpose/main.c

    r432 r444  
    1 ///////////////////////////////////////////////////////////////////////////////////////////////
     1/////////////////////////////////////////////////////////////////////////////////////////////
    22// File   : main.c   (for transpose application)
    33// Date   : february 2014
    44// author : Alain Greiner
    5 //
    6 // This application makes a transpose for a NN*NN pixels sequence of images.
     5/////////////////////////////////////////////////////////////////////////////////////////////
     6// This multi-threaded application makes a transpose for a NN*NN pixels sequence of images.
     7// It can run on a multi-processors, multi-clusters architecture, with one thread
     8// per processor. It uses the he following hardware parameters, that must be defined
     9// in the hard_config.h file:
     10// - X_SIZE       : number of clusters in a row
     11// - Y_SIZE       : number of clusters in a column
     12// - NB_PROCS_MAX : number of processors per cluster
     13// - FBUF_X_SIZE  : number of pixels per line in frame buffer
     14// - FBUF_Y_SIZE  : number of lines  in frame buffer
     15//
    716// The image sequence is read from a file (one byte per pixel).
    817// The input and output buffers containing the image are distributed in all clusters.
    918//
    10 // - The image size NN must be a power of 2.
     19// - The image size NN must be a power of 2 and must fit the frame buffer size.
    1120// - The number of clusters containing processors must be a power of 2.
    12 // - The number of processors per cluster (NB_PROCS_MAX) must be a power of 2.
     21// - The number of processors per cluster must be a power of 2.
    1322// - The image size NN must be larger or equal to the total number of processor.
    1423//
    1524// For each image the application makes a self test (checksum for each line).
    1625// The actual display on the frame buffer depends on frame buffer availability.
    17 ///////////////////////////////////////////////////////////////////////////////////////////////
     26/////////////////////////////////////////////////////////////////////////////////////////////
    1827
    1928#include "hard_config.h"
     
    2332
    2433#define NN                  128                 // image size : nlines = npixels = 128
    25 #define NB_IMAGES           2                   // number of images to be handled
     34#define NB_IMAGES           5                   // number of images to be handled
    2635#define FILE_PATHNAME       "misc/images.raw"   // file pathname on disk
    2736#define NB_CLUSTERS         (X_SIZE * Y_SIZE)   // number of clusters
     
    5463giet_barrier_t barrier;
    5564
    56 volatile unsigned int init_ok = 1;
     65volatile unsigned int init_ok = 0;
    5766
    5867//////////////////////////////////////////
     
    8695    {
    8796        // Parameters checking
     97        if ( (NN != FBUF_X_SIZE) || (NN != FBUF_Y_SIZE) )
     98        {
     99            giet_exit("[TRANSPOSE ERROR] Frame buffer size does not fit image size");
     100        }
    88101        if ((NB_PROCS_MAX != 1) && (NB_PROCS_MAX != 2) && (NB_PROCS_MAX != 4))
    89102        {
     
    149162            giet_shr_printf("\n[TRANSPOSE] Proc [0,0,0] open file misc/images.raw\n");
    150163        }
    151         init_ok = 0;
     164        init_ok = 1;
    152165    }
    153166    else   // others processors wait initialisation completion
    154167    {
    155         while ( init_ok == 1 );
    156         giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n", x, y, lpid);
     168        while ( init_ok == 0 );
     169        giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n",
     170                        x, y, lpid, giet_proctime() );
    157171    }
    158172   
     
    247261            unsigned int  npt   = npixels / ntasks;   // number of pixels per task
    248262
    249             giet_fb_sync_write( npt * task_id,
    250                                 &buf_out[cluster_id][lpid*npt],
    251                                 npt );
     263            giet_fbf_sync_write( npt * task_id,
     264                                 &buf_out[cluster_id][lpid*npt],
     265                                 npt );
    252266
    253267            if ( lpid == 0 )
Note: See TracChangeset for help on using the changeset viewer.