-
Notifications
You must be signed in to change notification settings - Fork 0
Sequence Query Performance
Hüseyin Tuğrul BÜYÜKIŞIK edited this page Feb 27, 2021
·
2 revisions
With a 1.4GB test file (influenza.fna) and FX8150 (3.6GHz, no turbo):
init: 20591756442 nanoseconds
sequence query (sequential-access latency benchmark, single thread): 20556579905 nanoseconds
(bandwidth = 63.28 MB/s) (throughput = 25142.99 nanoseconds per iteration)
sequence query (sequential-access latency benchmark, multi thread): 3905752569 nanoseconds
(bandwidth = 333.04 MB/s) (throughput = 4777.17 nanoseconds per iteration)
sequence query (random-access latency benchmark, single thread): 32844866933 nanoseconds
(bandwidth = 39.60 MB/s) (throughput = 40172.93 nanoseconds per iteration)
equence query (random-access latency benchmark, multi thread): 5199542168 nanoseconds
(bandwidth = 250.17 MB/s) (throughput = 6359.62 nanoseconds per iteration)
#include "FastaGeneIndexer.h"
#include "CpuBenchmarker.h"
#include <random>
int main(int argC, char** argV)
{
try
{
bool debug = true;
FastaGeneIndexer cache("./data/influenza.fna", debug);
size_t n = cache.n();
size_t byteCount = 0;
{
CpuBenchmarker bench(0,"init");
for(int i=0;i<n;i++)
{
std::string str = cache.getSequence(i);
byteCount += str.length();
}
}
{
CpuBenchmarker bench(byteCount,"sequence query (sequential-access latency benchmark, single thread)",n);
for(int i=0;i<n;i++)
{
std::string str = cache.getSequence(i);
}
}
{
CpuBenchmarker bench(byteCount,"sequence query (sequential-access latency benchmark, multi thread)",n);
#pragma omp parallel for
for(int i=0;i<n;i++)
{
std::string str = cache.getSequence(i);
}
}
{
CpuBenchmarker bench(byteCount,"sequence query (random-access latency benchmark, single thread)",n);
for(int i=0;i<n;i++)
{
auto f = [](const int & min, const int & max) {
static thread_local std::mt19937 generator;
std::uniform_int_distribution<int> distribution(min,max);
return distribution(generator);
};
std::string str = cache.getSequence(f(0,n-1));
}
}
{
CpuBenchmarker bench(byteCount,"equence query (random-access latency benchmark, multi thread)",n);
#pragma omp parallel for
for(int i=0;i<n;i++)
{
auto f = [](const int & min, const int & max) {
static thread_local std::mt19937 generator;
std::uniform_int_distribution<int> distribution(min,max);
return distribution(generator);
};
std::string str = cache.getSequence(f(0,n-1));
}
}
}
catch(std::exception & e)
{
std::cout<< e.what() <<std::endl;
}
return 0;
}