Changeset 432


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
Files:
1 added
10 edited
5 copied
9 moved

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/Makefile

    r420 r432  
    165165        mcopy -o -i $(DISK_IMAGE) build/gameoflife/gameoflife.elf ::/build/gameoflife
    166166        mcopy -o -i $(DISK_IMAGE) build/dhrystone/dhrystone.elf ::/build/dhrystone
    167         mcopy -o -i $(DISK_IMAGE) transpose/images.raw ::/misc
    168         mcopy -o -i $(DISK_IMAGE) convol/philips_image.raw ::/misc
     167        mcopy -o -i $(DISK_IMAGE) applications/transpose/images.raw ::/misc
     168        mcopy -o -i $(DISK_IMAGE) applications/convol/philips_image.raw ::/misc
    169169        mcopy -o -i $(DISK_IMAGE) map.bin ::/
    170170### Copy bootloader into sector 2 of disk image
     
    194194
    195195### mapping generation: map.bin / map.xml / hard_config.h / giet_vsegs.ld
    196 map.bin hard_config.h giet_vsegs.ld: $(ARCH)/arch.py  $(APP)/$(APP).py
     196map.bin hard_config.h giet_vsegs.ld: $(ARCH)/arch.py  applications/$(APP)/$(APP).py
    197197        giet_python/genmap --arch=$(ARCH)     \
    198198                           --x=$(X_SIZE)      \
     
    436436########################################
    437437### display application compilation
    438 build/display/display.elf: $(DISPLAY_OBJS) display/display.ld hard_config.h
    439         $(LD) -o $@ -T display/display.ld $(DISPLAY_OBJS)
    440         $(DU) -D $@ > $@.txt
    441 
    442 build/display/main.o: display/main_cma.c
     438build/display/display.elf: $(DISPLAY_OBJS) applications/display/display.ld hard_config.h
     439        $(LD) -o $@ -T applications/display/display.ld $(DISPLAY_OBJS)
     440        $(DU) -D $@ > $@.txt
     441
     442build/display/main.o: applications/display/main_cma.c
    443443        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
    444444
    445445########################################
    446446### router compilation
    447 build/router/router.elf: $(ROUTER_OBJS) router/router.ld hard_config.h
    448         $(LD) -o $@ -T router/router.ld $(ROUTER_OBJS)
    449         $(DU) -D $@ > $@.txt
    450 
    451 build/router/main.o: router/main.c
     447build/router/router.elf: $(ROUTER_OBJS) applications/router/router.ld hard_config.h
     448        $(LD) -o $@ -T applications/router/router.ld $(ROUTER_OBJS)
     449        $(DU) -D $@ > $@.txt
     450
     451build/router/main.o: applications/router/main.c
    452452        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
    453453
    454454########################################
    455455### hello compilation
    456 build/hello/hello.elf: $(HELLO_OBJS) hello/hello.ld hard_config.h
    457         $(LD) -o $@ -T hello/hello.ld $(HELLO_OBJS)
    458         $(DU) -D $@ > $@.txt
    459 
    460 build/hello/main.o: hello/main.c
     456build/hello/hello.elf: $(HELLO_OBJS) applications/hello/hello.ld hard_config.h
     457        $(LD) -o $@ -T applications/hello/hello.ld $(HELLO_OBJS)
     458        $(DU) -D $@ > $@.txt
     459
     460build/hello/main.o: applications/hello/main.c
    461461        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
    462462
    463463########################################
    464464### pgcd compilation
    465 build/pgcd/pgcd.elf: $(PGCD_OBJS) pgcd/pgcd.ld hard_config.h
    466         $(LD) -o $@ -T pgcd/pgcd.ld $(PGCD_OBJS)
    467         $(DU) -D $@ > $@.txt
    468 
    469 build/pgcd/main.o: pgcd/main.c
     465build/pgcd/pgcd.elf: $(PGCD_OBJS) applications/pgcd/pgcd.ld hard_config.h
     466        $(LD) -o $@ -T applications/pgcd/pgcd.ld $(PGCD_OBJS)
     467        $(DU) -D $@ > $@.txt
     468
     469build/pgcd/main.o: applications/pgcd/main.c
    470470        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
    471471
    472472########################################
    473473### gameoflife compilation
    474 build/gameoflife/gameoflife.elf: $(GAMEOFLIFE_OBJS) gameoflife/gameoflife.ld
    475         $(LD) -o $@ -T gameoflife/gameoflife.ld $(GAMEOFLIFE_OBJS)
    476         $(DU) -D $@ > $@.txt
    477 
    478 build/gameoflife/main.o: gameoflife/main.c
     474build/gameoflife/gameoflife.elf: $(GAMEOFLIFE_OBJS) applications/gameoflife/gameoflife.ld
     475        $(LD) -o $@ -T applications/gameoflife/gameoflife.ld $(GAMEOFLIFE_OBJS)
     476        $(DU) -D $@ > $@.txt
     477
     478build/gameoflife/main.o: applications/gameoflife/main.c
    479479        $(CC) $(USER_INCLUDE) $(CFLAGS) -O3 -c -o $@ $<
    480480
    481481########################################
    482482### dhrystone compilation
    483 build/dhrystone/dhrystone.elf: $(DHRYSTONE_OBJS) dhrystone/dhrystone.ld hard_config.h
    484         $(LD) -o $@ -T dhrystone/dhrystone.ld $(DHRYSTONE_OBJS)
    485         $(DU) -D $@ > $@.txt
    486 
    487 build/dhrystone/dhry_1.o: dhrystone/dhry_1.c
     483build/dhrystone/dhrystone.elf: $(DHRYSTONE_OBJS) applications/dhrystone/dhrystone.ld hard_config.h
     484        $(LD) -o $@ -T applications/dhrystone/dhrystone.ld $(DHRYSTONE_OBJS)
     485        $(DU) -D $@ > $@.txt
     486
     487build/dhrystone/dhry_1.o: applications/dhrystone/dhry_1.c
    488488        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
    489489
    490 build/dhrystone/dhry_2.o: dhrystone/dhry_2.c
     490build/dhrystone/dhry_2.o: applications/dhrystone/dhry_2.c
    491491        $(CC) $(USER_INCLUDE) $(CFLAGS)  -c -o $@ $<
    492492
    493493########################################
    494494### sort compilation
    495 build/sort/sort.elf: $(SORT_OBJS) sort/sort.ld hard_config.h
    496         $(LD) -o $@ -T sort/sort.ld $(SORT_OBJS)
    497         $(DU) -D $@ > $@.txt
    498 
    499 build/sort/main.o: sort/main.c
     495build/sort/sort.elf: $(SORT_OBJS) applications/sort/sort.ld hard_config.h
     496        $(LD) -o $@ -T applications/sort/sort.ld $(SORT_OBJS)
     497        $(DU) -D $@ > $@.txt
     498
     499build/sort/main.o: applications/sort/main.c
    500500        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
    501501
    502502########################################
    503503### transpose compilation
    504 build/transpose/transpose.elf: $(TRANSPOSE_OBJS) transpose/transpose.ld hard_config.h
    505         $(LD) -o $@ -T transpose/transpose.ld $(TRANSPOSE_OBJS)
    506         $(DU) -D $@ > $@.txt
    507 
    508 build/transpose/main.o: transpose/main.c
     504build/transpose/transpose.elf: $(TRANSPOSE_OBJS) applications/transpose/transpose.ld hard_config.h
     505        $(LD) -o $@ -T applications/transpose/transpose.ld $(TRANSPOSE_OBJS)
     506        $(DU) -D $@ > $@.txt
     507
     508build/transpose/main.o: applications/transpose/main.c
    509509        $(CC) $(USER_INCLUDE) $(CFLAGS) -c -o $@ $<
    510510
    511511########################################
    512512### convol compilation
    513 build/convol/convol.elf: $(CONVOL_OBJS) convol/convol.ld hard_config.h
    514         $(LD) -o $@ -T convol/convol.ld $(CONVOL_OBJS)
    515         $(DU) -D $@ > $@.txt
    516 
    517 build/convol/main.o: convol/main.c
     513build/convol/convol.elf: $(CONVOL_OBJS) applications/convol/convol.ld hard_config.h
     514        $(LD) -o $@ -T applications/convol/convol.ld $(CONVOL_OBJS)
     515        $(DU) -D $@ > $@.txt
     516
     517build/convol/main.o: applications/convol/main.c
    518518        $(CC) $(USER_INCLUDE) $(CFLAGS) -O0 -c -o $@ $<
    519519
  • 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++ )
  • soft/giet_vm/giet_config.h

    r418 r432  
    3232#define GIET_DEBUG_FBF_DRIVER    0          /* trace FBF accesses */
    3333#define GIET_DEBUG_MALLOC        0          /* trace remote_malloc library */
    34 #define GIET_DEBUG_SBT           0          /* trace SBT barrier library */
     34#define GIET_DEBUG_BARRIER       0          /* trace barrier library */
    3535
    3636#define CONFIG_SRL_VERBOSITY TRACE
  • soft/giet_vm/giet_python/genmap

    r425 r432  
    128128map_sort      = options.sort        # map "sort" application if True
    129129map_convol    = options.convol      # map "convol" application if True
     130map_router    = options.router      # map "convol" application if True
    130131
    131132######################################################################################
     
    166167    print '[genmap] application "convol" loaded'
    167168
     169if ( map_router ):     
     170    app = __import__( 'router' )
     171    app.router( mapping )
     172    print '[genmap] application "router" loaded'
     173
    168174######################################################################################
    169175#   Generate xml file if required.
Note: See TracChangeset for help on using the changeset viewer.