Changeset 637 for trunk/libs/libpthread


Ignore:
Timestamp:
Jul 18, 2019, 2:06:55 PM (5 years ago)
Author:
alain
Message:

Introduce the non-standard pthread_parallel_create() system call
and re-write the <fft> and <sort> applications to improve the
intrinsic paralelism in applications.

Location:
trunk/libs/libpthread
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/libpthread/pthread.c

    r619 r637  
    230230
    231231////////////////////////////////////////////////////////////////////////////////////////////
    232 // The following functions define another implementation for the POSX barrier
    233 // based on a distributed quadtree implemented in user space, and relying
    234 // on a busy waiting policy.
    235 ////////////////////////////////////////////////////////////////////////////////////////////
    236 
    237 
    238 ////////////////////////////////////////////////////////////////////////////////////////////
    239 // This recursive function initializes the SQT nodes
    240 // traversing the SQT from root to bottom
    241 ////////////////////////////////////////////////////////////////////////////////////////////
    242 static void sqt_barrier_build( pthread_barrier_t  * barrier,
     232// The following functions define another implementation for the POSX barrier, based on
     233// a distributed quad tree implemented in user space, but using a busy waiting policy.
     234////////////////////////////////////////////////////////////////////////////////////////////
     235
     236
     237////////////////////////////////////////////////////////////////////////////////////////////
     238// This recursive function initializes the DQT nodes traversing the SQT from root to bottom
     239////////////////////////////////////////////////////////////////////////////////////////////
     240static void dqt_barrier_build( pthread_barrier_t  * barrier,
    243241                               unsigned int         x,
    244242                               unsigned int         y,
    245243                               unsigned int         level,
    246                                sqt_node_t         * parent,
     244                               dqt_node_t         * parent,
    247245                               unsigned int         x_size,
    248246                               unsigned int         y_size,
     
    250248{
    251249    // get target node address
    252     sqt_node_t * node = barrier->node[x][y][level];
     250    dqt_node_t * node = barrier->node[x][y][level];
    253251   
    254252    if (level == 0 )        // terminal case
     
    266264
    267265#if PTHREAD_BARRIER_DEBUG
    268 printf("\n[BARRIER] %s : sqt_node[%d][%d][%d] / arity %d / desc %x\n"
     266printf("\n[BARRIER] %s : dqt_node[%d][%d][%d] / arity %d / desc %x\n"
    269267"parent %x / child0 %x / child1 %x / child2 %x / child3 %x\n",
    270268__FUNCTION__, x, y, level, node->arity, node, node->parent,
     
    312310
    313311#if PTHREAD_BARRIER_DEBUG
    314 printf("\n[BARRIER] %s : sqt_node[%d][%d][%d] / arity %d / desc %x\n"
     312printf("\n[BARRIER] %s : dqt_node[%d][%d][%d] / arity %d / desc %x\n"
    315313"parent %x / child0 %x / child1 %x / child2 %x / child3 %x\n",
    316314__FUNCTION__, x, y, level, node->arity, node, node->parent,
     
    322320        {
    323321            if ( (cx[i] < x_size) && (cy[i] < y_size) )
    324             sqt_barrier_build( barrier,
     322            dqt_barrier_build( barrier,
    325323                               cx[i],
    326324                               cy[i],
     
    332330        }
    333331    }
    334 }  // end sqt_barrier_build()
     332}  // end dqt_barrier_build()
    335333
    336334////////////////////////////////////////////////////////////////
     
    394392                     ( (l == 4) && ((x&0x0F) == 0) && ((y&0x0F) == 0) ) )
    395393                 {
    396                      sqt_node_t * node = remote_malloc( sizeof(sqt_node_t) , cxy );
     394                     dqt_node_t * node = remote_malloc( sizeof(dqt_node_t) , cxy );
    397395
    398396                     if( node == NULL )
    399397                     {
    400                          printf("\n[ERROR] in %s : cannot allocate sqt_node in cluster %x\n",
     398                         printf("\n[ERROR] in %s : cannot allocate dqt_node in cluster %x\n",
    401399                         __FUNCTION__ , cxy );
    402400                         return -1;
     
    411409           
    412410    // recursively initialize all SQT nodes from root to bottom
    413     sqt_barrier_build( barrier,
     411    dqt_barrier_build( barrier,
    414412                       0,       
    415413                       0,
     
    428426//////////////////////////////////////////////////////////////////////////////////////////
    429427// This recursive function decrements the distributed "count" variables,
    430 // traversing the SQT from bottom to root.
     428// traversing the DQT from bottom to root.
    431429// The last arrived thread reset the local node before returning.
    432430//////////////////////////////////////////////////////////////////////////////////////////
    433 static void sqt_barrier_decrement( sqt_node_t * node )
     431static void dqt_barrier_decrement( dqt_node_t * node )
    434432{
    435433
     
    457455    {
    458456        // decrement the parent node if the current node is not the root
    459         if ( node->parent != NULL )  sqt_barrier_decrement( node->parent );
     457        if ( node->parent != NULL )  dqt_barrier_decrement( node->parent );
    460458
    461459#if PTHREAD_BARRIER_DEBUG
     
    484482        return;
    485483    }
    486 } // end sqt_barrier_decrement()
     484} // end dqt_barrier_decrement()
    487485   
    488486///////////////////////////////////////////////////////
     
    504502
    505503    // recursively decrement count from bottom to root
    506     sqt_barrier_decrement( barrier->node[x][y][0] );
     504    dqt_barrier_decrement( barrier->node[x][y][0] );
    507505
    508506    hal_user_fence();
  • trunk/libs/libpthread/pthread.h

    r632 r637  
    22 * pthread.h - User level <pthread> library definition.
    33 *
    4  * Author     Alain Greiner (2016,2017,2018)
     4 * Author     Alain Greiner (2016,2017,2018,2019)
    55 *
    66 * Copyright (c) UPMC Sorbonne Universites
Note: See TracChangeset for help on using the changeset viewer.