Permalink
Browse files

trying to bring thread affinitization, various lock types, TBB fully …

…over from Bowtie2
  • Loading branch information...
1 parent 8d999ce commit d2d908f532dfdc9c2c38ba15f666b75b47e0db89 @BenLangmead committed Mar 20, 2016
Showing with 418 additions and 223 deletions.
  1. +25 −6 Makefile
  2. +0 −1 SeqAn-1.1/seqan/file/file_format_cgviz.h
  3. +0 −4 SeqAn-1.1/seqan/file/file_format_fasta_align.h
  4. +2 −6 aligner_0mm.h
  5. +2 −6 aligner_1mm.h
  6. +2 −6 aligner_23mm.h
  7. +3 −3 bitset.h
  8. +8 −8 ebwt_search.cpp
  9. +8 −8 ebwt_search.h
  10. +2 −2 ebwt_search_util.h
  11. +20 −35 hit.h
  12. +3 −4 log.h
  13. +57 −104 pat.h
  14. +67 −0 ptl.hpp
  15. +1 −2 sam.cpp
  16. +157 −19 threading.h
  17. +14 −9 timer.h
  18. +47 −0 tkt.hpp
View
@@ -46,19 +46,19 @@ ifneq (,$(findstring Darwin,$(shell uname)))
ifneq (,$(findstring 13,$(shell uname -r)))
CPP = clang++
CC = clang
- EXTRA_FLAGS += -stdlib=libstdc++
+ override EXTRA_FLAGS += -stdlib=libstdc++
endif
ifneq (,$(findstring 14,$(shell uname -r)))
CPP = clang++
CC = clang
- EXTRA_FLAGS += -stdlib=libstdc++
+ override EXTRA_FLAGS += -stdlib=libstdc++
endif
endif
LINUX = 0
ifneq (,$(findstring Linux,$(shell uname)))
LINUX = 1
- EXTRA_FLAGS += -Wl,--hash-style=both
+ override EXTRA_FLAGS += -Wl,--hash-style=both
endif
MM_DEF =
@@ -75,21 +75,25 @@ PTHREAD_DEF =
ifeq (1,$(MINGW))
PTHREAD_LIB =
- EXTRA_FLAGS += -static-libgcc -static-libstdc++
+ override EXTRA_FLAGS += -static-libgcc -static-libstdc++
else
PTHREAD_LIB = -lpthread
endif
+ifeq (1,$(NO_SPINLOCK))
+ override EXTRA_FLAGS += -DNO_SPINLOCK
+endif
+
ifeq (1,$(WITH_TBB))
LIBS = $(PTHREAD_LIB) -ltbb -ltbbmalloc_proxy
- EXTRA_FLAGS += -DWITH_TBB
+ override EXTRA_FLAGS += -DWITH_TBB
else
LIBS = $(PTHREAD_LIB)
endif
POPCNT_CAPABILITY ?= 1
ifeq (1, $(POPCNT_CAPABILITY))
- EXTRA_FLAGS += -DPOPCNT_CAPABILITY
+ override EXTRA_FLAGS += -DPOPCNT_CAPABILITY
INC += -I third_party
endif
@@ -110,12 +114,27 @@ ifeq (1,$(WITH_THREAD_PROFILING))
override EXTRA_FLAGS += -DPER_THREAD_TIMING=1
endif
+ifeq (1,$(WITH_AFFINITY))
+ override EXTRA_FLAGS += -DWITH_AFFINITY=1
+endif
+
+ifeq (1,$(WITH_QUEUELOCK))
+ override EXTRA_FLAGS += -DWITH_QUEUELOCK=1
+endif
+
ifeq (1,$(WITH_FINE_TIMER))
override EXTRA_FLAGS += -DUSE_FINE_TIMER=1
endif
OTHER_CPPS = ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp \
edit.cpp ebwt.cpp
+
+ifeq (1,$(WITH_COHORTLOCK))
+ LIBS += -lnuma
+ override EXTRA_FLAGS += -DWITH_COHORTLOCK=1
+ OTHER_CPPS += cohort.cpp cpu_numa_info.cpp
+endif
+
ifneq (1,$(WITH_TBB))
OTHER_CPPS += tinythread.cpp
endif
@@ -63,7 +63,6 @@ void _write_impl(TFile& target, Align<TSource, TSpec>& align, TStringContainer&
SEQAN_CHECKPOINT
typedef Align<TSource, TSpec> const TAlign;
- typedef typename Row<TAlign>::Type TRow;
typedef typename Position<typename Rows<TAlign>::Type>::Type TRowsPosition;
typedef typename Position<TAlign>::Type TPosition;
TRowsPosition row_count = length(rows(align));
@@ -134,9 +134,6 @@ SEQAN_CHECKPOINT
TSize numRows=length(beg_end_length) / 3;
resize(rows(align), numRows); //rows
- typedef Align<TSource, TSpec> TAlign;
- typedef typename Row<TAlign>::Type TRow;
-
for(TSize i=0;i<numRows;++i) {
TSize begin = beg_end_length[i*3];
// TSize end = beg_end_length[i*3+1];
@@ -249,7 +246,6 @@ void _write_impl(TFile& file, Align<TSource, TSpec>& align, TStringContainer& id
typedef Align<TSource, TSpec> const TAlign;
typedef typename Row<TAlign>::Type TRow;
typedef typename Position<typename Rows<TAlign>::Type>::Type TRowsPosition;
- typedef typename Position<TAlign>::Type TPosition;
TRowsPosition row_count = length(rows(align));
for(TRowsPosition i=0;i<row_count;++i) {
View
@@ -58,8 +58,7 @@ class UnpairedExactAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtFw.isInMemory());
}
@@ -133,7 +132,6 @@ class UnpairedExactAlignerV1Factory : public AlignerFactory {
bool rangeMode_;
bool verbose_;
bool quiet_;
- uint32_t seed_;
};
/**
@@ -201,8 +199,7 @@ class PairedExactAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtFw.isInMemory());
}
@@ -376,7 +373,6 @@ class PairedExactAlignerV1Factory : public AlignerFactory {
const bool rangeMode_;
const bool verbose_;
const bool quiet_;
- const uint32_t seed_;
};
#endif /* ALIGNER_0MM_H_ */
View
@@ -59,8 +59,7 @@ class Unpaired1mmAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtFw.isInMemory());
assert(ebwtBw != NULL);
@@ -170,7 +169,6 @@ class Unpaired1mmAlignerV1Factory : public AlignerFactory {
bool rangeMode_;
bool verbose_;
bool quiet_;
- uint32_t seed_;
};
/**
@@ -239,8 +237,7 @@ class Paired1mmAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtBw != NULL);
assert(ebwtFw.isInMemory());
@@ -488,7 +485,6 @@ class Paired1mmAlignerV1Factory : public AlignerFactory {
const bool rangeMode_;
const bool verbose_;
const bool quiet_;
- const uint32_t seed_;
};
#endif /* ALIGNER_1MM_H_ */
View
@@ -60,8 +60,7 @@ class Unpaired23mmAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtFw.isInMemory());
assert(ebwtBw != NULL);
@@ -240,7 +239,6 @@ class Unpaired23mmAlignerV1Factory : public AlignerFactory {
const bool rangeMode_;
const bool verbose_;
const bool quiet_;
- uint32_t seed_;
};
/**
@@ -312,8 +310,7 @@ class Paired23mmAlignerV1Factory : public AlignerFactory {
strandFix_(strandFix),
rangeMode_(rangeMode),
verbose_(verbose),
- quiet_(quiet),
- seed_(seed)
+ quiet_(quiet)
{
assert(ebwtBw != NULL);
assert(ebwtFw.isInMemory());
@@ -685,7 +682,6 @@ class Paired23mmAlignerV1Factory : public AlignerFactory {
const bool rangeMode_;
const bool verbose_;
const bool quiet_;
- const uint32_t seed_;
};
#endif /* ALIGNER_23MM_H_ */
View
@@ -93,7 +93,7 @@ class SyncBitset {
*/
bool test(uint32_t i) {
bool ret;
- GUARD_LOCK(mutex_m);
+ ThreadSafe _ts(&mutex_m);
ret = testUnsync(i);
return ret;
}
@@ -103,7 +103,7 @@ class SyncBitset {
* it has been set. Uses synchronization.
*/
void set(uint32_t i) {
- GUARD_LOCK(mutex_m);
+ ThreadSafe _ts(&mutex_m);
while(i >= _sz) {
// Slow path: bitset needs to be expanded before the
// specified bit can be set
@@ -123,7 +123,7 @@ class SyncBitset {
* synchronization.
*/
void setOver(uint32_t i) {
- GUARD_LOCK(mutex_m);
+ ThreadSafe _ts(&mutex_m);
while(i >= _sz) {
// Slow path: bitset needs to be expanded before the
// specified bit can be set
View
@@ -1138,7 +1138,7 @@ static Ebwt<String<Dna> >* exactSearch_ebwt;
static vector<String<Dna5> >* exactSearch_os;
static BitPairReference* exactSearch_refs;
#ifdef WITH_TBB
-void exactSearchWorker::operator()() {
+void exactSearchWorker::operator()() const {
#else
static void exactSearchWorker(void *vp) {
int tid = *((int*)vp);
@@ -1218,7 +1218,7 @@ static void exactSearchWorker(void *vp) {
* A statefulness-aware worker driver. Uses UnpairedExactAlignerV1.
*/
#ifdef WITH_TBB
-void exactSearchWorkerStateful::operator()() {
+void exactSearchWorkerStateful::operator()() const {
#else
static void exactSearchWorkerStateful(void *vp) {
int tid = *((int*)vp);
@@ -1402,7 +1402,7 @@ static BitPairReference* mismatchSearch_refs;
* A statefulness-aware worker driver. Uses Unpaired/Paired1mmAlignerV1.
*/
#ifdef WITH_TBB
-void mismatchSearchWorkerFullStateful::operator()() {
+void mismatchSearchWorkerFullStateful::operator()() const {
#else
static void mismatchSearchWorkerFullStateful(void *vp) {
int tid = *((int*)vp);
@@ -1487,7 +1487,7 @@ static void mismatchSearchWorkerFullStateful(void *vp) {
return;
}
#ifdef WITH_TBB
-void mismatchSearchWorkerFull::operator()(){
+void mismatchSearchWorkerFull::operator()() const {
#else
static void mismatchSearchWorkerFull(void *vp){
int tid = *((int*)vp);
@@ -1734,7 +1734,7 @@ static BitPairReference* twoOrThreeMismatchSearch_refs;
* A statefulness-aware worker driver. Uses UnpairedExactAlignerV1.
*/
#ifdef WITH_TBB
-void twoOrThreeMismatchSearchWorkerStateful::operator()(){
+void twoOrThreeMismatchSearchWorkerStateful::operator()() const {
#else
static void twoOrThreeMismatchSearchWorkerStateful(void *vp) {
int tid = *((int*)vp);
@@ -1822,7 +1822,7 @@ static void twoOrThreeMismatchSearchWorkerStateful(void *vp) {
return;
}
#ifdef WITH_TBB
-void twoOrThreeMismatchSearchWorkerFull::operator()(){
+void twoOrThreeMismatchSearchWorkerFull::operator()() const {
#else
static void twoOrThreeMismatchSearchWorkerFull(void *vp) {
int tid = *((int*)vp);
@@ -2042,7 +2042,7 @@ static int seededQualSearch_qualCutoff;
static BitPairReference* seededQualSearch_refs;
#ifdef WITH_TBB
-void seededQualSearchWorkerFull::operator()(){
+void seededQualSearchWorkerFull::operator()() const {
#else
static void seededQualSearchWorkerFull(void *vp) {
int tid = *((int*)vp);
@@ -2268,7 +2268,7 @@ static void seededQualSearchWorkerFull(void *vp) {
WORKER_EXIT();
}
#ifdef WITH_TBB
-void seededQualSearchWorkerFullStateful::operator()(){
+void seededQualSearchWorkerFullStateful::operator()() const {
#else
static void seededQualSearchWorkerFullStateful(void *vp) {
int tid = *((int*)vp);
View
@@ -18,7 +18,7 @@ class exactSearchWorkerStateful {
public:
exactSearchWorkerStateful(const exactSearchWorkerStateful& W): tid(W.tid) {};
exactSearchWorkerStateful(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
class exactSearchWorker {
@@ -27,7 +27,7 @@ class exactSearchWorker {
public:
exactSearchWorker(const exactSearchWorker& W): tid(W.tid) {};
exactSearchWorker(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
@@ -37,7 +37,7 @@ class mismatchSearchWorkerFull {
public:
mismatchSearchWorkerFull(const mismatchSearchWorkerFull& W): tid(W.tid) {};
mismatchSearchWorkerFull(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
@@ -47,7 +47,7 @@ class mismatchSearchWorkerFullStateful {
public:
mismatchSearchWorkerFullStateful(const mismatchSearchWorkerFullStateful& W): tid(W.tid) {};
mismatchSearchWorkerFullStateful(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
class twoOrThreeMismatchSearchWorkerStateful {
@@ -56,7 +56,7 @@ class twoOrThreeMismatchSearchWorkerStateful {
public:
twoOrThreeMismatchSearchWorkerStateful(const twoOrThreeMismatchSearchWorkerStateful& W): tid(W.tid) {};
twoOrThreeMismatchSearchWorkerStateful(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
class twoOrThreeMismatchSearchWorkerFull {
@@ -65,7 +65,7 @@ class twoOrThreeMismatchSearchWorkerFull {
public:
twoOrThreeMismatchSearchWorkerFull(const twoOrThreeMismatchSearchWorkerFull& W): tid(W.tid) {};
twoOrThreeMismatchSearchWorkerFull(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
@@ -75,7 +75,7 @@ class seededQualSearchWorkerFullStateful {
public:
seededQualSearchWorkerFullStateful(const seededQualSearchWorkerFullStateful& W): tid(W.tid) {};
seededQualSearchWorkerFullStateful(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
class seededQualSearchWorkerFull {
@@ -84,7 +84,7 @@ class seededQualSearchWorkerFull {
public:
seededQualSearchWorkerFull(const seededQualSearchWorkerFull& W): tid(W.tid) {};
seededQualSearchWorkerFull(int id):tid(id) {};
- void operator()();
+ void operator()() const;
};
Oops, something went wrong.

0 comments on commit d2d908f

Please sign in to comment.