Ignore:
Timestamp:
Feb 8, 2015, 9:20:45 PM (9 years ago)
Author:
alain
Message:

1) Introduce distributed barriers in the multi-threads applications
(classif) transpose, convol, sort, gameoflife)

2) Introducing support for architectures containing empty clusters
in the mapping of these multi-threaded applications.

3) Removing the "command line arguments" in the sort application
(replaced by the giet_procs_number() system call.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/applications/convol/convol.py

    r457 r502  
    1212#  This include both the mapping of virtual segments on the clusters,
    1313#  and the mapping of tasks on processors.
     14#  There is one task per processor.
     15#  The mapping of virtual segments is the following:
     16#    - There is one shared data vseg in cluster[0][0]
     17#    - The code vsegs are replicated on all clusters containing processors.
     18#    - There is one heap vseg per cluster containing processors.
     19#    - The stacks vsegs are distibuted on all clusters containing processors.
    1420#  This mapping uses 5 platform parameters, (obtained from the "mapping" argument)
    15 - x_size    : number of clusters in a row
    16 - y_size    : number of clusters in a column
    17 - x_width   : number of bits coding x coordinate
    18 - y_width   : number of bits coding y coordinate
    19 - nprocs : number of processors per cluster
     21  - x_size    : number of clusters in a row
     22  - y_size    : number of clusters in a column
     23  - x_width   : number of bits coding x coordinate
     24  - y_width   : number of bits coding y coordinate
     25  - nprocs : number of processors per cluster
    2026####################################################################################
    2127
     
    4652   
    4753    # data vseg in cluster[0,0] : non local
    48     mapping.addVseg( vspace, 'conv_data', data_base , data_size, 'C_WU', vtype = 'ELF',
    49                      x = 0, y = 0, pseg = 'RAM', binpath = 'build/convol/convol.elf',
     54    mapping.addVseg( vspace, 'conv_data', data_base , data_size,
     55                     'C_WU', vtype = 'ELF', x = 0, y = 0, pseg = 'RAM',
     56                     binpath = 'build/convol/convol.elf',
    5057                     local = False )
    5158
     
    5360    for x in xrange (x_size):
    5461        for y in xrange (y_size):
    55             size       = code_size
    56             base       = code_base
    57             mapping.addVseg( vspace, 'conv_code_%d_%d' % (x,y), base, size,
    58                              'CXWU', vtype = 'ELF', x = x , y = y , pseg = 'RAM',
    59                              binpath = 'build/convol/convol.elf',
    60                              local = True )
     62            cluster_id = (x * y_size) + y
     63            if ( mapping.clusters[cluster_id].procs ):
     64                size       = code_size
     65                base       = code_base
     66
     67                mapping.addVseg( vspace, 'conv_code_%d_%d' % (x,y), base, size,
     68                                 'CXWU', vtype = 'ELF', x = x , y = y , pseg = 'RAM',
     69                                 binpath = 'build/convol/convol.elf',
     70                                 local = True )
    6171
    6272    # stack vsegs : local (one stack per processor)
    6373    for x in xrange (x_size):
    6474        for y in xrange (y_size):
    65             for p in xrange( nprocs ):
    66                 proc_id = (((x * y_size) + y) * nprocs) + p
    67                 size    = (stack_size / nprocs) & 0xFFFFF000
    68                 base    = stack_base + (proc_id * size)
    69                 mapping.addVseg( vspace, 'conv_stack_%d_%d_%d' % (x,y,p), base, size,
    70                                  'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM',
    71                                  local = True, big = True )
     75            cluster_id = (x * y_size) + y
     76            if ( mapping.clusters[cluster_id].procs ):
     77                for p in xrange( nprocs ):
     78                    proc_id = (((x * y_size) + y) * nprocs) + p
     79                    size    = (stack_size / nprocs) & 0xFFFFF000
     80                    base    = stack_base + (proc_id * size)
     81
     82                    mapping.addVseg( vspace, 'conv_stack_%d_%d_%d' % (x,y,p),
     83                                     base, size, 'C_WU', vtype = 'BUFFER',
     84                                     x = x , y = y , pseg = 'RAM',
     85                                     local = True, big = True )
    7286           
    73     # heap vsegs : distributed but non local (all heap vsegs can be accessed by all tasks)
     87    # heap vsegs : distributed but non local (any heap can be accessed by any task)
    7488    for x in xrange (x_size):
    7589        for y in xrange (y_size):
    7690            cluster_id = (x * y_size) + y
    77             size       = heap_size
    78             base       = heap_base + (cluster_id * size)
    79             mapping.addVseg( vspace, 'conv_heap_%d_%d' % (x,y), base, size,
    80                              'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM',
    81                              local = False, big = True )
     91            if ( mapping.clusters[cluster_id].procs ):
     92                size       = heap_size
     93                base       = heap_base + (cluster_id * size)
     94
     95                mapping.addVseg( vspace, 'conv_heap_%d_%d' % (x,y), base, size,
     96                                 'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM',
     97                                 local = False, big = True )
    8298
    8399    # distributed tasks : one task per processor
    84100    for x in xrange (x_size):
    85101        for y in xrange (y_size):
    86             for p in xrange( nprocs ):
    87                 trdid = (((x * y_size) + y) * nprocs) + p
    88                 mapping.addTask( vspace, 'conv_%d_%d_%d' % (x,y,p), trdid, x, y, p,
    89                                  'conv_stack_%d_%d_%d' % (x,y,p),
    90                                  'conv_heap_%d_%d' % (x,y), 0 )
     102            cluster_id = (x * y_size) + y
     103            if ( mapping.clusters[cluster_id].procs ):
     104                for p in xrange( nprocs ):
     105                    trdid = (((x * y_size) + y) * nprocs) + p
     106
     107                    mapping.addTask( vspace, 'conv_%d_%d_%d' % (x,y,p),
     108                                     trdid, x, y, p,
     109                                     'conv_stack_%d_%d_%d' % (x,y,p),
     110                                     'conv_heap_%d_%d' % (x,y), 0 )
    91111
    92112    # extend mapping name
     
    95115    return vspace  # useful for test
    96116           
    97 ################################ test ######################################################
     117################################ test ################################################
    98118
    99119if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.