-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is @tahorst's test case to reproduce an Arrow hang. Is it caused by a Gillespie algorithm blowup? By integer overflow? Something else? **Note:** `make clean compile` prints an unexpected warning ``` building 'arrow.arrowhead' extension Warning: Can't read registry to find the necessary compiler setting Make sure that Python modules winreg, win32api or win32con are installed. C compiler: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include ``` **Note:** `test_flagella` also fails: `arrow/arrow.py:176: SimulationFailure`.
- Loading branch information
Showing
5 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# A test case for Issue #48. | ||
# | ||
# This code should reproduce the error: the program hangs after it prints "7100" | ||
# and eventually runs out of memory. You'll have to Ctrl+Z to stop it. | ||
# Ctrl+C won't work. | ||
# | ||
# It hangs only with certain seeds and numbers of molecules. The system can | ||
# evolve with the same number of molecule counts for 7179 iterations before it | ||
# hangs. Adding 1 to all of the molecules causes it to hang at an earlier | ||
# iteration. | ||
# | ||
# TODO: Debug this. Is it caused by a Gillespie algorithm blowup (see below), | ||
# integer overflow Undefined Behavior in C, or something else? | ||
# | ||
# The Gillespie algorithm is prone to explode [symptom?] under certain | ||
# conditions if the exponent term in the choice calculation is too large. | ||
# | ||
# The workaround is to find the problematic reaction and decompose the | ||
# stoichiometry into an equivalent problem with more steps. | ||
# | ||
# The flagella example had something like 170 identical subunits which caused | ||
# the problem. Breaking it into 2+ equivalent reactions fixed it. | ||
# | ||
# It'd be good for the Arrow code to catch this problem when/before it happens | ||
# and at least identify which reactions are problematic. | ||
|
||
import os | ||
|
||
from arrow import StochasticSystem | ||
import numpy as np | ||
|
||
|
||
def np_load(filename): | ||
filepath = os.path.join(os.path.dirname(__file__), filename) | ||
return np.load(filepath) | ||
|
||
|
||
def test_hang(): | ||
# TODO: Use a pytest plug-in to timeout after some threshold. | ||
|
||
seed = 807952948 | ||
|
||
stoich = np_load('stoich.npy') | ||
mol = np_load('complex-counts.npy') | ||
rates = np_load('rates.npy') | ||
|
||
system = StochasticSystem(stoich, random_seed=seed) | ||
for i in range(10000): | ||
if i % 100 == 0: | ||
print(i) | ||
|
||
result = system.evolve(1, mol, rates) | ||
|
||
|
||
if __name__ == '__main__': | ||
test_hang() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import os | ||
# from glob import glob | ||
import setuptools # used indirectly for bdist_wheel cmd and long_description_content_type | ||
from distutils.core import setup | ||
from distutils.extension import Extension | ||
|
@@ -41,8 +40,8 @@ | |
name='stochastic-arrow', | ||
version='0.4.4', | ||
packages=['arrow'], | ||
author='Ryan Spangler, John Mason, Jerry Morrison', | ||
author_email='[email protected]', | ||
author='Ryan Spangler, John Mason, Jerry Morrison, Chris Skalnik', | ||
author_email='[email protected]', | ||
url='https://github.com/CovertLab/arrow', | ||
license='MIT', | ||
include_dirs=include, | ||
|