Skip to content

Commit

Permalink
Merge branch 'bug_fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
ch4rr0 committed Sep 14, 2021
2 parents da7b440 + 5a4d538 commit 73821b4
Show file tree
Hide file tree
Showing 22 changed files with 335 additions and 350 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/random_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Run bowtie random tests for all commits to master on Ubuntu and MacOS
on:
push:
branches:
- 'master'
paths:
- '**.c'
- '**.h'
- '**.cpp'
- 'bowtie'
- 'bowtie-build'
- 'bowtie-inspect'
- 'Makefile'
- 'scripts/test/**'
pull_request:
branches:
- 'master'
paths:
- '**.c'
- '**.h'
- '**.cpp'
- 'bowtie'
- 'bowtie-build'
- 'bowtie-inspect'
- 'Makefile'
- 'scripts/test/**'
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install zlib development files
run: |
sudo apt-get update
sudo apt-get install zlib1g-dev
linux:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- name: Run random tests
run: |
make allall
make random-test
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Run random tests
run: |
make allall
make random-test
54 changes: 54 additions & 0 deletions .github/workflows/simple_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Run bowtie simple tests on Ubuntu and MacOS
on:
push:
branches:
- 'bug_fixes'
- 'master'
paths:
- '**.c'
- '**.h'
- '**.cpp'
- 'bowtie'
- 'bowtie-build'
- 'bowtie-inspect'
- 'Makefile'
- 'scripts/test/**'
pull_request:
branches:
- 'master'
paths:
- '**.c'
- '**.h'
- '**.cpp'
- 'bowtie'
- 'bowtie-build'
- 'bowtie-inspect'
- 'Makefile'
- 'scripts/test/**'
jobs:
setup:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v2
- name: Install zlib development files
run: |
sudo apt-get update
sudo apt-get install zlib1g-dev
linux:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v2
- name: Run simple tests
run: |
make allall
make simple-test
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Run simple tests
run: |
make allall
make simple-test
40 changes: 0 additions & 40 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,46 +7,6 @@ branches:
- bug_fixes
matrix:
include:
# Linux (gcc4.9)
- os: linux
language: python
python: "3.4"
dist: xenial
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.9
- zlib1g-dev
env:
- CC=gcc-4.9
- CXX=g++-4.9
# Linux (gcc8)
- os: linux
language: python
python: "3.8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-8
- zlib1g-dev
env:
- CC=gcc-8
- CXX=g++-8
- CXXFLAGS="-fuse-ld=gold"
# MacOS
- os: osx
osx_image: xcode11.2
compiler: clang
env:
- CC=clang
- CXX=clang++
- NPROC="$(sysctl -n hw.activecpu)"
before_install:
- brew unlink python@2
# ARM 64-bit
- os: linux
arch: arm64
Expand Down
36 changes: 10 additions & 26 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ bindir = $(prefix)/bin

ARCH = $(shell uname -m)
INC = $(if $(RELEASE_BUILD),-I$(CURDIR)/.include) -I third_party
LIBS = $(LDFLAGS) $(if $(RELEASE_BUILD),-L$(CURDIR)/.lib) -lz
LIBS = $(LDFLAGS) $(if $(RELEASE_BUILD),-L$(CURDIR)/.lib) -lz -lpthread
HEADERS = $(wildcard *.h)
BOWTIE_MM = 1
BOWTIE_SHARED_MEM = 1
Expand Down Expand Up @@ -65,25 +65,9 @@ SHMEM_DEF =
ifeq (1,$(BOWTIE_SHARED_MEM))
SHMEM_DEF = -DBOWTIE_SHARED_MEM
endif
PTHREAD_PKG =
PTHREAD_LIB =
PTHREAD_DEF =

ifeq (1,$(MINGW))
PTHREAD_LIB =
override EXTRA_FLAGS += -static-libgcc -static-libstdc++
else
PTHREAD_LIB = -lpthread
endif

ifeq (1,$(NO_SPINLOCK))
override EXTRA_FLAGS += -DNO_SPINLOCK
endif


