Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Montage as an instance #3

Merged
merged 68 commits into from
Nov 22, 2020
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
e123235
tentatively bring montage init from ChurnTest to MontageHashTable
Oct 19, 2020
bfc6a8a
Merge branch 'master' of https://github.com/roghnin/Montage into init…
roghnin Oct 19, 2020
c2c9922
added init_thread to Rideable
roghnin Oct 20, 2020
e9c27df
Merge branch 'master' of https://github.com/roghnin/Montage into init…
roghnin Oct 20, 2020
93c178f
reduce pds::init_thread in MapChurnTest
roghnin Oct 21, 2020
cc0da9b
moved initializations of Persistent and pds into rideables
roghnin Oct 21, 2020
a95f11c
fixed graph-related tests
roghnin Oct 22, 2020
6dd4b6d
create obj while building ralloc
qtcwt Oct 8, 2020
631a034
suppress compiler warning in mod nvm_malloc
qtcwt Oct 8, 2020
e7bd2a2
Update README.md
qtcwt Oct 9, 2020
badf3a8
Update README.md
Oct 14, 2020
a0fdd4e
Update README.md
Oct 14, 2020
784cbd5
Merge https://github.com/urcs-sync/Montage into master
roghnin Oct 22, 2020
ba315b2
Merge https://github.com/urcs-sync/Montage into montage_instance
roghnin Oct 22, 2020
9fce56b
put initialization and finalization into Recoverable for MontageHashT…
roghnin Oct 26, 2020
b8e7cf4
put initialization and finalization into Recoverable
roghnin Oct 26, 2020
8d55256
removed EpochSysVerifyTest
roghnin Oct 26, 2020
e9627bb
Merge https://github.com/urcs-sync/Montage
roghnin Oct 29, 2020
0167c76
Merge branch 'master' of https://github.com/roghnin/Montage into mont…
roghnin Oct 29, 2020
89ff34e
resolve conflict
roghnin Oct 29, 2020
17ab8ac
moved epoch advancers to hpp and cpp files.
roghnin Oct 29, 2020
f1c855d
moved UIDGenerator to utils.
roghnin Oct 29, 2020
ac3fc35
pulled out inclusions from namespace; put _tid into EpochSys as stati…
roghnin Oct 30, 2020
e50a371
put global variables into EpochSys class
roghnin Oct 31, 2020
3afe2c5
trivial
roghnin Nov 3, 2020
f1025ed
debug
roghnin Nov 4, 2020
6ec058d
replaced pds finalization with rideable reclamation
roghnin Nov 4, 2020
45aa3c4
moved begin_op/end_op logic into EpochSys class
roghnin Nov 9, 2020
505bae3
added PBlk constructor that takes a Recoverable* as argument
roghnin Nov 9, 2020
3ac4ddb
put PNEW & PDELETE logic into esys
roghnin Nov 10, 2020
5099e47
put PRETIRE & PRECLAIM logic into esys
roghnin Nov 10, 2020
4baef01
made PNEW, getter and setter work with esys instance
roghnin Nov 12, 2020
0a6f6ba
got all other APIs into Recoverable.hpp
roghnin Nov 12, 2020
10241de
made MontageHashTable use new API
roghnin Nov 12, 2020
0f53b42
put dcss-related code into EpochSys
roghnin Nov 13, 2020
5e198ff
moved dcss-related code into Recoverable.hpp/cpp
roghnin Nov 13, 2020
0f1aa2e
use new API in MontageLfHashTable and MontageMSQueue
roghnin Nov 13, 2020
07f3038
use new API in MontageGraph
roghnin Nov 13, 2020
b2716a6
use new API in MontageNatarajanTree
roghnin Nov 13, 2020
f77693a
trivial
roghnin Nov 13, 2020
0073eac
use new API in MontageQueue
roghnin Nov 13, 2020
e44c2d3
removed global PBlk getters and setters && trivial fixes
roghnin Nov 13, 2020
522a808
file orginaze && cleanups
roghnin Nov 13, 2020
d253f19
clean up
roghnin Nov 13, 2020
5734b8b
replace nbptr with lin_var
qtcwt Nov 14, 2020
204c67f
optimize pnew. see what you think
qtcwt Nov 14, 2020
d56b26c
added rideable deletions in tests
Nov 15, 2020
9738c33
got rid of pnew.hpp
Nov 15, 2020
848f940
moved stuff in PersistStructs.hpp into EpochSys.hpp and Recoverable.hpp
Nov 15, 2020
6e841d8
removed friend classes in Recoverable
Nov 15, 2020
dbd1801
elaborate on comment of register_alloc_pblk
qtcwt Nov 15, 2020
b5d7395
putting API-related logic into Recoverable and global api header
Nov 16, 2020
94f2b41
Merge branch 'montage_instance' of https://github.com/roghnin/Montage…
Nov 16, 2020
d5d14ce
Merge branch 'montage_instance' of https://github.com/roghnin/Montage…
Nov 16, 2020
0baaef0
Merge branch 'montage_instance' of https://github.com/roghnin/Montage…
roghnin Nov 16, 2020
c31f373
reset epochs of blocks in pending_allocs during abort_op
qtcwt Nov 16, 2020
3dd98dd
add reset_alloc_pblk in EpochSys
qtcwt Nov 16, 2020
be27552
minor fix
qtcwt Nov 16, 2020
a05c494
debug
Nov 16, 2020
3c78531
minor fix
qtcwt Nov 16, 2020
b6a57f6
Merge branch 'montage_instance' of github.com:roghnin/Montage into mo…
qtcwt Nov 16, 2020
7a3d5c7
debug montage msq
qtcwt Nov 16, 2020
a5d9727
add Persistent::init() and finalize() in all persistent rideables
qtcwt Nov 16, 2020
bbbb4e0
removed in all rideable hpp files && added copy constructors to payl…
Nov 16, 2020
f8332eb
resolve conflict
Nov 16, 2020
a27f845
debug
Nov 22, 2020
7f41538
debug
Nov 22, 2020
731d283
added POPEN API to the global api header
Nov 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ ARCHIVEDIR:=./lib
# -since we do pattern matching between this list and the
# source files, the file path specified must be the same
# type (absolute or relative)
EXECUTABLES:= ./src/main.cpp ./unit_test/dcss.cpp
EXECUTABLES:= ./src/main.cpp #./unit_test/dcss.cpp

