Ignore:
Timestamp:
Feb 8, 2015, 9:20:45 PM (10 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/transpose/transpose.py

    r457 r502  
    33from mapping import *
    44
    5 ######################################################################################
     5##################################################################################
    66#   file   : transpose.py  (for the transpose application)
    77#   date   : may 2014
    88#   author : Alain Greiner
    9 #######################################################################################
     9##################################################################################
    1010#  This file describes the mapping of the multi-threaded "transpose"
    1111#  application on a multi-clusters, multi-processors architecture.
    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
    20 ####################################################################################
     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
     26##################################################################################
    2127
    2228#########################
     
    5460    for x in xrange (x_size):
    5561        for y in xrange (y_size):
    56             mapping.addVseg( vspace, 'trsp_code_%d_%d' %(x,y), code_base , code_size,
    57                              'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM',
    58                              binpath = 'build/transpose/transpose.elf',
    59                              local = True )
     62            cluster_id = (x * y_size) + y
     63            if ( mapping.clusters[cluster_id].procs ):
    6064
    61     # stacks vsegs: local (one stack per processor => nprocs stacks per cluster)           
    62     for x in xrange (x_size):
    63         for y in xrange (y_size):
    64             for p in xrange( nprocs ):
    65                 proc_id = (((x * y_size) + y) * nprocs) + p
    66                 size    = (stack_size / nprocs) & 0xFFFFF000
    67                 base    = stack_base + (proc_id * size)
    68                 mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p), base, size,
    69                                  'C_WU', vtype = 'BUFFER', x = x , y = y , pseg = 'RAM',
    70                                  local = True, big = True )
     65                mapping.addVseg( vspace, 'trsp_code_%d_%d' %(x,y),
     66                                 code_base , code_size,
     67                                 'CXWU', vtype = 'ELF', x = x, y = y, pseg = 'RAM',
     68                                 binpath = 'build/transpose/transpose.elf',
     69                                 local = True )
    7170
    72     # heap vsegs: distributed but non local (all heap vsegs can be accessed by all tasks)
     71    # stacks vsegs: local (one stack per processor => nprocs stacks per cluster)
    7372    for x in xrange (x_size):
    7473        for y in xrange (y_size):
    7574            cluster_id = (x * y_size) + y
    76             size  = heap_size
    77             base  = heap_base + (cluster_id * size)
    78             mapping.addVseg( vspace, 'trsp_heap_%d_%d' % (x,y), base, size,
    79                              'C_WU', vtype = 'BUFFER', x = x, y = y, pseg = 'RAM',
    80                              local = False, big = True )
     75            if ( mapping.clusters[cluster_id].procs ):
     76                for p in xrange( nprocs ):
     77                    proc_id = (((x * y_size) + y) * nprocs) + p
     78                    size    = (stack_size / nprocs) & 0xFFFFF000
     79                    base    = stack_base + (proc_id * size)
     80
     81                    mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p),
     82                                     base, size, 'C_WU', vtype = 'BUFFER',
     83                                     x = x , y = y , pseg = 'RAM',
     84                                     local = True, big = True )
     85
     86    # heap vsegs: distributed non local (all heap vsegs can be accessed by all tasks)
     87    for x in xrange (x_size):
     88        for y in xrange (y_size):
     89            cluster_id = (x * y_size) + y
     90            if ( mapping.clusters[cluster_id].procs ):
     91                size  = heap_size
     92                base  = heap_base + (cluster_id * size)
     93
     94                mapping.addVseg( vspace, 'trsp_heap_%d_%d' % (x,y), base, size,
     95                                 'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM',
     96                                 local = False, big = True )
    8197
    8298    # distributed tasks / one task per processor
    8399    for x in xrange (x_size):
    84100        for y in xrange (y_size):
    85             for p in xrange( nprocs ):
    86                 trdid = (((x * y_size) + y) * nprocs) + p
    87                 mapping.addTask( vspace, 'trsp_%d_%d_%d' % (x,y,p), trdid, x, y, p,
    88                                  'trsp_stack_%d_%d_%d' % (x,y,p),
    89                                  'trsp_heap_%d_%d' % (x,y), 0 )
     101            cluster_id = (x * y_size) + y
     102            if ( mapping.clusters[cluster_id].procs ):
     103                for p in xrange( nprocs ):
     104                    trdid = (((x * y_size) + y) * nprocs) + p
     105
     106                    mapping.addTask( vspace, 'trsp_%d_%d_%d' % (x,y,p),
     107                                     trdid, x, y, p,
     108                                     'trsp_stack_%d_%d_%d' % (x,y,p),
     109                                     'trsp_heap_%d_%d' % (x,y), 0 )
    90110
    91111    # extend mapping name
     
    94114    return vspace  # useful for test
    95115           
    96 ################################ test ######################################################
     116################################ test ##################################################
    97117
    98118if __name__ == '__main__':
Note: See TracChangeset for help on using the changeset viewer.