Ignore:
Timestamp:
Jan 17, 2014, 11:49:27 PM (11 years ago)
Author:
cfuguet
Message:
  • Bugfix: The ISR_SWITCH index should be NB_PROCS_MAX + local_pid. This is because the first NB_PROCS_MAX indexes on the XICU in each cluster are used for the WAKEUP software interrupts.
  • Relocating the memcpy and memset functions into the giet_libs/stdlib.* files.
  • Modification of the sort application to used 8 threads instead of
    1. Modifying the mapping files to distribute the 8 threads on the available processors. (Ex. When using 4 processors, each one executes 2 threads)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/sort/main.c

    r269 r271  
    3838
    3939//////////////////////////////////////////////////////////////////////////
    40 // The NPROCS constant must be modified depending on the desired number of
     40// The NTHREADS constant must be modified depending on the desired number of
    4141// threads
    4242
    43 #define NPROCS          4
    44 #define ARRAY_LENGTH    (NPROCS * 128)
    45 #define IPP             (ARRAY_LENGTH / NPROCS) // ITEMS PER PROCESSOR
     43#define NTHREADS        8
     44#define ARRAY_LENGTH    (NTHREADS * 128)
     45#define IPT             (ARRAY_LENGTH / NTHREADS) // ITEMS PER THREAD
    4646
    4747////////////////////////////////////////////////////////////////////////////////
     
    8989///////////////////////////////////////////////////
    9090// This application support at most 256 processors
    91 // Number of barriers = log2(NPROCS)
     91// Number of barriers = log2(NTHREADS)
    9292
    9393giet_barrier_t barrier[8];
     
    101101    int i;
    102102
    103     task0_printf("[ Thread 0 ] Starting SORT application\n");
     103    printf("[ Thread %d ] Initializing vector and barriers...\n\r", thread_id);
    104104
    105105    ///////////////////////////
    106106    // Barriers Initialization
    107107
    108     for (i = 0; i < __builtin_ctz(NPROCS); i++)
    109     {
    110         barrier_init(&barrier[i], NPROCS >> i);
     108    for (i = 0; i < __builtin_ctz(NTHREADS); i++)
     109    {
     110        barrier_init(&barrier[i], NTHREADS >> i);
    111111    }
    112112
     
    114114    // Array Initialization
    115115
    116     for (i = IPP * thread_id; i < IPP * (thread_id + 1); i++)
     116    for (i = IPT * thread_id; i < IPT * (thread_id + 1); i++)
    117117    {
    118118        array0[i] = rand();
     
    124124    printf("[ Thread %d ] Stage 0: Processor Sorting...\n\r", thread_id);
    125125
    126     bubbleSort(array0, IPP, IPP * thread_id);
     126    bubbleSort(array0, IPT, IPT * thread_id);
    127127
    128128    printf("[ Thread %d ] Finishing Stage 0\n\r", thread_id);
    129129
    130     for (i = 0; i < __builtin_ctz(NPROCS); i++)
     130    for (i = 0; i < __builtin_ctz(NTHREADS); i++)
    131131    {
    132132        asm volatile ("sync");
     
    153153
    154154        merge(src_array, dst_array
    155                 , IPP << i
    156                 , IPP * thread_id
    157                 , IPP * (thread_id + (1 << i))
    158                 , IPP * thread_id
     155                , IPT << i
     156                , IPT * thread_id
     157                , IPT * (thread_id + (1 << i))
     158                , IPT * thread_id
    159159                );
    160160
Note: See TracChangeset for help on using the changeset viewer.