LIBS += $(PTHREAD_LIB)
ifeq (1, $(WITH_TBBMALLOC))
LIBS += -ltbbmalloc
endif

POPCNT_CAPABILITY ?= 1
Expand All @@ -92,7 +76,6 @@ ifeq (aarch64,$(shell uname -m))
endif
ifeq (1, $(POPCNT_CAPABILITY))
override EXTRA_FLAGS += -DPOPCNT_CAPABILITY
INC += -I third_party
endif

PREFETCH_LOCALITY = 2
Expand All @@ -113,15 +96,16 @@ ifeq (1,$(WITH_THREAD_PROFILING))
endif

OTHER_CPPS = ccnt_lut.cpp ref_read.cpp alphabet.cpp shmem.cpp \
edit.cpp ebwt.cpp
edit.cpp ebwt.cpp bt2_locks.cpp

ifneq (1, $(NO_SPINLOCK))
OTHER_CPPS += bt2_locks.cpp
ifeq (1,$(WITH_QUEUELOCK))
NO_SPINLOCK = 1
override EXTRA_FLAGS += -DWITH_QUEUELOCK
endif

ifeq (1,$(WITH_QUEUELOCK))
OTHER_CPPS += bt2_locks.cpp
override EXTRA_FLAGS += -DWITH_QUEUELOCK=1
ifeq (1,$(NO_SPINLOCK))
$(info $(NO_SPINLOCK))
override EXTRA_FLAGS += -DNO_SPINLOCK
endif

ifeq (1,$(WITH_FINE_TIMER))
Expand Down Expand Up @@ -242,8 +226,8 @@ DEFS=-fno-strict-aliasing \
$(SHMEM_DEF)

ALL_FLAGS = $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(ALL_FLAGS)\""
RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(ALL_FLAGS)\""
DEBUG_DEFS = -DCOMPILER_OPTIONS="\"$(DEBUG_FLAGS) $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)\""
RELEASE_DEFS = -DCOMPILER_OPTIONS="\"$(RELEASE_FLAGS) $(EXTRA_FLAGS) $(CFLAGS) $(CXXFLAGS)\""

#
# bowtie-build targets
Expand Down
14 changes: 13 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Bowtie NEWS

