mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
bandwidth output fixes
This commit is contained in:
parent
0e141ce700
commit
53b9034546
@ -6,23 +6,26 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
int sizes[]= { 16000, 32000, 64000, 120000, 1600000, 2000000, 2500000, 3500000, 150000000, 250000000, 350000000, 500000000};
|
int sizes[]= { 16000, 32000, 64000, 120000, 1600000, 2000000, 2500000, 3500000, 150000000, 250000000, 350000000, 500000000};
|
||||||
int loops[]= { 6000, 6000, 6000, 6000, 1000, 1000, 1000, 1000, 50, 50, 25, 25};
|
int f_loops[]= { 70000, 50000, 30000, 10000, 1000, 1000, 1000, 1000, 7, 7, 5, 3};
|
||||||
int exp_len[]= { 2000, 2000, 2000, 2000, 250, 250, 250, 250, 10, 10, 5, 5};
|
int t_loops[]= { 200000, 150000, 100000, 70000, 5000, 5000, 5000, 5000, 50, 50, 50, 50};
|
||||||
|
int exp_len[]= { 15, 15, 15, 15, 5, 5, 5, 5, 5, 5, 5, 5};
|
||||||
|
int nd_loops[]= { 250000, 150000, 100000, 100000, 10000, 1000, 1000, 1000, 100, 100, 100, 100};
|
||||||
const char charset[] = "aAaAaAaAAAaaaaAAAAaaaaAAAAAAaaaAAaaa";
|
const char charset[] = "aAaAaAaAAAaaaaAAAAaaaaAAAAAAaaaAAaaa";
|
||||||
std::string labels[] = {"\x1B[33m shuftiExec Benchmarks(kbytes) \x1B[0m\n", "\x1B[33m rshuftiExec Benchmarks(kbytes) \x1B[0m\n",
|
std::string labels[] = {"\x1B[33m Benchmarks(kbytes) \x1B[0m\n", "\x1B[33m Benchmarks(kbytes) \x1B[0m\n",
|
||||||
"\x1B[33m truffleExec Benchmarks(kbytes) \x1B[0m\n", "\x1B[33m rtruffleExec Benchmarks(kbytes) \x1B[0m\n",
|
"\x1B[33m Benchmarks(kbytes) \x1B[0m\n", "\x1B[33m Benchmarks(kbytes) \x1B[0m\n",
|
||||||
"\x1B[33m shuftiExec Benchmarks(Mbytes) \x1B[0m\n", "\x1B[33m rhuftiExec Benchmarks(Mbytes) \x1B[0m\n",
|
"\x1B[33m Benchmarks(Mbytes) \x1B[0m\n", "\x1B[33m Benchmarks(Mbytes) \x1B[0m\n",
|
||||||
"\x1B[33m truffleExec Benchmarks(Mbytes) \x1B[0m\n", "\x1B[33m rtruffleExec Benchmarks(Mbytes) \x1B[0m\n",
|
"\x1B[33m Benchmarks(Mbytes) \x1B[0m\n", "\x1B[33m Benchmarks(Mbytes) \x1B[0m\n",
|
||||||
"\x1B[33m shuftiExec Benchmarks(Gbytes) \x1B[0m\n", "\x1B[33m rhuftiExec Benchmarks(Gbytes) \x1B[0m\n",
|
"\x1B[33m Benchmarks(Gbytes) \x1B[0m\n", "\x1B[33m Benchmarks(Gbytes) \x1B[0m\n",
|
||||||
"\x1B[33m truffleExec Benchmarks(Gbytes) \x1B[0m\n", "\x1B[33m rtruffleExec Benchmarks(Gbytes) \x1B[0m\n"
|
"\x1B[33m Benchmarks(Gbytes) \x1B[0m\n", "\x1B[33m Benchmarks(Gbytes) \x1B[0m\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
std::function<void(int,int,int,bool)> functions[] = { shufti_benchmarks, rshufti_benchmarks, truffle_benchmarks, rtruffle_benchmarks };
|
std::function<void(int,int,int,bool)> functions[] = { shufti_benchmarks, rshufti_benchmarks, truffle_benchmarks, rtruffle_benchmarks };
|
||||||
for (int i=0; i<12; i++) {
|
for (int i=11; i<12; i++) {
|
||||||
std::cout << labels[i];
|
std::cout << labels[i];
|
||||||
for(int j=0; j<4; j++){
|
for(int j=0; j<4; j++){
|
||||||
functions[j](sizes[i],loops[i],exp_len[i],false);
|
functions[j](sizes[i],f_loops[i],exp_len[i],false);
|
||||||
functions[j](sizes[i],loops[i],exp_len[i],true);
|
functions[j](sizes[i],t_loops[i],exp_len[i],true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(int i=0; i<12; i++){
|
for(int i=0; i<12; i++){
|
||||||
@ -43,7 +46,7 @@ int main(){
|
|||||||
str[char_len] = charset[key];
|
str[char_len] = charset[key];
|
||||||
str[char_len + 1] = '\0';
|
str[char_len + 1] = '\0';
|
||||||
}
|
}
|
||||||
noodle_benchmarks(sizes[i], loops[i], str,char_len,0);
|
noodle_benchmarks(sizes[i], nd_loops[i], str,char_len,0);
|
||||||
delete [] str;
|
delete [] str;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ void noodle_benchmarks(int size, int M, const char *lit_str, int lit_len, char n
|
|||||||
ctxt.clear();
|
ctxt.clear();
|
||||||
u8 *data = new u8[size];
|
u8 *data = new u8[size];
|
||||||
memset(data, 'a', size);
|
memset(data, 'a', size);
|
||||||
double total_sec = 0;
|
long double total_sec = 0;
|
||||||
|
long double trans_size = 0;
|
||||||
long double bw = 0;
|
long double bw = 0;
|
||||||
u32 id = 1000;
|
u32 id = 1000;
|
||||||
ue2::hwlmLiteral lit(std::string(lit_str, lit_len), nocase, id);
|
ue2::hwlmLiteral lit(std::string(lit_str, lit_len), nocase, id);
|
||||||
@ -45,12 +46,16 @@ void noodle_benchmarks(int size, int M, const char *lit_str, int lit_len, char n
|
|||||||
noodExec(n.get(), data, size, 0, hlmSimpleCallback, &scratch);
|
noodExec(n.get(), data, size, 0, hlmSimpleCallback, &scratch);
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
total_sec += std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
total_sec += std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
/*calculate transferred size*/
|
||||||
total_sec /= M;
|
trans_size = size * M;
|
||||||
double mb_size = (double) size / 1048576;
|
/*convert to sec*/
|
||||||
bw = mb_size / total_sec;
|
bw = trans_size / total_sec;
|
||||||
|
/*convert to MB/s*/
|
||||||
|
bw /=1048576;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
std::cout << "\x1B[35m Case with match in random pos and size: "<< size <<" lit_len: "<< lit_len <<" nocase: "<< (int)nocase
|
std::cout << "\x1B[35m Case with match in random pos and size: "<< size <<" lit_len: "<< lit_len <<" nocase: "<< (int)nocase
|
||||||
<< "\x1B[36m noodExec elapsetime: \x1B[0m" << total_sec << " (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/μs)" << std::endl;
|
<< "\x1B[36m noodExec elapsetime: \x1B[0m" << (ms/M) << " (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/s)" << std::endl;
|
||||||
delete [] data;
|
delete [] data;
|
||||||
}
|
}
|
@ -27,8 +27,9 @@ void shufti_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
||||||
u8 *kt1 = new u8[size];
|
u8 *kt1 = new u8[size];
|
||||||
memset(kt1,'b',size);
|
memset(kt1,'b',size);
|
||||||
double total_sec = 0;
|
long double total_sec = 0;
|
||||||
double bw = 0;
|
long double trans_size = 0;
|
||||||
|
long double bw = 0;
|
||||||
if (has_match){
|
if (has_match){
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
for(int j=0; j<M; j++){
|
for(int j=0; j<M; j++){
|
||||||
@ -43,34 +44,41 @@ void shufti_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
act_size += res - kt1;
|
act_size += res - kt1;
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
double dt = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
long double dt = std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
|
||||||
dt /= loops;
|
|
||||||
total_sec += dt;
|
total_sec += dt;
|
||||||
/*average size*/
|
/*calculate transferred size*/
|
||||||
act_size /= loops;
|
trans_size += act_size * loops;
|
||||||
double mb_size = (double) act_size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw += mb_size / dt;
|
bw += trans_size / total_sec;
|
||||||
|
/*convert to MB/s*/
|
||||||
|
bw += bw / 1048576;
|
||||||
|
/*calculte average time*/
|
||||||
|
total_sec /= loops;
|
||||||
}
|
}
|
||||||
total_sec /= M;
|
total_sec /= M;
|
||||||
bw /= M;
|
bw /= M;
|
||||||
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for " << loops <<" loops ("
|
/*covert average time to μs*/
|
||||||
<< M << " random possisions checked): \x1B[36m shuftiExec elapsetime: \x1B[0m" << (total_sec)
|
long double ms = total_sec * 1000000;
|
||||||
<< " (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/μs)"<<std::endl;
|
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for " << loops<<" loops ("
|
||||||
|
<< M << " random possisions checked): \x1B[36m shuftiExec elapsetime: \x1B[0m" << (ms/M)
|
||||||
|
<<" (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/s)"<<std::endl;
|
||||||
} else {
|
} else {
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
for (int i = 0; i < loops; i++) {
|
for (int i = 0; i < loops; i++) {
|
||||||
shuftiExec(lo, hi, kt1, kt1 + size);
|
shuftiExec(lo, hi, kt1, kt1 + size);
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
total_sec += std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
total_sec += std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
/*calculate transferred size*/
|
||||||
total_sec /= loops;
|
trans_size = size * loops ;
|
||||||
double mb_size = (double) size / 1048576;
|
/*calculate bandwidth*/
|
||||||
mb_size /= loops;
|
bw = trans_size / total_sec;
|
||||||
bw = mb_size / total_sec;
|
/*convert to MB/s*/
|
||||||
|
bw /=1048576;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
std::cout<<"\x1B[35m Case with no match in random pos and size: "<<real_size<<" for "<<loops<<" loops:"
|
std::cout<<"\x1B[35m Case with no match in random pos and size: "<<real_size<<" for "<<loops<<" loops:"
|
||||||
<<"\x1B[36m shuftiExec elapsetime: \x1B[0m"<<(total_sec)<<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/μs)"<<std::endl;
|
<<"\x1B[36m shuftiExec elapsetime: \x1B[0m"<<(ms/loops)<<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/s)"<<std::endl;
|
||||||
}
|
}
|
||||||
delete [] kt1;
|
delete [] kt1;
|
||||||
}
|
}
|
||||||
@ -83,7 +91,8 @@ void rshufti_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
int ret = shuftiBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
||||||
u8 *kt1 = new u8[size];
|
u8 *kt1 = new u8[size];
|
||||||
memset(kt1,'b',size);
|
memset(kt1,'b',size);
|
||||||
double total_sec = 0;
|
long double total_sec = 0;
|
||||||
|
long double trans_size = 0;
|
||||||
long double bw = 0;
|
long double bw = 0;
|
||||||
if (has_match){
|
if (has_match){
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@ -99,33 +108,41 @@ void rshufti_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
act_size += res - kt1;
|
act_size += res - kt1;
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
double dt = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
long double dt = std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
|
||||||
dt /= loops;
|
|
||||||
total_sec += dt;
|
total_sec += dt;
|
||||||
/*average size*/
|
/*calculate transferred size*/
|
||||||
act_size /= loops;
|
trans_size += act_size * loops;
|
||||||
double mb_size = (double) act_size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw += mb_size / dt;
|
bw += trans_size / total_sec;
|
||||||
|
/*convert to MB/s*/
|
||||||
|
bw += bw / 1048576;
|
||||||
|
/*calculte average time*/
|
||||||
|
total_sec /= loops;
|
||||||
}
|
}
|
||||||
total_sec /= M;
|
total_sec /= M;
|
||||||
bw /= M;
|
bw /= M;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for " << loops<<" loops ("
|
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for " << loops<<" loops ("
|
||||||
<< M << " random possisions checked): \x1B[36m rshuftiExec elapsetime: \x1B[0m" << total_sec
|
<< M << " random possisions checked): \x1B[36m rshuftiExec elapsetime: \x1B[0m" << (ms/M)
|
||||||
<<" (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/μs)"<<std::endl;
|
<<" (μs) \x1B[36m bandwidth: \x1B[0m" << bw <<" (MB/s)"<<std::endl;
|
||||||
} else {
|
} else {
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
for (int i = 0; i < loops; i++) {
|
for (int i = 0; i < loops; i++) {
|
||||||
rshuftiExec(lo, hi, kt1, kt1 + size);
|
rshuftiExec(lo, hi, kt1, kt1 + size);
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
total_sec += std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
total_sec += std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
/*calculate transferred size*/
|
||||||
total_sec /=loops;
|
trans_size = size * loops ;
|
||||||
double mb_size = (double) size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw = mb_size / total_sec;
|
bw = trans_size / total_sec;
|
||||||
std::cout<<"\x1B[35m Case with no match in random pos and size: "<< real_size <<" for "<< loops <<" loops:"
|
/*convert to MB/s*/
|
||||||
<<"\x1B[36m rshuftiExec elapsetime: \x1B[0m"<< total_sec <<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/μs)"<<std::endl;
|
bw /=1048576;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
|
std::cout<<"\x1B[35m Case with no match in random pos and size: "<<real_size<<" for "<<loops<<" loops:"
|
||||||
|
<<"\x1B[36m rshuftiExec elapsetime: \x1B[0m"<<(ms/loops)<<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/s)"<<std::endl;
|
||||||
}
|
}
|
||||||
delete [] kt1;
|
delete [] kt1;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,8 @@ void truffle_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
||||||
u8*kt1 = new u8[size];
|
u8*kt1 = new u8[size];
|
||||||
memset(kt1,'b',size);
|
memset(kt1,'b',size);
|
||||||
double total_sec = 0;
|
long double total_sec = 0;
|
||||||
|
long double trans_size = 0;
|
||||||
long double bw = 0;
|
long double bw = 0;
|
||||||
if (has_match){
|
if (has_match){
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@ -42,19 +43,23 @@ void truffle_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
act_size += res - kt1;
|
act_size += res - kt1;
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
double dt = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
long double dt = std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
|
||||||
dt /= loops;
|
|
||||||
total_sec += dt;
|
total_sec += dt;
|
||||||
/*average size*/
|
/*calculate transferred size*/
|
||||||
act_size /= loops;
|
trans_size += act_size * loops;
|
||||||
double mb_size = (double) act_size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw += mb_size / dt;
|
bw += trans_size / total_sec;
|
||||||
|
/*convert to MB/s*/
|
||||||
|
bw += bw / 1048576;
|
||||||
|
/*calculte average time*/
|
||||||
|
total_sec /= loops;
|
||||||
}
|
}
|
||||||
total_sec /= M;
|
total_sec /= M;
|
||||||
bw /= M;
|
bw /= M;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for "<< loops <<" loops ("
|
std::cout << "\x1B[35m Case with match in random pos and size: " << real_size << " for "<< loops <<" loops ("
|
||||||
<< M <<" random possisions checked): \x1B[36m truffleExec elapsetime: \x1B[0m" << total_sec
|
<< M <<" random possisions checked): \x1B[36m truffleExec elapsetime: \x1B[0m" << (ms/M)
|
||||||
<< "(μs) \x1B[36m bandwidth: \x1B[0m"<< bw << "(MB/μs)" <<std::endl;
|
<< "(μs) \x1B[36m bandwidth: \x1B[0m"<< bw << "(MB/μs)" <<std::endl;
|
||||||
} else {
|
} else {
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
@ -62,13 +67,17 @@ void truffle_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
truffleExec(lo, hi, kt1, kt1 + size);
|
truffleExec(lo, hi, kt1, kt1 + size);
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
total_sec += std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
total_sec += std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
/*calculate transferred size*/
|
||||||
total_sec /= loops;
|
trans_size = size * loops ;
|
||||||
double mb_size = (double) size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw = mb_size / total_sec;
|
bw = trans_size / total_sec;
|
||||||
std::cout<<"\x1B[35m Case with no match in random pos and size: "<< real_size <<" for "<< loops <<" loops:"
|
/*convert to MB/s*/
|
||||||
<<"\x1B[36m truffleExec elapsetime: \x1B[0m" << total_sec << " μs \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/μs)"<<std::endl;
|
bw /=1048576;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
|
std::cout<<"\x1B[35m Case with no match in random pos and size: "<<real_size<<" for "<<loops<<" loops:"
|
||||||
|
<<"\x1B[36m truffleExec elapsetime: \x1B[0m"<<(ms/loops)<<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/s)"<<std::endl;
|
||||||
}
|
}
|
||||||
delete [] kt1;
|
delete [] kt1;
|
||||||
}
|
}
|
||||||
@ -82,7 +91,8 @@ void rtruffle_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
truffleBuildMasks(chars, (u8 *)&lo, (u8 *)&hi);
|
||||||
u8 *kt1 = new u8[size];
|
u8 *kt1 = new u8[size];
|
||||||
memset(kt1,'b',size);
|
memset(kt1,'b',size);
|
||||||
double total_sec = 0;
|
long double total_sec = 0;
|
||||||
|
long double trans_size = 0;
|
||||||
long double bw = 0;
|
long double bw = 0;
|
||||||
if (has_match){
|
if (has_match){
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
@ -98,33 +108,41 @@ void rtruffle_benchmarks(int size, int loops, int M, bool has_match) {
|
|||||||
act_size += res - kt1;
|
act_size += res - kt1;
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
double dt = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
long double dt = std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
|
||||||
dt /= loops;
|
|
||||||
total_sec += dt;
|
total_sec += dt;
|
||||||
/*average size*/
|
/*calculate transferred size*/
|
||||||
act_size /= loops;
|
trans_size += act_size * loops;
|
||||||
double mb_size = (double) act_size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw += mb_size / dt;
|
bw += trans_size / total_sec;
|
||||||
|
/*convert to MB/s*/
|
||||||
|
bw += bw / 1048576;
|
||||||
|
/*calculte average time*/
|
||||||
|
total_sec /= loops;
|
||||||
}
|
}
|
||||||
total_sec /= M;
|
total_sec /= M;
|
||||||
bw /= M;
|
bw /= M;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
std::cout<<"\x1B[35m Case with match in random pos and size: "<< real_size <<" for "<<loops<<" loops ("
|
std::cout<<"\x1B[35m Case with match in random pos and size: "<< real_size <<" for "<<loops<<" loops ("
|
||||||
<< M <<" random possisions checked):"<<"\x1B[36m rtruffleExec elapsetime: \x1B[0m"
|
<< M <<" random possisions checked):"<<"\x1B[36m rtruffleExec elapsetime: \x1B[0m"
|
||||||
<< total_sec <<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<"(ΜΒ/μs)"<<std::endl;
|
<< (ms/M) <<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<"(ΜΒ/μs)"<<std::endl;
|
||||||
} else {
|
} else {
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
for (int i = 0; i < loops; i++) {
|
for (int i = 0; i < loops; i++) {
|
||||||
rtruffleExec(lo, hi, kt1, kt1 + size);
|
rtruffleExec(lo, hi, kt1, kt1 + size);
|
||||||
}
|
}
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
total_sec += std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
|
total_sec += std::chrono::duration_cast<std::chrono::seconds>(end - start).count();
|
||||||
/*average time*/
|
/*calculate transferred size*/
|
||||||
total_sec /= loops;
|
trans_size = size * loops ;
|
||||||
double mb_size = (double) size / 1048576;
|
/*calculate bandwidth*/
|
||||||
bw = mb_size / total_sec;
|
bw = trans_size / total_sec;
|
||||||
std::cout<<"\x1B[35m Case with no match in random pos and size: "<< real_size <<" for "<< loops <<" loops:"
|
/*convert to MB/s*/
|
||||||
<<"\x1B[36m rtruffleExec elapsetime: \x1B[0m" << total_sec <<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/μs)"<<std::endl;
|
bw /=1048576;
|
||||||
|
/*covert average time to μs*/
|
||||||
|
long double ms = total_sec * 1000000;
|
||||||
|
std::cout<<"\x1B[35m Case with no match in random pos and size: "<<real_size<<" for "<<loops<<" loops:"
|
||||||
|
<<"\x1B[36m rtruffleExec elapsetime: \x1B[0m"<<(ms/loops)<<" (μs) \x1B[36m bandwidth: \x1B[0m"<< bw <<" (MB/s)"<<std::endl;
|
||||||
}
|
}
|
||||||
delete [] kt1;
|
delete [] kt1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user