Changeset 626 for trunk/user/sort/sort.c


Ignore:
Timestamp:
Apr 29, 2019, 7:25:09 PM (6 years ago)
Author:
alain
Message:

This version has been tested on the sort multithreaded application
for TSAR_IOB architectures ranging from 1 to 8 clusters.
It fixes three bigs bugs:
1) the dev_ioc device API has been modified: the dev_ioc_sync_read()
and dev_ioc_sync_write() function use now extended pointers on the
kernel buffer to access a mapper stored in any cluster.
2) the hal_uspace API has been modified: the hal_copy_to_uspace()
and hal_copy_from_uspace() functions use now a (cxy,ptr) couple
to identify the target buffer (equivalent to an extended pointer.
3) an implementation bug has been fixed in the assembly code contained
in the hal_copy_to_uspace() and hal_copy_from_uspace() functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/sort/sort.c

    r625 r626  
    2929#include <hal_macros.h>
    3030
    31 #define ARRAY_LENGTH        256        // number of items
     31#define ARRAY_LENGTH        1024       // number of items
    3232#define MAX_THREADS         1024       // 16 * 16 * 4
    3333
     
    3838#define CHECK_RESULT        0          // for debug
    3939#define INSTRUMENTATION     1          // register computation times on file
     40#define IDBG                0          // activate interactive debug in main
    4041
    4142/////////////////////////////////////////////////////////////
     
    439440#if INSTRUMENTATION
    440441
    441     char   name[64];
    442     char   path[128];
     442    char               name[64];
     443    char               path[128];
     444    unsigned long long instru_cycle;
    443445
    444446    // build a file name from n_items / n_clusters / n_cores
     
    461463           name, sequencial, parallel );
    462464
     465#if IDBG
     466idbg();
     467#endif
     468
    463469    // open file
     470    get_cycle( &instru_cycle );
    464471    FILE * stream = fopen( path , NULL );
     472
    465473    if( stream == NULL )
    466474    {
    467         printf("\n[sort error] cannot open instrumentation file <%s>\n", name );
     475        printf("\n[sort error] cannot open instrumentation file <%s>\n", path );
    468476        exit(0);
    469477    }
    470478
    471     printf("\n[sort] file %s successfully open\n", path);
     479    printf("\n[sort] file <%s> open at cycle %d\n", path, (unsigned int)instru_cycle );
     480
     481#if IDBG
     482idbg();
     483#endif
    472484
    473485    // register results to file
     486    get_cycle( &instru_cycle );
    474487    int ret = fprintf( stream , "\n----- %s -----\n"
    475488                                " - sequencial : %d cycles\n"
     
    477490    if( ret < 0 )
    478491    {
    479         printf("\n[sort error] cannot write to instrumentation file <%s>\n", name );
     492        printf("\n[sort error] cannot write to instrumentation file <%s>\n", path );
    480493        exit(0);
    481494    }
    482495
    483     printf("\n[sort] file %s successfully written\n", path);
     496    printf("\n[sort] file <%s> written at cycle %d\n", path, (unsigned int)instru_cycle );
     497
     498#if IDBG
     499idbg();
     500#endif
    484501
    485502    // close instrumentation file
    486 
    487     if( fclose( stream ) )
    488     {
    489         printf("\n[sort error] cannot close the file <%s>\n", name );
     503    get_cycle( &instru_cycle );
     504    ret = fclose( stream );
     505
     506    if( ret )
     507    {
     508        printf("\n[sort error] cannot close instrumentation file <%s>\n", path );
    490509        exit(0);
    491510    }
    492511
    493     printf("\n[sort] file %s successfully closed\n", path);
     512    printf("\n[sort] file <%s> closed at cycle %d\n", path, (unsigned int)instru_cycle );
    494513
    495514#endif
Note: See TracChangeset for help on using the changeset viewer.