Ignore:
Timestamp:
Jun 22, 2020, 4:29:05 PM (16 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast, new-ast-unique-expr
Children:
13c5e19
Parents:
0f89d4f
Message:

Several changes to relaxed list prototype and added workstealing for comparison

File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/theses/thierry_delisle_PhD/code/relaxed_list.cpp

    r0f89d4f rb232745  
    1 #include "relaxed_list.hpp"
     1#if !defined(LIST_VARIANT_HPP)
     2#define LIST_VARIANT_HPP "relaxed_list.hpp"
     3#endif
     4
     5#include LIST_VARIANT_HPP
     6#if !defined(LIST_VARIANT)
     7#error not variant selected
     8#endif
    29
    310#include <array>
     
    3542
    3643template<>
    37 thread_local relaxed_list<Node>::TLS relaxed_list<Node>::tls = {};
     44thread_local LIST_VARIANT<Node>::TLS LIST_VARIANT<Node>::tls = {};
    3845
    3946template<>
    40 relaxed_list<Node> * relaxed_list<Node>::head = nullptr;
     47std::atomic_uint32_t LIST_VARIANT<Node>::ticket = { 0 };
    4148
    4249#ifndef NO_STATS
    4350template<>
    44 relaxed_list<Node>::GlobalStats relaxed_list<Node>::global_stats = {};
     51LIST_VARIANT<Node>::GlobalStats LIST_VARIANT<Node>::global_stats = {};
    4552#endif
    4653
     
    120127        atomic_min(global.valmin, local.valmin);
    121128
    122         relaxed_list<Node>::stats_tls_tally();
     129        LIST_VARIANT<Node>::stats_tls_tally();
    123130}
    124131
     
    199206        std::cout << "Total ops     : " << ops << "(" << global.in << "i, " << global.out << "o, " << global.empty << "e)\n";
    200207        #ifndef NO_STATS
    201                 relaxed_list<Node>::stats_print(std::cout);
     208                LIST_VARIANT<Node>::stats_print(std::cout);
    202209        #endif
    203210}
     
    216223        unsigned nslots,
    217224        local_stat_t & local,
    218         relaxed_list<Node> & list
     225        LIST_VARIANT<Node> & list
    219226) {
    220227        while(__builtin_expect(!done.load(std::memory_order_relaxed), true)) {
     
    254261        std::cout << "Initializing ";
    255262        size_t npushed = 0;
    256         relaxed_list<Node> list = { nthread * nqueues };
     263        LIST_VARIANT<Node> list = { nthread, nqueues };
    257264        {
    258265                Node** all_nodes[nthread];
     
    340347        unsigned nnodes,
    341348        local_stat_t & local,
    342         relaxed_list<Node> & list
     349        LIST_VARIANT<Node> & list
    343350) {
    344351        Node * nodes[nnodes];
     
    384391        std::cout << "Initializing ";
    385392        // List being tested
    386         relaxed_list<Node> list = { nthread * nqueues };
     393        LIST_VARIANT<Node> list = { nthread, nqueues };
    387394        {
    388395                enable_stats = true;
     
    441448        int nslots,
    442449        local_stat_t & local,
    443         relaxed_list<Node> & list
     450        LIST_VARIANT<Node> & list
    444451) {
    445452        while(__builtin_expect(!done.load(std::memory_order_relaxed), true)) {
     
    518525
    519526        // List being tested
    520         relaxed_list<Node> list = { nthread * nqueues };
     527        LIST_VARIANT<Node> list = { nthread, nqueues };
    521528        {
    522529                Random rand(rdtscl());
     
    593600        unsigned nnodes,
    594601        local_stat_t & local,
    595         relaxed_list<Node> & list
     602        LIST_VARIANT<Node> & list
    596603) {
    597604        Node * nodes[nnodes];
     
    653660
    654661        // List being tested
    655         relaxed_list<Node> list = { nthread * nqueues };
     662        LIST_VARIANT<Node> list = { nthread, nqueues };
    656663        {
    657664                enable_stats = true;
     
    921928
    922929        std::cout << "Running " << nthreads << " threads (" << (nthreads * nqueues) << " queues) for " << duration << " seconds" << std::endl;
    923         std::cout << "Relaxed list variant: " << relaxed_list<Node>::name() << std::endl;
     930        std::cout << "Relaxed list variant: " << LIST_VARIANT<Node>::name() << std::endl;
    924931        switch(benchmark) {
    925932                case Churn:
Note: See TracChangeset for help on using the changeset viewer.