Changeset 718 for soft/giet_vm


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

Modify sort application to use the pthreads API.

Location:
soft/giet_vm/applications
Files:
1 added
1 deleted
3 edited

Legend:

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

    r708 r718  
    727727    unsigned int nthreads   = nclusters * nprocs;     
    728728
     729    // get a shared TTY
     730    giet_tty_alloc( 1 );
     731    lock_init( &tty_lock );
     732
     733    // get FBF size
     734    unsigned int  width;
     735    unsigned int  height;
     736    giet_fbf_size( &width , &height );
     737
    729738    // parameters checking
     739    if ( (width != NP) || (height != NL) )
     740        giet_pthread_exit( "[CONVOL ERROR] FBF size must be NP * NL\n");
    730741    if ((nprocs != 1) && (nprocs != 2) && (nprocs != 4) && (nprocs != 8))
    731742        giet_pthread_exit( "[CONVOL ERROR] NB_PROCS_MAX must be 1, 2, 4 or 8\n");
     
    743754        giet_pthread_exit( "[CONVOL ERROR] X_SIZE*Y_SIZE must be a divider of NP");
    744755
    745     // get a shared TTY
    746     giet_tty_alloc( 1 );
    747     lock_init( &tty_lock );
    748 
     756    // get FBF ownership
     757    giet_fbf_alloc();
     758 
    749759    // initializes the distributed heap[x,y]
    750760    for ( cx = 0 ; cx < x_size ; cx++ )
  • soft/giet_vm/applications/sort/Makefile

    r589 r718  
    22APP_NAME = sort
    33
    4 OBJS = main.o
     4OBJS = sort.o
    55
    66LIBS = -L../../build/libs -luser
  • 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.