Ignore:
Timestamp:
Mar 15, 2016, 6:35:28 PM (8 years ago)
Author:
meunier
Message:
  • Adding the parallel version of rosenfeld
File:
1 edited

Legend:

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

    r798 r805  
    2525
    2626#########################
    27 def extend( mapping ):
     27def extend(mapping):
    2828
    2929    x_size    = mapping.x_size
     
    5959        for y in xrange (y_size):
    6060            cluster_id = (x * y_size) + y
    61             if ( mapping.clusters[cluster_id].procs ):
     61            if (mapping.clusters[cluster_id].procs):
    6262
    6363                mapping.addVseg( vspace, 'rosen_code_%d_%d' %(x,y),
     
    7171        for y in xrange (y_size):
    7272            cluster_id = (x * y_size) + y
    73             if ( mapping.clusters[cluster_id].procs ):
    74                 for p in xrange( nprocs ):
     73            if (mapping.clusters[cluster_id].procs):
     74                for p in xrange(nprocs):
    7575                    proc_id = (((x * y_size) + y) * nprocs) + p
    7676                    size    = (stack_size / nprocs) & 0xFFFFF000
     
    8686        for y in xrange (y_size):
    8787            cluster_id = (x * y_size) + y
    88             if ( mapping.clusters[cluster_id].procs ):
    89                 size  = heap_size
    90                 base  = heap_base + (cluster_id * size)
     88            if (mapping.clusters[cluster_id].procs):
     89                size = heap_size
     90                base = heap_base + (cluster_id * size)
    9191
    92                 mapping.addVseg( vspace, 'rosen_heap_%d_%d' % (x,y), base, size,
    93                                  'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM',
    94                                  local = False, big = True )
     92                mapping.addVseg(vspace, 'rosen_heap_%d_%d' % (x, y), base, size,
     93                                'C_WU', vtype = 'HEAP', x = x, y = y, pseg = 'RAM',
     94                                local = False, big = True )
    9595
    9696    # distributed tasks / one task per processor
    97     #for x in xrange (x_size):
    98     #    for y in xrange (y_size):
    99     #        cluster_id = (x * y_size) + y
    100     #        if ( mapping.clusters[cluster_id].procs ):
    101     #            for p in xrange( nprocs ):
    102     #                trdid = (((x * y_size) + y) * nprocs) + p
     97    for x in xrange (x_size):
     98        for y in xrange (y_size):
     99            cluster_id = (x * y_size) + y
     100            if (mapping.clusters[cluster_id].procs):
     101                for p in xrange(nprocs):
     102                    trdid = (((x * y_size) + y) * nprocs) + p
     103                    if trdid == 0:
     104                        startid = 0
     105                        is_main = 1
     106                    else:
     107                        startid = 1
     108                        is_main = 0
     109                    #startid = trdid == 0 and 0 or 1
     110                    #is_main = startid == 0
    103111
    104     #                mapping.addTask( vspace, 'rosen_%d_%d_%d' % (x,y,p),
    105     #                                 trdid, x, y, p,
    106     #                                 'rosen_stack_%d_%d_%d' % (x,y,p),
    107     #                                 'rosen_heap_%d_%d' % (x,y), 0 )
    108     mapping.addThread( vspace, 'main', True, 0, 0, 0,
    109                        'rosen_stack_0_0_0',
    110                        'rosen_heap_0_0',
    111                        0 )                      # index in start_vector
     112                    mapping.addThread(vspace, 'rosen_%d_%d_%d' % (x, y, p),
     113                                    is_main, x, y, p,
     114                                    'rosen_stack_%d_%d_%d' % (x,y,p),
     115                                    'rosen_heap_%d_%d' % (x,y), startid)
    112116
    113117
Note: See TracChangeset for help on using the changeset viewer.