Ignore:
Timestamp:
Oct 1, 2015, 4:09:25 PM (9 years ago)
Author:
alain
Message:

Adapt the following application to the POSIX threads API

  • convol
  • classif
  • raycast
  • coproc
  • display
  • gameoflife
  • transpose
  • shell
File:
1 edited

Legend:

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

    r669 r708  
    1010#  This file describes the mapping of the multi-threaded "transpose"
    1111#  application on a multi-clusters, multi-processors architecture.
    12 #  This include both the mapping of virtual segments on the clusters,
    13 #  and the mapping of tasks on processors.
    14 #  There is one task per processor.
     12#  There is one thread per processor.
    1513#  The mapping of virtual segments is the following:
    1614#    - There is one shared data vseg in cluster[0][0]
     
    3735    # define vsegs base & size
    3836    code_base  = 0x10000000
    39     code_size  = 0x00010000     # 64 Kbytes (replicated in each cluster)
     37    code_size  = 0x00010000     # 64 Kbytes (per cluster)
    4038   
    4139    data_base  = 0x20000000
     
    4341
    4442    stack_base = 0x40000000
    45     stack_size = 0x00200000     # 2 Mbytes (per cluster)
     43    stack_size = 0x00010000     # 64 Kbytes (per thread)
    4644
    4745    heap_base  = 0x60000000
     
    7674                for p in xrange( nprocs ):
    7775                    proc_id = (((x * y_size) + y) * nprocs) + p
    78                     size    = (stack_size / nprocs) & 0xFFFFF000
    79                     base    = stack_base + (proc_id * size)
     76                    base    = stack_base + (proc_id * stack_size)
    8077
    8178                    mapping.addVseg( vspace, 'trsp_stack_%d_%d_%d' % (x,y,p),
    82                                      base, size, 'C_WU', vtype = 'BUFFER',
     79                                     base, stack_size, 'C_WU', vtype = 'BUFFER',
    8380                                     x = x , y = y , pseg = 'RAM',
    8481                                     local = True, big = True )
     
    9693                                 local = False, big = True )
    9794
    98     # distributed tasks / one task per processor
     95    # distribute one thread per processor / main on P[0,0,0]
    9996    for x in xrange (x_size):
    10097        for y in xrange (y_size):
     
    10299            if ( mapping.clusters[cluster_id].procs ):
    103100                for p in xrange( nprocs ):
    104                     trdid = (((x * y_size) + y) * nprocs) + p
     101                    if (x == 0) and (y == 0) and (p == 0) :   # main thread
     102                        startid = 1
     103                        is_main = True
     104                    else :                                    # other threads
     105                        startid = 0
     106                        is_main = False
    105107
    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 )
     108                    mapping.addThread( vspace,
     109                                       'trsp_%d_%d_%d' % (x,y,p),
     110                                       is_main,
     111                                       x, y, p,
     112                                       'trsp_stack_%d_%d_%d' % (x,y,p),
     113                                       'trsp_heap_%d_%d' % (x,y),
     114                                       startid )
    110115
    111116    # extend mapping name
Note: See TracChangeset for help on using the changeset viewer.