Ignore:
Timestamp:
Oct 4, 2014, 4:33:31 PM (10 years ago)
Author:
alain
Message:

1) Introduce the "applications" directory.
2) Introduce the fixed format (X_WIDTH / Y_WIDTH / P_WIDTH) for processor index in all applications.

Location:
soft/giet_vm/applications
Files:
1 added
7 edited
5 copied
9 moved

Legend:

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

    r402 r432  
    9494    int z; // vertical filter index for loops
    9595
     96    // processor identifiers
     97    unsigned int x;                                           // x coordinate
     98    unsigned int y;                                           // y coordinate
     99    unsigned int lpid;                                        // local proc/task id
     100    giet_proc_xyp( &x, &y, &lpid );
     101
    96102    int          file        = 0;                             // file descriptor
    97     unsigned int pid         = giet_procid();                 // processor id
    98103    unsigned int nprocs      = NB_PROCS_MAX;                  // procs per cluster
    99104    unsigned int nclusters   = NB_CLUSTERS;                   // number of clusters
    100     unsigned int lpid        = pid % nprocs;                  // local task id
    101     unsigned int cluster_xy  = pid / nprocs;                  // cluster index
    102     unsigned int x           = cluster_xy >> Y_WIDTH;         // x coordinate
    103     unsigned int y           = cluster_xy & ((1<<Y_WIDTH)-1); // y coordinate
    104105    unsigned int cluster_id  = (x * Y_SIZE) + y;              // continuous cluster index
    105106    unsigned int task_id     = (cluster_id * nprocs) + lpid;  // continuous task index
     
    145146    ///////////////////////////////////////////////////////////////////
    146147   
    147     if ( pid == 0 )
     148    if ( (x==0) && (y==0) && (lpid==0) )
    148149    {
    149150        giet_shr_printf("\n[CONVOL] task[0,0,0] starts barrier init at cycle %d\n"
     
    237238    // Other tasks are waiting on the init_ok condition.
    238239    //////////////////////////////////////////////////////////////////////////
    239     if ( pid == 0 )
     240    if ( (x==0) && (y==0) && (lpid==0) )
    240241    {
    241242        // open file
     
    331332                 x, y, lpid, date );
    332333#else
    333 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts horizontal filter"
    334                                  " at cycle %d\n", date );
     334if ( (x==0) && (y==0) && (lpid==0) )
     335giet_shr_printf( "\n[CONVOL] task[0,0,0] starts horizontal filter"
     336                 " at cycle %d\n", date );
    335337#endif
    336338
     
    404406                 x, y, lpid, date );
    405407#else
    406 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes horizontal filter"
    407                                  " at cycle %d\n", date );
     408if ( (x==0) && (y==0) && (lpid==0) )
     409giet_shr_printf( "\n[CONVOL] task[0,0,0] completes horizontal filter"
     410                 " at cycle %d\n", date );
    408411#endif
    409412
     
    433436                 x, y, lpid, date );
    434437#else
    435 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts vertical filter"
    436                                  " at cycle %d\n", date );
     438if ( (x==0) && (y==0) && (lpid==0) )
     439giet_shr_printf( "\n[CONVOL] task[0,0,0] starts vertical filter"
     440                 " at cycle %d\n", date );
    437441#endif
    438442
     
    522526                 x, y, lpid, date );
    523527#else
    524 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes vertical filter"
    525                                  " at cycle %d\n", date );
     528if ( (x==0) && (y==0) && (lpid==0) )
     529giet_shr_printf( "\n[CONVOL] task[0,0,0] completes vertical filter"
     530                 " at cycle %d\n", date );
    526531#endif
    527532
     
    548553                 x, y, lpid, date);
    549554#else
    550 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] starts final display"
    551                                  " at cycle %d\n", date );
     555if ( (x==0) && (y==0) && (lpid==0) )
     556giet_shr_printf( "\n[CONVOL] task[0,0,0] starts final display"
     557                 " at cycle %d\n", date );
    552558#endif
    553559
     
    579585                 x, y, lpid, date);
    580586#else
    581 if ( pid == 0 ) giet_shr_printf( "\n[CONVOL] task[0,0,0] completes final display"
    582                                  " at cycle %d\n", date );
     587if ( (x==0) && (y==0) && (lpid==0) )
     588giet_shr_printf( "\n[CONVOL] task[0,0,0] completes final display"
     589                 " at cycle %d\n", date );
    583590#endif
    584591     
     
    596603    /////////////////////////////////////////////////////////
    597604
    598     if ( pid == 0 )
     605    if ( (x==0) && (y==0) && (lpid==0) )
    599606    {
    600607        date  = giet_proctime();
  • soft/giet_vm/applications/display/main_cma.c

    r297 r432  
    99__attribute__((constructor)) void main(void)
    1010{
     11    // get processor identifiers
     12    unsigned int    x;
     13    unsigned int    y;
     14    unsigned int    lpid;
     15    giet_proc_xyp( &x, &y, &lpid );
     16
    1117    int             fd;
    1218    unsigned int    blocks_to_skip = 0;
    13     unsigned int    procid         = giet_procid();
    14     unsigned int    cluster_xy     = procid/NB_PROCS_MAX;
    15     unsigned int    lpid           = procid%NB_PROCS_MAX;
    16     unsigned int    x              = cluster_xy >> Y_WIDTH;
    17     unsigned int    y              = cluster_xy & ((1<<Y_WIDTH)-1);
    1819
    1920    giet_tty_printf( "*** Starting task display on processor[%d,%d,%d] at cycle %d\n\n",
  • soft/giet_vm/applications/gameoflife/main.c

    r388 r432  
    1717#define NB_ITERATION    1000000000
    1818
    19 #define PRINTF(...)      ({ if (giet_procid() == 0) { giet_tty_printf(__VA_ARGS__); } })
     19#define PRINTF(...) ({ if ( proc_id==0) { giet_tty_printf(__VA_ARGS__); } })
    2020
    2121giet_barrier_t barriers[2];
     
    127127__attribute__((constructor)) void main()
    128128{
    129    unsigned int proc_id       = giet_procid();              // processor id
     129   // get processor identifier
     130   unsigned int x;
     131   unsigned int y;
     132   unsigned int p;
     133   giet_proc_xyp( &x, &y, &p );
     134
     135   // compute continuous processor index
     136   unsigned int proc_id = (((x * Y_SIZE) + y) * NB_PROCS_MAX) + p; 
     137
    130138   unsigned int nlocal_procs  = NB_PROCS_MAX;               // processors per cluster
    131139   unsigned int nclusters     = X_SIZE*Y_SIZE;              // number of clusters
    132    unsigned int nglobal_procs = nclusters * nlocal_procs;   // number of tasks
     140   unsigned int nglobal_procs = nclusters * nlocal_procs;   // number of processors
    133141   size_t i;
    134142
     
    158166   for (i = 0; i < NB_ITERATION; i++)
    159167   {
    160       //PRINTF("\n*** Starting computation for iteration %d at cycle %d\n", i, giet_proctime());
    161168      compute_new_gen(base_line, nb_line);
    162       //PRINTF("\n*** Starting display for iteration %d at cycle %d\n", i, giet_proctime());
    163169      grow_old_world(base_line, nb_line);
    164170      display_world(base_line, nb_line);
  • soft/giet_vm/applications/hello/main.c

    r387 r432  
    55{
    66        char                byte;
    7     unsigned int    procid     = giet_procid();
    8     unsigned int    cluster_xy = procid/NB_PROCS_MAX;
    9     unsigned int    lpid       = procid%NB_PROCS_MAX;
    10     unsigned int    x          = cluster_xy >> Y_WIDTH;
    11     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
     7
     8    // get processor identifiers
     9    unsigned int    x;
     10    unsigned int    y;
     11    unsigned int    lpid;
     12    giet_proc_xyp( &x, &y, &lpid );
    1213
    1314    giet_tty_printf( "*** Starting task hello on processor[%d,%d,%d] at cycle %d\n\n",
  • soft/giet_vm/applications/pgcd/main.c

    r295 r432  
    88    unsigned int opy;
    99
    10     unsigned int    procid     = giet_procid();
    11     unsigned int    cluster_xy = procid/NB_PROCS_MAX;
    12     unsigned int    lpid       = procid%NB_PROCS_MAX;
    13     unsigned int    x          = cluster_xy >> Y_WIDTH;
    14     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
     10    // get processor identifiers
     11    unsigned int    x;
     12    unsigned int    y;
     13    unsigned int    lpid;
     14    giet_proc_xyp( &x, &y, &lpid );
    1515
    1616    giet_tty_printf( "*** Starting task pgcd on processor[%d,%d,%d] at cycle %d\n\n",
  • soft/giet_vm/applications/router/main.c

    r345 r432  
    2020    mwmr_channel_t*     mwmr;
    2121
    22     unsigned int    procid     = giet_procid();
    23     unsigned int    cluster_xy = procid/NB_PROCS_MAX;
    24     unsigned int    lpid       = procid%NB_PROCS_MAX;
    25     unsigned int    x          = cluster_xy >> Y_WIDTH;
    26     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
     22    // get processor identifiers
     23    unsigned int    x;
     24    unsigned int    y;
     25    unsigned int    lpid;
     26    giet_proc_xyp( &x, &y, &lpid );
    2727
    2828    printf( "*** Starting task producer on processor[%d,%d,%d] at cycle %d\n\n",
     
    5252    mwmr_channel_t*     mwmr;
    5353
    54     unsigned int    procid     = giet_procid();
    55     unsigned int    cluster_xy = procid/NB_PROCS_MAX;
    56     unsigned int    lpid       = procid%NB_PROCS_MAX;
    57     unsigned int    x          = cluster_xy >> Y_WIDTH;
    58     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
     54    // get processor identifiers
     55    unsigned int    x;
     56    unsigned int    y;
     57    unsigned int    lpid;
     58    giet_proc_xyp( &x, &y, &lpid );
    5959
    6060    printf( "*** Starting task consumer on processor[%d,%d,%d] at cycle %d\n\n",
     
    8585    mwmr_channel_t* mwmr_out ;
    8686
    87     unsigned int    procid     = giet_procid();
    88     unsigned int    cluster_xy = procid/NB_PROCS_MAX;
    89     unsigned int    lpid       = procid%NB_PROCS_MAX;
    90     unsigned int    x          = cluster_xy >> Y_WIDTH;
    91     unsigned int    y          = cluster_xy & ((1<<Y_WIDTH)-1);
     87    // get processor identifiers
     88    unsigned int    x;
     89    unsigned int    y;
     90    unsigned int    lpid;
     91    giet_proc_xyp( &x, &y, &lpid );
    9292
    9393    printf( "*** Starting task router on processor[%d,%d,%d] at cycle %d\n\n",
  • soft/giet_vm/applications/transpose/main.c

    r398 r432  
    6666    unsigned int c;                                                // cluster index for loops
    6767
    68     unsigned int proc_id    = giet_procid();                       // global processor id
    69     unsigned int lpid       = proc_id % NB_PROCS_MAX;              // local processor id
    70     unsigned int cluster_xy = proc_id / NB_PROCS_MAX;              // 8 bits format
    71     unsigned int x          = cluster_xy >> Y_WIDTH;               // x coordinate
    72     unsigned int y          = cluster_xy & ((1<<Y_WIDTH)-1);       // y coordinate
     68    // get processor identifiers
     69    unsigned int x;                                                // x cluster coordinate
     70    unsigned int y;                                                // y cluster coordinate
     71    unsigned int lpid;                                             // local processor index
     72    giet_proc_xyp( &x, &y, &lpid);             
    7373
    7474    unsigned int npixels    = NN * NN;                             // pixels per image
     
    8383    // It includes parameters checking, barriers initialization,
    8484    // distributed buffers allocation, and file open
    85     if ( proc_id == 0 )
     85    if ( (x==0) && (y==0) && (lpid==0) )
    8686    {
    8787        // Parameters checking
     
    140140        if (file < 0)
    141141        {
    142             giet_shr_printf("\n[TRANSPOSE ERROR] Processor[%d,%d,%d]"
     142            giet_shr_printf("\n[TRANSPOSE ERROR] Proc [%d,%d,%d]"
    143143                            " cannot open file misc/images.raw",
    144144                            x, y, lpid );
     
    147147        else
    148148        {
    149             giet_shr_printf("\n[TRANSPOSE] Processor[0,0,0] open file misc/images.raw\n");
     149            giet_shr_printf("\n[TRANSPOSE] Proc [0,0,0] open file misc/images.raw\n");
    150150        }
    151151        init_ok = 0;
     
    154154    {
    155155        while ( init_ok == 1 );
     156        giet_shr_printf("\n[TRANSPOSE] Processor[%d,%d,%d] starts at cycle %d\n", x, y, lpid);
    156157    }
    157158   
    158 
    159159    /////////////////////////
    160160    // Main loop (on images)
     
    173173                           ((image*nblocks) + ((nblocks*cluster_id)/NB_CLUSTERS)) );
    174174
    175             giet_shr_printf("\n[TRANSPOSE] Proc [%d,%d,0] completes load"
     175            giet_shr_printf("\n[TRANSPOSE] Proc [%d,%d,%d] completes load"
    176176                            "  for image %d at cycle %d\n",
    177                             x, y, image, giet_proctime() );
     177                            x, y, lpid, image, giet_proctime() );
    178178        }
    179179
     
    307307        barrier_wait( &barrier );
    308308
    309         // instrumentation done by processor [0,0,0]
    310 
    311         if ( (proc_id == 0) && INSTRUMENTATION_OK )
     309        // instrumentation done by processor [0,0,0]
     310        if ( (x==0) && (y==0) && (lpid==0) && INSTRUMENTATION_OK )
    312311        {
    313312            int cc, pp;
     
    377376
    378377    // Processor[0,0,0] releases the Distributed buffers
    379     if ( proc_id == 0 )
     378    if ( (x==0) && (y==0) && (lpid==0) )
    380379    {
    381380        for ( c = 0 ; c < NB_CLUSTERS ; c++ )
Note: See TracChangeset for help on using the changeset viewer.