Ignore:
Timestamp:
Oct 9, 2015, 3:51:21 PM (9 years ago)
Author:
alain
Message:

Modify sort application to use the pthreads API.

File:
1 edited

Legend:

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

    r669 r718  
    1111#  application on a multi_clusters, multi-processors architecture.
    1212#  This include both the mapping of virtual segments on the clusters,
    13 #  and the mapping of tasks on processors.
     13#  and the mapping of threads on processors.
    1414#  This mapping uses 5 platform parameters, (obtained from the "mapping" argument)
    1515#  - x_size    : number of clusters in a row
     
    2929    y_width   = mapping.y_width
    3030
    31     ntasks    = x_size * y_size * nprocs
     31    nthreads    = x_size * y_size * nprocs
    3232
    3333    # define vsegs base & size
     
    6464                                 local = True )
    6565
    66     # stacks vsegs : local (one stack per task)
     66    # stacks vsegs : local (one stack per thread)
    6767    for x in xrange (x_size):
    6868        for y in xrange (y_size):
     
    7979                                     local = True, big = True )
    8080
    81     # heap vsegs : distributed but non local (all tasks can access all heap vsegs)
     81    # heap vsegs : distributed but non local (all threads can access all heap vsegs)
    8282    for x in xrange (x_size):
    8383        for y in xrange (y_size):
     
    9191                                 local = False, big = True )
    9292
    93     # distributed tasks / one task per processor
     93    # distributed threads / one thread per processor
    9494    for x in xrange (x_size):
    9595        for y in xrange (y_size):
     
    9797            if ( mapping.clusters[cluster_id].procs ):
    9898                for p in xrange( nprocs ):
    99                     trdid = (((x * y_size) + y) * nprocs) + p
     99                    if (x == 0) and (y == 0) and (p == 0) :   # main thread
     100                        startid = 1
     101                        is_main = True
     102                    else :                                    # other threads
     103                        startid = 0
     104                        is_main = False
    100105
    101                     mapping.addTask( vspace, 'sort_%d_%d_%d' % (x,y,p),
    102                                      trdid, x, y, p,
    103                                      'sort_stack_%d_%d_%d' % (x,y,p),
    104                                      'sort_heap_%d_%d' % (x,y), 0 )
     106                    mapping.addThread( vspace,
     107                                       'sort_%d_%d_%d' % (x,y,p),
     108                                       is_main,
     109                                       x, y, p,
     110                                       'sort_stack_%d_%d_%d' % (x,y,p),
     111                                       'sort_heap_%d_%d' % (x,y),
     112                                       startid )
    105113
    106114    # extend mapping name
Note: See TracChangeset for help on using the changeset viewer.