Changeset 4e39f51


Ignore:
Timestamp:
Sep 30, 2020, 5:44:53 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
038110a
Parents:
29185fc
Message:

More work towards dynamically picking a framework, however initial-exec tls is not working correctly

Location:
doc/theses/thierry_delisle_PhD/code/readQ_example
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/code/readQ_example/proto-gui/main.cpp

    r29185fc r4e39f51  
    1212using thrdlib::thread_t;
    1313
     14
     15extern __attribute__((aligned(128))) thread_local struct {
     16        void * volatile this_thread;
     17        void * volatile this_processor;
     18        void * volatile this_stats;
     19
     20        struct {
     21                volatile unsigned short disable_count;
     22                volatile bool enabled;
     23                volatile bool in_progress;
     24        } preemption_state;
     25
     26        #if defined(__SIZEOF_INT128__)
     27                __uint128_t rand_seed;
     28        #else
     29                uint64_t rand_seed;
     30        #endif
     31        struct {
     32                uint64_t fwd_seed;
     33                uint64_t bck_seed;
     34        } ready_rng;
     35} kernelTLS __attribute__ ((tls_model ( "initial-exec" )));
    1436
    1537//--------------------
     
    182204        nproduce = 60;
    183205
     206        const char * framework;
     207
    184208        for(;;) {
    185209                static struct option options[] = {
     
    199223                        case -1:
    200224                                /* paranoid */ assert(optind <= argc);
     225                                if( optind == argc ) {
     226                                        std::cerr << "Must specify a framework" << std::endl;
     227                                        goto usage;
     228
     229                                }
     230                                framework = argv[optind];
    201231                                goto run;
    202232                        case 'b':
     
    231261                                std::cerr << opt << std::endl;
    232262                        usage:
    233                                 std::cerr << "Usage: " << argv[0] << " [options]" << std::endl;
     263                                std::cerr << "Usage: " << argv[0] << " [options] framework" << std::endl;
    234264                                std::cerr << std::endl;
    235265                                std::cerr << "  -b, --buff=COUNT    Number of frames to buffer" << std::endl;
     
    240270        }
    241271        run:
     272        assert( framework );
    242273
    243274        frames.reset(new Frame[nframes]);
     
    249280        std::cout << "(Buffering " << nframes << ")" << std::endl;
    250281
    251         thrdlib::init( "fibre", 2 );
     282        thrdlib::init( framework, 2 );
    252283
    253284        thread_t stats     = thrdlib::create( Stats );
  • doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/Makefile

    r29185fc r4e39f51  
    1 all: fibre.so pthread.so
     1all: fibre.so pthread.so cforall.so
    22
    33clean:
    44        rm -rf fibre.so pthread.so
    55
     6CXXFLAGS=-Wall -Wextra -O3 -g -fpic -std=c++17 -pthread -ftls-model=initial-exec
     7
    68pthread.so: pthread.cpp Makefile
    7         $(CXX) -Wall -Wextra -O3 -g -shared -o ${@} -pthread -fpic ${<}
     9        $(CXX) $(CXXFLAGS) -shared -o ${@} ${<}
    810
    911fibre.so: fibre.cpp Makefile
    10         $(CXX) -Wall -Wextra -O3 -g -shared -o ${@} -pthread -fpic ${<} -lfibre
     12        $(CXX) $(CXXFLAGS) -shared -o ${@} ${<} -lfibre
     13
     14CFAINC=${HOME}/local/include/cfa-dev
     15CFALIB=${HOME}/local/lib/cfa-dev/x64-debug
     16CFAFLAGS=-z execstack -I${CFAINC} -I${CFAINC}/concurrency -L${CFALIB} -Wl,-rpath,${CFALIB}
     17
     18cforall.so: cforall.cpp Makefile
     19        $(CXX) $(CXXFLAGS) $(CFAFLAGS) -shared -o ${@} ${<} -lcfathread -lcfa -ldl -lm
  • doc/theses/thierry_delisle_PhD/code/readQ_example/thrdlib/thread.cpp

    r29185fc r4e39f51  
    2828
    2929        const char * error = dlerror();
    30         if ( error ) {
     30        if ( required && error ) {
    3131                std::cerr << "Fetching symbol '" << symbol << "' failed with error '" << error << "'\n";
    3232                std::abort();
Note: See TracChangeset for help on using the changeset viewer.