Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
aparnasasidharan2017 committed Oct 30, 2023
1 parent 9f5adbe commit 13c591c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 9 deletions.
10 changes: 10 additions & 0 deletions PluginKVS/include/KeyValueStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ class KeyValueStore
N prevkey=0;
int ids = 0;
std::vector<N> keys;
std::vector<N> keys_p;
for(int i=0;i<nops;i++)
{
N key = random()%RAND_MAX;
Expand All @@ -451,6 +452,8 @@ class KeyValueStore
{
}
prevkey = key;
ids++;
if(ids < 100) keys_p.push_back(key);
}
else if(prevkey != 0)
{
Expand All @@ -462,6 +465,13 @@ class KeyValueStore
usleep(rate);
}

for(int i=0;i<keys_p.size();i++)
{
b = ka->Get<T,N> (pos,st,keys_p[i],ids);
ids++;

}

}

void get_testworkload(std::string &,std::vector<int>&,std::vector<uint64_t>&,int);
Expand Down
1 change: 0 additions & 1 deletion PluginKVS/srcs/invertedlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ void hdf5_invlist<KeyT,ValueT,hashfcn,equalfcn>::get_events()
KeyT key = r->key;
uint64_t hashvalue = hashfcn()(key);
int pid = partition_no(key);
assert (pid == myrank);
uint64_t pos = hashvalue%maxsize;
hsize_t offset = cached_keyindex_mt[2*pos+1];
hsize_t numkeys = cached_keyindex_mt[2*pos];
Expand Down
5 changes: 5 additions & 0 deletions emu/include/city.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,10 @@ inline uint64 Hash128to64(const uint128& x) {
return b;
}

inline uint64_t unsignedlonghash(uint64_t &n)
{
uint64_t h = std::hash<uint64_t>()(n);
return h;
}

#endif // CITY_HASH_H_
1 change: 1 addition & 0 deletions emu/include/rw.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
//#include "h5_async_lib.h"
#include <thread>
#include <fstream>
#include "city.h"

using namespace boost;

Expand Down
16 changes: 8 additions & 8 deletions emu/srcs/rw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ bool read_write_process::pread(std::vector<std::vector<struct io_request*>>&my_r
for(int n=0;n<inv_requests.size();n++)
{
uint64_t ts = inv_requests[n]->mints;
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t pid = hashvalue & mask;
pid = pid >> (nbits-nbits_p);
send_counts[pid]++;
Expand All @@ -582,7 +582,7 @@ bool read_write_process::pread(std::vector<std::vector<struct io_request*>>&my_r
for(int n=0;n<inv_requests.size();n++)
{
uint64_t ts = inv_requests[n]->mints;
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t pid = hashvalue & mask;
pid = pid >> (nbits-nbits_p);
send_buffer[send_displ[pid]] = ts;
Expand Down Expand Up @@ -615,7 +615,7 @@ bool read_write_process::pread(std::vector<std::vector<struct io_request*>>&my_r
for(int j=0;j<recv_counts[i];j++)
{
uint64_t ts = recv_buffer[recv_displ[i]+j];
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t pos = hashvalue%maxsize;
int offset = table_offset[2*pos+1]-table_offset[1];
int numkeys = table_offset[2*pos];
Expand Down Expand Up @@ -1131,7 +1131,7 @@ void read_write_process::create_inverted_list(std::string &s,std::vector<std::ve
for(int i=0;i<timestamp_offsets.size();i++)
{
uint64_t ts = timestamp_offsets[i].first;
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t key = hashvalue & mask;
int id = key >> (total_bits-numbits_p);
int pid = id%numprocs;
Expand Down Expand Up @@ -1179,7 +1179,7 @@ void read_write_process::create_inverted_list(std::string &s,std::vector<std::ve
{
uint64_t ts = recv_buffer[i];
uint64_t pos = recv_buffer[i+1];
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
int index = hashvalue%maxsize;
std::pair<uint64_t,uint64_t> p;
p.first = ts; p.second = pos;
Expand Down Expand Up @@ -1350,7 +1350,7 @@ void read_write_process::merge_inverted_list(std::string &s,std::vector<std::vec
for(int i=0;i<timestamp_offsets.size();i++)
{
uint64_t ts = timestamp_offsets[i].first;
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t key = hashvalue & mask;
int id = key >> (total_bits-numbits_p);
int pid = id%numprocs;
Expand Down Expand Up @@ -1398,7 +1398,7 @@ void read_write_process::merge_inverted_list(std::string &s,std::vector<std::vec
{
uint64_t ts = recv_buffer[i];
uint64_t pos = recv_buffer[i+1];
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t index = hashvalue%maxsize;
std::pair<uint64_t,uint64_t> p;
p.first = ts; p.second = pos;
Expand Down Expand Up @@ -1458,7 +1458,7 @@ void read_write_process::merge_inverted_list(std::string &s,std::vector<std::vec
{
uint64_t ts = (*prev_keys)[i].ts;
uint64_t index = (*prev_keys)[i].offset;
uint64_t hashvalue = ts;
uint64_t hashvalue = unsignedlonghash(ts);
uint64_t pos = hashvalue%maxsize;
std::pair<uint64_t,uint64_t> p;
p.first = ts; p.second = index;
Expand Down

0 comments on commit 13c591c

Please sign in to comment.