Ignore:
Timestamp:
Mar 14, 2016, 3:35:05 PM (9 years ago)
Author:
alain
Message:

cosmetic.

File:
1 edited

Legend:

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

    r782 r804  
    9292int  fd_out;
    9393
    94 ////////////////////////////////////////////
    95 __attribute__ ((constructor)) void execute()
    96 ////////////////////////////////////////////
     94////////////////////////////////////////////////////////////////
     95__attribute__ ((constructor)) void execute( unsigned int* tid )
     96////////////////////////////////////////////////////////////////
    9797{
    9898    unsigned int l;                            // line index for loops
     
    118118    unsigned int cluster_id    = (x_id * y_size) + y_id;        // "continuous" index   
    119119    unsigned int thread_id     = (cluster_id * nprocs) + p_id;  // "continuous" index
     120
     121    if ( VERBOSE )
     122    {
     123        printf("\n@@@ thread %d / %d running on P[%d,%d,%d]\n",
     124               *tid , nthreads , x_id , y_id , p_id );
     125    }
    120126
    121127    // parallel load of image:
     
    146152        if ( VERBOSE )
    147153        {
    148             printf("\n@@@ Thread[%d,%d,%d] call mmap for input file\n"
     154            printf("\n@@@ thread %d running on P[%d,%d,%d] call mmap for input file\n"
    149155                   " length = %x / offset = %x / buf_in = %x\n",
    150                    x_id , y_id , p_id , length , offset , buf_in[cluster_id] );
     156                   *tid , x_id , y_id , p_id , length , offset , buf_in[cluster_id] );
    151157        }
    152158
     
    168174        if ( VERBOSE )
    169175        {
    170             printf("\n@@@ Thread[%d,%d,%d] call mmap for output file\n"
     176            printf("\n@@@ thread %d running on P[%d,%d,%d] call mmap for output file\n"
    171177                   " length = %x / offset = %x / buf_out = %x\n",
    172                    x_id , y_id , p_id , length , offset , buf_out[cluster_id] );
     178                   *tid , x_id , y_id , p_id , length , offset , buf_out[cluster_id] );
    173179        }
    174180       
     
    482488    }
    483489
    484     // allocate thread[] array
     490    // allocate thread[] array : thread identidiers defined by the kernel
    485491    pthread_t* thread = malloc( nthreads * sizeof(pthread_t) );
     492
     493    // allocate tid[] array : continuous thred index defined by the user
     494    unsigned int* tid = malloc( nthreads * sizeof(unsigned int) );
    486495
    487496    // barrier initialisation
     
    494503    for ( n = 1 ; n < nthreads ; n++ )
    495504    {
     505        tid[n] = n;
    496506        if ( giet_pthread_create( &thread[n],
    497507                                  NULL,                  // no attribute
    498508                                  &execute,
    499                                   NULL ) )               // no argument
    500         {
    501             printf("\n[TRANSPOSE ERROR] creating thread %x\n", thread[n] );
     509                                  &tid[n] ) )            // pointer on thread index
     510        {
     511            printf("\n[TRANSPOSE ERROR] creating thread %d / id = %x\n", tid[n] , thread[n] );
    502512            giet_pthread_exit( NULL );
    503513        }
     
    505515
    506516    // run the execute() function
    507     execute();
     517    execute( &tid[0] );
    508518
    509519    // wait other threads completion
     
    512522        if ( giet_pthread_join( thread[n], NULL ) )
    513523        {
    514             printf("\n[TRANSPOSE ERROR] joining thread %x\n", thread[n] );
     524            printf("\n[TRANSPOSE ERROR] joining thread %d / id = %x\n", tid[n] , thread[n] );
    515525            giet_pthread_exit( NULL );
    516526        }
Note: See TracChangeset for help on using the changeset viewer.