# A list of source files contained in the
# source directory to exclude from the build
Expand Down
2 changes: 1 addition & 1 deletion ext/threadcached/include/memcached.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ extern unsigned stats_id;
* Structure for storing items within memcached.
*/
#ifdef MONTAGE
#include "persist_struct_api.hpp"
#include "montage_global_api.hpp"

using namespace pds;
struct item : public PBlk{
Expand Down
4 changes: 2 additions & 2 deletions ext/ycsb-tcd/ycsbc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace std;

#ifdef MONTAGE
#include "TestConfig.hpp"
#include "persist_struct_api.hpp"
#include "montage_global_api.hpp"
#endif /* MONTAGE */

void UsageMessage(const char *command);
Expand Down Expand Up @@ -131,7 +131,7 @@ int main(const int argc, char *argv[]) {
hwloc_get_type_depth(gtc.topology, HWLOC_OBJ_PU));
std::cout<<"initial affinity built"<<std::endl;
gtc.buildAffinity(gtc.affinities);
pds::init(&gtc);
// pds::init(&gtc);
#endif
if (do_cache_test_flag){
do_cache_test();
Expand Down
2 changes: 2 additions & 0 deletions src/Rideable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@


class GlobalTestConfig;
class LocalTestConfig;

class Rideable{
public:
virtual void init_thread(GlobalTestConfig* gtc, LocalTestConfig* ltc){};
qtcwt marked this conversation as resolved.
Show resolved Hide resolved
virtual ~Rideable(){};
};

Expand Down
1 change: 0 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
#include "MapTest.hpp"
#include "MapChurnTest.hpp"
#ifndef MNEMOSYNE
#include "EpochSysVerifyTest.hpp"
#include "RecoverVerifyTest.hpp"
#include "GraphRecoveryTest.hpp"
#include "TGraphConstructionTest.hpp"
Expand Down
85 changes: 85 additions & 0 deletions src/persist/EpochAdvancers.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#include "EpochSys.hpp"
#include "EpochAdvancers.hpp"

using namespace pds;

SingleThreadEpochAdvancer::SingleThreadEpochAdvancer(GlobalTestConfig* gtc){
trans_cnts = new padded<uint64_t>[gtc->task_num];
for (int i = 0; i < gtc->task_num; i++){
trans_cnts[i].ui = 0;
}
}
void SingleThreadEpochAdvancer::set_epoch_freq(int epoch_power){
epoch_threshold = 0x1ULL << epoch_power;
}
void SingleThreadEpochAdvancer::set_help_freq(int help_power){
help_threshold = 0x1ULL << help_power;
}
void SingleThreadEpochAdvancer::on_end_transaction(EpochSys* esys, uint64_t c){
assert(EpochSys::tid != -1);
trans_cnts[EpochSys::tid].ui++;
if (EpochSys::tid == 0){
// only a single thread can advance epochs.
if (trans_cnts[EpochSys::tid].ui % epoch_threshold == 0){
esys->advance_epoch(c);
}
}
}


void GlobalCounterEpochAdvancer::set_epoch_freq(int epoch_power){
epoch_threshold = 0x1ULL << epoch_power;
}
void GlobalCounterEpochAdvancer::set_help_freq(int help_power){
help_threshold = 0x1ULL << help_power;
}
void GlobalCounterEpochAdvancer::on_end_transaction(EpochSys* esys, uint64_t c){
uint64_t curr_cnt = trans_cnt.fetch_add(1, std::memory_order_acq_rel);
if (curr_cnt % epoch_threshold == 0){
esys->advance_epoch(c);
} else if (curr_cnt % help_threshold == 0){
esys->help_local();
}
}


DedicatedEpochAdvancer::DedicatedEpochAdvancer(GlobalTestConfig* gtc, EpochSys* es):esys(es){
if (gtc->checkEnv("EpochLength")){
epoch_length = stoi(gtc->getEnv("EpochLength"));
} else {
epoch_length = 100*1000;
}
if (gtc->checkEnv("EpochLengthUnit")){
std::string env_unit = gtc->getEnv("EpochLengthUnit");
if (env_unit == "Second"){
epoch_length *= 1000000;
} else if (env_unit == "Millisecond"){
epoch_length *= 1000;
} else if (env_unit == "Microsecond"){
// do nothing.
} else {
errexit("time unit not supported.");
}
}
started.store(false);
advancer_thread = std::move(std::thread(&DedicatedEpochAdvancer::advancer, this));
started.store(true);
}

void DedicatedEpochAdvancer::advancer(){
while(!started.load()){}
while(started.load()){
esys->advance_epoch_dedicated();
std::this_thread::sleep_for(std::chrono::microseconds(epoch_length));
}
// std::cout<<"advancer_thread terminating..."<<std::endl;
}

DedicatedEpochAdvancer::~DedicatedEpochAdvancer(){
// std::cout<<"terminating advancer_thread"<<std::endl;
started.store(false);
if (advancer_thread.joinable()){
advancer_thread.join();
}
// std::cout<<"terminated advancer_thread"<<std::endl;
}
75 changes: 75 additions & 0 deletions src/persist/EpochAdvancers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#ifndef EPOCHADVANCERS_HPP
#define EPOCHADVANCERS_HPP

#include <atomic>
#include <thread>
#include "TestConfig.hpp"
#include "ConcurrentPrimitives.hpp"

namespace pds{

class EpochSys;

/////////////////////
// Epoch Advancers //
/////////////////////

class EpochAdvancer{
public:
virtual void set_epoch_freq(int epoch_freq) = 0;
virtual void set_help_freq(int help_freq) = 0;
virtual void on_end_transaction(EpochSys* esys, uint64_t c) = 0;
virtual ~EpochAdvancer(){}
};

class SingleThreadEpochAdvancer : public EpochAdvancer{
// uint64_t trans_cnt;
padded<uint64_t>* trans_cnts;
uint64_t epoch_threshold = 0x1ULL << 19;
uint64_t help_threshold = 0x1ULL << 6;
public:
SingleThreadEpochAdvancer(GlobalTestConfig* gtc);
void set_epoch_freq(int epoch_power);
void set_help_freq(int help_power);
void on_end_transaction(EpochSys* esys, uint64_t c);
};

class GlobalCounterEpochAdvancer : public EpochAdvancer{
std::atomic<uint64_t> trans_cnt;
uint64_t epoch_threshold = 0x1ULL << 14;
uint64_t help_threshold = 0x1ULL;
public:
// GlobalCounterEpochAdvancer();
void set_epoch_freq(int epoch_power);
void set_help_freq(int help_power);
void on_end_transaction(EpochSys* esys, uint64_t c);
};

class DedicatedEpochAdvancer : public EpochAdvancer{
EpochSys* esys;
std::thread advancer_thread;
std::atomic<bool> started;
uint64_t epoch_length = 100*1000;
void advancer();
public:
DedicatedEpochAdvancer(GlobalTestConfig* gtc, EpochSys* es);
~DedicatedEpochAdvancer();
void set_epoch_freq(int epoch_interval){}
void set_help_freq(int help_interval){}
void on_end_transaction(EpochSys* esys, uint64_t c){
// do nothing here.
}
};

class NoEpochAdvancer : public EpochAdvancer{
// an epoch advancer that does absolutely nothing.
public:
// GlobalCounterEpochAdvancer();
void set_epoch_freq(int epoch_power){}
void set_help_freq(int help_power){}
void on_end_transaction(EpochSys* esys, uint64_t c){}
};

}

#endif
14 changes: 2 additions & 12 deletions src/persist/EpochSys.cpp
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
#include "EpochSys.hpp"
#include "DCSS.hpp"

#include <omp.h>
#include <atomic>
namespace pds{

__thread int _tid = -1;
EpochSys* esys = nullptr;
padded<uint64_t>* epochs = nullptr;
SysMode sys_mode = ONLINE;
// std::atomic<size_t> abort_cnt(0);
// std::atomic<size_t> total_cnt(0);

UIDGenerator PBlk::uid_generator;

padded<sc_desc_t>* local_descs = nullptr;
thread_local int EpochSys::tid = -1;
qtcwt marked this conversation as resolved.
Show resolved Hide resolved

void EpochSys::parse_env(){
if (to_be_persisted){
Expand Down Expand Up @@ -136,8 +126,8 @@ namespace pds{
do{
ret = global_epoch->load(std::memory_order_seq_cst);
} while(!trans_tracker->consistent_register_active(ret, ret));
//to_be_freed->free_on_new_epoch(ret);
to_be_freed->free_on_new_epoch(ret);

return ret;
}

Expand Down
Loading