Bowtie is now available for download. 0.9.0 is the first version to
be released under the OSI Artistic License (see `LICENSE') and freely
available to the public for download. The current version is 1.3.0.
available to the public for download. The current version is 1.3.1.

Reporting Issues
================
Expand All @@ -23,6 +23,18 @@ Keep up with our releases on the GitHub releases page:

Version Release History
=======================
Version 1.3.1 - Sep 13, 2021

* Fixed an overflow issue in `bowtie-build` that would sometimes
yield corrupt "large" (64-bit) indexes; the resulting index
would sometimes cause `bowtie` to hang. Note: `bowtie2-build`
does not have this issue.
* Fixed an issue in `bowtie` causing XM:i SAM optional field to
sometimes be off by 1 when using the `-m/-M` flags.
* Fixed an issue that would sometimes cause deadlocks in `bowtie`
when running multithreaded.
* Fixed an issue causing build errors when compiling against
a pre-C++11 standard.

Version 1.3.0 - Jul 22, 2020

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0
1.3.1
20 changes: 10 additions & 10 deletions bt2_locks.cpp
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
#include "bt2_locks.h"

#if (__cplusplus >= 201103L)

void mcs_lock::lock() {
#include "bt2_locks.h"

void mcs_lock::lock(mcs_node &node) {
node.next = nullptr;
node.unlocked = false;

mcs_node *pred = q.exchange(&node, std::memory_order_release);
mcs_node *pred = q.exchange(&node, std::memory_order_acq_rel);
if (pred) {
pred->next = &node;
node.unlocked = false;
pred->next.store(&node, std::memory_order_release);
spin_while_eq(node.unlocked, false);
}
node.unlocked.load(std::memory_order_acquire);
}

void mcs_lock::unlock() {
if (!node.next) {
void mcs_lock::unlock(mcs_node &node) {
if (!node.next.load(std::memory_order_acquire)) {
mcs_node *node_ptr = &node;
if (q.compare_exchange_strong(node_ptr,
(mcs_node *)nullptr,
std::memory_order_release))
return;
spin_while_eq(node.next, (mcs_node *)nullptr);
}
node.next->unlocked.store(true, std::memory_order_release);
node.next.load(std::memory_order_acquire)->unlocked.store(true, std::memory_order_release);
}

thread_local mcs_lock::mcs_node mcs_lock::node;

void spin_lock::lock() {
cpu_backoff backoff;
Expand All @@ -37,4 +36,5 @@ void spin_lock::lock() {
void spin_lock::unlock() {
flag.clear(std::memory_order_release);
}

#endif
18 changes: 9 additions & 9 deletions bt2_locks.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,27 +48,27 @@ class mcs_lock {
public:
mcs_lock(): q(nullptr) {}
struct mcs_node {
mcs_node *next;
std::atomic<mcs_node *> next;
std::atomic_bool unlocked;
};

void lock();
void unlock();
typedef mcs_node* mcs_node_ptr;
void lock(mcs_node &node);
void unlock(mcs_node &node);
typedef std::atomic<mcs_node *> mcs_node_ptr;
private:
void spin_while_eq(const volatile mcs_node_ptr& value, mcs_node *expected) {
void spin_while_eq(const volatile mcs_node_ptr& value, const volatile mcs_node *expected) {
cpu_backoff backoff;
while (value == expected)
while (value.load(std::memory_order_acquire) == expected)
backoff.pause();
}

void spin_while_eq(const volatile std::atomic_bool& value, bool expected) {
void spin_while_eq(const volatile std::atomic_bool& value, const volatile bool expected) {
cpu_backoff backoff;
while (value.load(std::memory_order_acquire) == expected)
backoff.pause();
}
std::atomic<mcs_node *> q;
static thread_local mcs_node node;
};
#endif

#endif // if (__cplusplus >= 201103L)
#endif // __MCS_LOCK_H__
2 changes: 1 addition & 1 deletion doc/website/manual.ssi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<h1>Table of Contents</h1>
<p>Bowtie 1.3.0</p>
<p>Bowtie 1.3.1</p>

<nav id="TOC" role="doc-toc">
<ul>
Expand Down
8 changes: 8 additions & 0 deletions doc/website/recent_news.ssi
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
<h2>1.3.1 - 09/13/2021</h2>
<ul>
<li>Fixed an overflow issue in <code>bowtie-build</code> that would sometimes yield corrupt "large" (64-bit) indexes; the resulting index would sometimes cause <code>bowtie</code> to hang. Note: <code>bowtie2-build</code> does not have this issue.</li>
<li>Fixed an issue in <code>bowtie</code> causing XM:i SAM optional field to sometimes be off by 1 when using the <code><a href="manual.shtml#bowtie-options-m">-m</a>/<a href="manual.shtml#bowtie-options-M">-M</a></code> flags.</li>
<li>Fixed an issue that would sometimes cause deadlocks in <code>bowtie</code> when running multithreaded.</li>
<li>Fixed an issue causing build errors when compiling against a pre-C++11 standard.</li>
</ul>

<h2>1.3.0 - 07/22/2020</h2>
<ul>
<li>Fixed an issue causing <code>bowtie</code> to report incorrect results when using a Bowtie 2 index.</li>
Expand Down
4 changes: 2 additions & 2 deletions doc/website/rhsidebar.ssi
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
</tr>
<tr>
<td>
<a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie/1.3.0">Bowtie 1.3.0</a>
<a href="https://sourceforge.net/projects/bowtie-bio/files/bowtie/1.3.1">Bowtie 1.3.1</a>
</td>
<td align="right">
07/22/20
09/13/21
</td>
</tr>
<tr>
Expand Down
Loading

0 comments on commit 73821b4

Please sign in to comment.