diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..82171fe6 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "test/ndiff"] + path = test/ndiff + url = https://github.com/quinoacomputing/ndiff.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c87e953..2f56bfa9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ string(REPLACE ";" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} " "-g -fconcepts -pedantic -fmax-errors=3 -Wall -Wextra -Werror -Wcast-align -Wcast-qual -Wctor-dtor-privacy " "-Wdisabled-optimization -Wformat=2 -Winit-self -Wlogical-op -Wmissing-include-dirs -Wno-type-limits " "-Wnoexcept -Woverloaded-virtual -Wredundant-decls -Wstrict-null-sentinel -Wstrict-overflow=1 " - "-Wswitch-default -Wundef -Wunused -Wzero-as-null-pointer-constant -Wuseless-cast -Wsuggest-override -fopenmp") + "-Wswitch-default -Wundef -Wunused -Wzero-as-null-pointer-constant -Wuseless-cast -Wsuggest-override -fopenmp") if(COMPILER_SUPPORTS_CXX11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") elseif(COMPILER_SUPPORTS_CXX0X) diff --git a/models/Belousov-Zhabotinksy/anderson b/models/Belousov-Zhabotinksy/anderson new file mode 100755 index 00000000..19a9ae7f Binary files /dev/null and b/models/Belousov-Zhabotinksy/anderson differ diff --git a/models/Belousov-Zhabotinksy/fast_gillespie b/models/Belousov-Zhabotinksy/fast_gillespie new file mode 100755 index 00000000..92097c3c Binary files /dev/null and b/models/Belousov-Zhabotinksy/fast_gillespie differ diff --git a/models/Belousov-Zhabotinksy/gillespie b/models/Belousov-Zhabotinksy/gillespie new file mode 100755 index 00000000..5d18436e Binary files /dev/null and b/models/Belousov-Zhabotinksy/gillespie differ diff --git a/models/Belousov-Zhabotinksy/nextreaction b/models/Belousov-Zhabotinksy/nextreaction new file mode 100755 index 00000000..e2749968 Binary files /dev/null and b/models/Belousov-Zhabotinksy/nextreaction differ diff --git a/models/Belousov-Zhabotinksy/param_grad_template.csv b/models/Belousov-Zhabotinksy/param_grad_template.csv new file mode 100644 index 00000000..b0a33e03 --- /dev/null +++ b/models/Belousov-Zhabotinksy/param_grad_template.csv @@ -0,0 +1,23 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of gradients. Only this one gradients setting is applied to all parameter sets when a simulation set is being run. +# Use '0' under all four columns of a reaction to indiate that it should not have a gradient. +# Gradient Codes +# x1 - start column +# y1 - start multiplier (use '1.23' to mean '123%') +# x2 - end column +# y2 - end multiplier +# For more information and examples see README.md section 2.2.2 + +grad_x1_br_synthesis, grad_y1_br_synthesis, grad_x2_br_synthesis, grad_y2_br_synthesis, , grad_x1_fe2_reaction, grad_y1_fe2_reaction, grad_x2_fe2_reaction, grad_y2_fe2_reaction, , grad_x1_fe3_reaction, grad_y1_fe3_reaction, grad_x2_fe3_reaction, grad_y2_fe3_reaction, , grad_x1_fe2_synthesis, grad_y1_fe2_synthesis, grad_x2_fe2_synthesis, grad_y2_fe2_synthesis, , , , +0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , , , \ No newline at end of file diff --git a/models/Belousov-Zhabotinksy/param_pert_template.csv b/models/Belousov-Zhabotinksy/param_pert_template.csv new file mode 100644 index 00000000..98906791 --- /dev/null +++ b/models/Belousov-Zhabotinksy/param_pert_template.csv @@ -0,0 +1,18 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of perturbations. Only this one perturbations set is applied to all parameter sets when a simulation set is being run. +# Use '0' to indicate that a reaction should not have perturbations. +# For more information and examples see README.md section 2.2.2 + +pert_br_synthesis, pert_fe2_reaction, pert_fe3_reaction, pert_fe2_synthesis, , , +0, 0, 0, 0, , , \ No newline at end of file diff --git a/models/Belousov-Zhabotinksy/param_sets.csv b/models/Belousov-Zhabotinksy/param_sets.csv index 374ef222..4080c310 100644 --- a/models/Belousov-Zhabotinksy/param_sets.csv +++ b/models/Belousov-Zhabotinksy/param_sets.csv @@ -1,3 +1,2 @@ -br_synthesis, fe2_reaction, fe3_reaction, fe2_synthesis, , , -0,0,0,0, , , -1,1,1,1,,, +br_synthesis, fe2_reaction, fe3_reaction, fe2_synthesis, , +1,1,1,1, , diff --git a/models/Belousov-Zhabotinksy/param_sets_template.csv b/models/Belousov-Zhabotinksy/param_sets_template.csv new file mode 100644 index 00000000..5f41847f --- /dev/null +++ b/models/Belousov-Zhabotinksy/param_sets_template.csv @@ -0,0 +1,16 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file can contain more than one set (each being on their own line). All sets are initialized and executed in parallel when a file is loaded into the simulation. +# For more information and examples see README.md section 2.2.1 + +br_synthesis, fe2_reaction, fe3_reaction, fe2_synthesis, , , \ No newline at end of file diff --git a/models/Belousov-Zhabotinksy/paramsearch b/models/Belousov-Zhabotinksy/paramsearch new file mode 100755 index 00000000..0d2919d6 Binary files /dev/null and b/models/Belousov-Zhabotinksy/paramsearch differ diff --git a/models/Belousov-Zhabotinksy/rejection b/models/Belousov-Zhabotinksy/rejection new file mode 100755 index 00000000..eb2fca65 Binary files /dev/null and b/models/Belousov-Zhabotinksy/rejection differ diff --git a/models/Belousov-Zhabotinksy/simulation b/models/Belousov-Zhabotinksy/simulation new file mode 100755 index 00000000..ccd46f77 Binary files /dev/null and b/models/Belousov-Zhabotinksy/simulation differ diff --git a/models/Belousov-Zhabotinksy/sortingdirect b/models/Belousov-Zhabotinksy/sortingdirect new file mode 100755 index 00000000..45c175fc Binary files /dev/null and b/models/Belousov-Zhabotinksy/sortingdirect differ diff --git a/models/Belousov-Zhabotinksy/sortingreaction b/models/Belousov-Zhabotinksy/sortingreaction new file mode 100755 index 00000000..8d356669 Binary files /dev/null and b/models/Belousov-Zhabotinksy/sortingreaction differ diff --git a/models/Belousov-Zhabotinksy/source/csv_gen b/models/Belousov-Zhabotinksy/source/csv_gen new file mode 100755 index 00000000..27e36dad Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/csv_gen differ diff --git a/models/Belousov-Zhabotinksy/source/libanderson_lib.a b/models/Belousov-Zhabotinksy/source/libanderson_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libanderson_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libfast_gillespie_lib.a b/models/Belousov-Zhabotinksy/source/libfast_gillespie_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libfast_gillespie_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libgillespie_lib.a b/models/Belousov-Zhabotinksy/source/libgillespie_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libgillespie_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libnextreaction_lib.a b/models/Belousov-Zhabotinksy/source/libnextreaction_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libnextreaction_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libparamsearch_lib.a b/models/Belousov-Zhabotinksy/source/libparamsearch_lib.a new file mode 100644 index 00000000..0f2efd5a Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libparamsearch_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/librejection_lib.a b/models/Belousov-Zhabotinksy/source/librejection_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/librejection_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libsimulation_lib.a b/models/Belousov-Zhabotinksy/source/libsimulation_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libsimulation_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libsortingdirect_lib.a b/models/Belousov-Zhabotinksy/source/libsortingdirect_lib.a new file mode 100644 index 00000000..4437a850 Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libsortingdirect_lib.a differ diff --git a/models/Belousov-Zhabotinksy/source/libsortingreaction_lib.a b/models/Belousov-Zhabotinksy/source/libsortingreaction_lib.a new file mode 100644 index 00000000..0f2efd5a Binary files /dev/null and b/models/Belousov-Zhabotinksy/source/libsortingreaction_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/bz_simulation b/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/bz_simulation new file mode 100755 index 00000000..1ae46175 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/bz_simulation differ diff --git a/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/libbz_simulation_lib.a b/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/libbz_simulation_lib.a new file mode 100644 index 00000000..0b039017 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/Belousov-Zhabotinksy/libbz_simulation_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/Nan_Test/libnan_simulation_lib.a b/models/Belousov-Zhabotinksy/test/Nan_Test/libnan_simulation_lib.a new file mode 100644 index 00000000..cdb4a487 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/Nan_Test/libnan_simulation_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/Nan_Test/nan_simulation b/models/Belousov-Zhabotinksy/test/Nan_Test/nan_simulation new file mode 100755 index 00000000..b0f60790 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/Nan_Test/nan_simulation differ diff --git a/models/Belousov-Zhabotinksy/test/her_model_2014/her2014_simulation b/models/Belousov-Zhabotinksy/test/her_model_2014/her2014_simulation new file mode 100755 index 00000000..9e84420b Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/her_model_2014/her2014_simulation differ diff --git a/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_param_search_lib.a b/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_param_search_lib.a new file mode 100644 index 00000000..737bba18 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_param_search_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_simulation_lib.a b/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_simulation_lib.a new file mode 100644 index 00000000..93ddc031 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/her_model_2014/libher2014_simulation_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/ndiff/maddiff b/models/Belousov-Zhabotinksy/test/ndiff/maddiff new file mode 100755 index 00000000..062ae878 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/ndiff/maddiff differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/libsimple_gillespie_lib.a b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_gillespie_lib.a new file mode 100644 index 00000000..a9800f2e Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_gillespie_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/libsimple_nr_lib.a b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_nr_lib.a new file mode 100644 index 00000000..a9800f2e Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_nr_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/libsimple_rej_lib.a b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_rej_lib.a new file mode 100644 index 00000000..a9800f2e Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/libsimple_rej_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/simple_gillespie b/models/Belousov-Zhabotinksy/test/simple_model/simple_gillespie new file mode 100755 index 00000000..69acd2d2 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/simple_gillespie differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/simple_nr b/models/Belousov-Zhabotinksy/test/simple_model/simple_nr new file mode 100755 index 00000000..ddc10015 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/simple_nr differ diff --git a/models/Belousov-Zhabotinksy/test/simple_model/simple_rej b/models/Belousov-Zhabotinksy/test/simple_model/simple_rej new file mode 100755 index 00000000..d66bc4eb Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/simple_model/simple_rej differ diff --git a/models/Belousov-Zhabotinksy/test/time_test/libtime_test_lib.a b/models/Belousov-Zhabotinksy/test/time_test/libtime_test_lib.a new file mode 100644 index 00000000..38857cfe Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/time_test/libtime_test_lib.a differ diff --git a/models/Belousov-Zhabotinksy/test/time_test/time_test b/models/Belousov-Zhabotinksy/test/time_test/time_test new file mode 100755 index 00000000..37a711e6 Binary files /dev/null and b/models/Belousov-Zhabotinksy/test/time_test/time_test differ diff --git a/models/Turing-Pattern/anderson b/models/Turing-Pattern/anderson new file mode 100755 index 00000000..d25f04f2 Binary files /dev/null and b/models/Turing-Pattern/anderson differ diff --git a/models/Turing-Pattern/benchmark_data.csv b/models/Turing-Pattern/benchmark_data.csv new file mode 100644 index 00000000..6caa2a0e --- /dev/null +++ b/models/Turing-Pattern/benchmark_data.csv @@ -0,0 +1 @@ +725900,725900,838319,725900,838319,1.03452e+06,725900,838319,1.03452e+06,1.03931e+06,725900,838319,1.03452e+06,1.03931e+06,995383,725900,838319,1.03452e+06,1.03931e+06,995383,1.01677e+06,725900,838319,1.03452e+06,1.03931e+06,995383,1.01677e+06,1.13259e+06,725900,838319,1.03452e+06,1.03931e+06,995383,1.01677e+06,1.13259e+06,1.25747e+06,725900,838319,1.03452e+06,1.03931e+06,995383,1.01677e+06,1.13259e+06,1.25747e+06,1.39037e+06,725900,838319,1.03452e+06,1.03931e+06,995383,1.01677e+06,1.13259e+06,1.25747e+06,1.39037e+06,1.48307e+06, \ No newline at end of file diff --git a/models/Turing-Pattern/fast_gillespie b/models/Turing-Pattern/fast_gillespie new file mode 100755 index 00000000..018de86a Binary files /dev/null and b/models/Turing-Pattern/fast_gillespie differ diff --git a/models/Turing-Pattern/gillespie b/models/Turing-Pattern/gillespie new file mode 100755 index 00000000..2539659f Binary files /dev/null and b/models/Turing-Pattern/gillespie differ diff --git a/models/Turing-Pattern/nextreaction b/models/Turing-Pattern/nextreaction index ce6585c7..0140d958 100755 Binary files a/models/Turing-Pattern/nextreaction and b/models/Turing-Pattern/nextreaction differ diff --git a/models/Turing-Pattern/output.csv b/models/Turing-Pattern/output.csv deleted file mode 100644 index 921c567b..00000000 --- a/models/Turing-Pattern/output.csv +++ /dev/null @@ -1,141 +0,0 @@ - -# This file can be used as a template for user-created/modified analysis inputs in the context of this particular model for these particular command-line arguments. -# The row after next MUST remain in the file in order for it to be parsable by the CSV reader. They indicate the following: -cell-total, time-start, time-col, cell-start, cell-end, specie-option, -10,0,0,0,10,1,1,1,1, - -Cell,inhibitor,activator,inhibitor_dt,activator_dt, -Cell: 0,0,0,0,0, -Cell: 1,0,0,0,0, -Cell: 2,0,0,0,0, -Cell: 3,0,0,0,0, -Cell: 4,0,0,0,0, -Cell: 5,0,0,0,0, -Cell: 6,0,0,0,0, -Cell: 7,0,0,0,0, -Cell: 8,0,0,0,0, -Cell: 9,0,0,0,0, - -Cell: 0,1,1,1,0, -Cell: 1,1,0,1,1, -Cell: 2,1,1,1,0, -Cell: 3,0,0,1,4, -Cell: 4,0,1,1,0, -Cell: 5,0,0,1,1, -Cell: 6,0,1,2,1, -Cell: 7,1,0,1,1, -Cell: 8,0,0,0,0, -Cell: 9,0,0,0,3, - -Cell: 0,1,2,2,0, -Cell: 1,4,1,2,0, -Cell: 2,0,3,3,0, -Cell: 3,6,5,10,2, -Cell: 4,4,3,4,0, -Cell: 5,4,1,2,0, -Cell: 6,0,2,4,0, -Cell: 7,2,0,2,1, -Cell: 8,1,3,3,0, -Cell: 9,1,2,4,1, - -Cell: 0,0,2,2,0, -Cell: 1,2,2,6,0, -Cell: 2,1,1,4,0, -Cell: 3,8,6,12,1, -Cell: 4,0,5,7,0, -Cell: 5,0,0,4,4, -Cell: 6,0,2,4,0, -Cell: 7,1,2,5,0, -Cell: 8,1,2,4,1, -Cell: 9,0,3,5,0, -Cell: 11,0,2,2,0, -Cell: 13,0,2,2,0, -Cell: 18,0,2,2,0, - -Cell: 0,1,2,4,0, -Cell: 1,4,6,10,0, -Cell: 2,1,1,7,0, -Cell: 3,7,6,14,1, -Cell: 4,5,6,8,0, -Cell: 5,0,3,10,2, -Cell: 6,6,5,7,0, -Cell: 7,3,1,6,1, -Cell: 8,2,4,8,0, -Cell: 9,0,3,8,0, -Cell: 11,0,3,3,0, -Cell: 13,3,1,2,0, -Cell: 18,2,4,6,0, - -Cell: 0,2,0,4,0, -Cell: 1,4,6,10,0, -Cell: 2,3,5,10,0, -Cell: 3,1,6,16,1, -Cell: 15,2,0,4,0, -Cell: 5,0,1,10,0, -Cell: 6,5,2,7,0, -Cell: 7,5,0,7,3, -Cell: 8,3,7,13,0, -Cell: 9,4,0,7,1, -Cell: 11,1,3,3,0, -Cell: 13,0,0,2,1, -Cell: 18,1,5,7,0, -Cell: 20,1,5,7,0, -Cell: 10,0,0,2,1, - -Cell: 0,0,2,6,0, -Cell: 1,7,6,12,1, -Cell: 2,9,5,11,0, -Cell: 3,4,1,17,4, -Cell: 15,4,1,5,0, -Cell: 6,0,0,0,0, -Cell: 8,8,6,13,1, -Cell: 9,1,1,10,1, -Cell: 11,0,1,5,1, -Cell: 13,1,1,3,0, -Cell: 18,3,5,9,0, -Cell: 20,4,1,8,4, -Cell: 10,1,2,5,1, - -Cell: 0,0,3,7,0, -Cell: 1,1,10,15,0, -Cell: 2,0,6,12,0, -Cell: 3,2,4,26,6, -Cell: 15,11,2,7,0, -Cell: 6,0,0,0,0, -Cell: 8,11,4,15,3, -Cell: 9,0,2,11,0, -Cell: 11,4,1,7,0, -Cell: 13,0,2,5,0, -Cell: 18,7,5,11,0, -Cell: 20,0,0,12,16, -Cell: 10,0,2,6,1, - -Cell: 0,2,0,8,1, -Cell: 1,1,12,14,0, -Cell: 2,4,4,12,2, -Cell: 3,0,7,32,3, -Cell: 15,5,1,8,3, -Cell: 6,0,0,0,0, -Cell: 8,5,4,18,0, -Cell: 9,8,4,13,0, -Cell: 11,7,2,9,2, -Cell: 13,0,5,6,0, -Cell: 18,8,4,11,1, -Cell: 20,3,3,27,21, -Cell: 10,3,2,8,1, - -Cell: 0,3,0,8,1, -Cell: 1,1,13,14,0, -Cell: 2,1,2,11,0, -Cell: 3,13,10,35,0, -Cell: 15,3,0,12,4, -Cell: 6,0,0,0,0, -Cell: 8,0,2,16,1, -Cell: 9,3,3,14,0, -Cell: 11,7,0,10,4, -Cell: 13,2,9,11,0, -Cell: 18,3,5,14,0, -Cell: 20,9,0,52,30, -Cell: 10,2,1,9,2, - -# Showing cells 0-12 until 9.06612 min diff --git a/models/Turing-Pattern/param_grad_template.csv b/models/Turing-Pattern/param_grad_template.csv new file mode 100644 index 00000000..b4fd2ad7 --- /dev/null +++ b/models/Turing-Pattern/param_grad_template.csv @@ -0,0 +1,23 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of gradients. Only this one gradients setting is applied to all parameter sets when a simulation set is being run. +# Use '0' under all four columns of a reaction to indiate that it should not have a gradient. +# Gradient Codes +# x1 - start column +# y1 - start multiplier (use '1.23' to mean '123%') +# x2 - end column +# y2 - end multiplier +# For more information and examples see README.md section 2.2.2 + +grad_x1_activator_diffusion_rate, grad_y1_activator_diffusion_rate, grad_x2_activator_diffusion_rate, grad_y2_activator_diffusion_rate, , grad_x1_inhibitor_diffusion_rate, grad_y1_inhibitor_diffusion_rate, grad_x2_inhibitor_diffusion_rate, grad_y2_inhibitor_diffusion_rate, , grad_x1_activator_synthesis, grad_y1_activator_synthesis, grad_x2_activator_synthesis, grad_y2_activator_synthesis, , grad_x1_inhibitor_synthesis, grad_y1_inhibitor_synthesis, grad_x2_inhibitor_synthesis, grad_y2_inhibitor_synthesis, , grad_x1_activator_dCon, grad_y1_activator_dCon, grad_x2_activator_dCon, grad_y2_activator_dCon, , grad_x1_inhibitor_dCon, grad_y1_inhibitor_dCon, grad_x2_inhibitor_dCon, grad_y2_inhibitor_dCon, , , , +0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , , , \ No newline at end of file diff --git a/models/Turing-Pattern/param_pert_template.csv b/models/Turing-Pattern/param_pert_template.csv new file mode 100644 index 00000000..038f63c6 --- /dev/null +++ b/models/Turing-Pattern/param_pert_template.csv @@ -0,0 +1,18 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of perturbations. Only this one perturbations set is applied to all parameter sets when a simulation set is being run. +# Use '0' to indicate that a reaction should not have perturbations. +# For more information and examples see README.md section 2.2.2 + +pert_activator_diffusion_rate, pert_inhibitor_diffusion_rate, pert_activator_synthesis, pert_inhibitor_synthesis, pert_activator_dCon, pert_inhibitor_dCon, , , +0, 0, 0, 0, 0, 0, , , \ No newline at end of file diff --git a/models/Turing-Pattern/param_sets_template.csv b/models/Turing-Pattern/param_sets_template.csv new file mode 100644 index 00000000..83c228d6 --- /dev/null +++ b/models/Turing-Pattern/param_sets_template.csv @@ -0,0 +1,16 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file can contain more than one set (each being on their own line). All sets are initialized and executed in parallel when a file is loaded into the simulation. +# For more information and examples see README.md section 2.2.1 + +activator_diffusion_rate, inhibitor_diffusion_rate, activator_synthesis, inhibitor_synthesis, activator_dCon, inhibitor_dCon, , , \ No newline at end of file diff --git a/models/Turing-Pattern/rejection b/models/Turing-Pattern/rejection new file mode 100755 index 00000000..b100e362 Binary files /dev/null and b/models/Turing-Pattern/rejection differ diff --git a/models/Turing-Pattern/simulation b/models/Turing-Pattern/simulation new file mode 100755 index 00000000..7f2fd435 Binary files /dev/null and b/models/Turing-Pattern/simulation differ diff --git a/models/Turing-Pattern/sortingdirect b/models/Turing-Pattern/sortingdirect new file mode 100755 index 00000000..e6df6cb2 Binary files /dev/null and b/models/Turing-Pattern/sortingdirect differ diff --git a/models/Turing-Pattern/source/csv_gen b/models/Turing-Pattern/source/csv_gen new file mode 100755 index 00000000..5504fb42 Binary files /dev/null and b/models/Turing-Pattern/source/csv_gen differ diff --git a/models/Turing-Pattern/source/libanderson_lib.a b/models/Turing-Pattern/source/libanderson_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libanderson_lib.a differ diff --git a/models/Turing-Pattern/source/libfast_gillespie_lib.a b/models/Turing-Pattern/source/libfast_gillespie_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libfast_gillespie_lib.a differ diff --git a/models/Turing-Pattern/source/libgillespie_lib.a b/models/Turing-Pattern/source/libgillespie_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libgillespie_lib.a differ diff --git a/models/Turing-Pattern/source/libnextreaction_lib.a b/models/Turing-Pattern/source/libnextreaction_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libnextreaction_lib.a differ diff --git a/models/Turing-Pattern/source/librejection_lib.a b/models/Turing-Pattern/source/librejection_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/librejection_lib.a differ diff --git a/models/Turing-Pattern/source/libsimulation_lib.a b/models/Turing-Pattern/source/libsimulation_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libsimulation_lib.a differ diff --git a/models/Turing-Pattern/source/libsortingdirect_lib.a b/models/Turing-Pattern/source/libsortingdirect_lib.a new file mode 100644 index 00000000..a9d918b1 Binary files /dev/null and b/models/Turing-Pattern/source/libsortingdirect_lib.a differ diff --git a/models/Turing-Pattern/test/Belousov-Zhabotinksy/bz_simulation b/models/Turing-Pattern/test/Belousov-Zhabotinksy/bz_simulation new file mode 100755 index 00000000..e9649de2 Binary files /dev/null and b/models/Turing-Pattern/test/Belousov-Zhabotinksy/bz_simulation differ diff --git a/models/Turing-Pattern/test/Belousov-Zhabotinksy/libbz_simulation_lib.a b/models/Turing-Pattern/test/Belousov-Zhabotinksy/libbz_simulation_lib.a new file mode 100644 index 00000000..0eef64e1 Binary files /dev/null and b/models/Turing-Pattern/test/Belousov-Zhabotinksy/libbz_simulation_lib.a differ diff --git a/models/Turing-Pattern/test/Nan_Test/libnan_simulation_lib.a b/models/Turing-Pattern/test/Nan_Test/libnan_simulation_lib.a new file mode 100644 index 00000000..a6a357a8 Binary files /dev/null and b/models/Turing-Pattern/test/Nan_Test/libnan_simulation_lib.a differ diff --git a/models/Turing-Pattern/test/Nan_Test/nan_simulation b/models/Turing-Pattern/test/Nan_Test/nan_simulation new file mode 100755 index 00000000..d7bc164c Binary files /dev/null and b/models/Turing-Pattern/test/Nan_Test/nan_simulation differ diff --git a/models/Turing-Pattern/test/her_model_2014/her2014_simulation b/models/Turing-Pattern/test/her_model_2014/her2014_simulation new file mode 100755 index 00000000..5b9b7cca Binary files /dev/null and b/models/Turing-Pattern/test/her_model_2014/her2014_simulation differ diff --git a/models/Turing-Pattern/test/her_model_2014/libher2014_simulation_lib.a b/models/Turing-Pattern/test/her_model_2014/libher2014_simulation_lib.a new file mode 100644 index 00000000..975f672f Binary files /dev/null and b/models/Turing-Pattern/test/her_model_2014/libher2014_simulation_lib.a differ diff --git a/models/Turing-Pattern/test/time_test/libtime_test_lib.a b/models/Turing-Pattern/test/time_test/libtime_test_lib.a new file mode 100644 index 00000000..ffc8f2ae Binary files /dev/null and b/models/Turing-Pattern/test/time_test/libtime_test_lib.a differ diff --git a/models/Turing-Pattern/test/time_test/time_test b/models/Turing-Pattern/test/time_test/time_test new file mode 100755 index 00000000..8e2ce58e Binary files /dev/null and b/models/Turing-Pattern/test/time_test/time_test differ diff --git a/models/briggs-rauscher/param_grad_template.csv b/models/briggs-rauscher/param_grad_template.csv new file mode 100644 index 00000000..8dc4fb82 --- /dev/null +++ b/models/briggs-rauscher/param_grad_template.csv @@ -0,0 +1,23 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of gradients. Only this one gradients setting is applied to all parameter sets when a simulation set is being run. +# Use '0' under all four columns of a reaction to indiate that it should not have a gradient. +# Gradient Codes +# x1 - start column +# y1 - start multiplier (use '1.23' to mean '123%') +# x2 - end column +# y2 - end multiplier +# For more information and examples see README.md section 2.2.2 + +grad_x1_radical, grad_y1_radical, grad_x2_radical, grad_y2_radical, , grad_x1_non_radical, grad_y1_non_radical, grad_x2_non_radical, grad_y2_non_radical, , grad_x1_hio_decay, grad_y1_hio_decay, grad_x2_hio_decay, grad_y2_hio_decay, , grad_x1_i_decay, grad_y1_i_decay, grad_x2_i_decay, grad_y2_i_decay, , , , +0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , 0, 0, 0, 0, , , , \ No newline at end of file diff --git a/models/briggs-rauscher/param_pert_template.csv b/models/briggs-rauscher/param_pert_template.csv new file mode 100644 index 00000000..7eb4d234 --- /dev/null +++ b/models/briggs-rauscher/param_pert_template.csv @@ -0,0 +1,18 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file should only contain one set of perturbations. Only this one perturbations set is applied to all parameter sets when a simulation set is being run. +# Use '0' to indicate that a reaction should not have perturbations. +# For more information and examples see README.md section 2.2.2 + +pert_radical, pert_non_radical, pert_hio_decay, pert_i_decay, , , +0, 0, 0, 0, , , \ No newline at end of file diff --git a/models/briggs-rauscher/param_sets_template.csv b/models/briggs-rauscher/param_sets_template.csv new file mode 100644 index 00000000..f4d13d05 --- /dev/null +++ b/models/briggs-rauscher/param_sets_template.csv @@ -0,0 +1,16 @@ +# CSV Specification +# Ignored by the file readers are: +# (1) Empty cells / Blank rows / Whitespace +# (2) Comment whose rows always begin with a '#' +# For best results delete all comments before loading this file into any Excel-like program. +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish. +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly. +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs. +# For more information and examples see README.md section 2.2.0 + +# Rename this file by removing the "_template" from the file name (or just change the name entirely) once the data has been entered! +# This file can contain more than one set (each being on their own line). All sets are initialized and executed in parallel when a file is loaded into the simulation. +# For more information and examples see README.md section 2.2.1 + +radical, non_radical, hio_decay, i_decay, , , \ No newline at end of file diff --git a/models/briggs_rauscher_delays/.~lock.param_set.csv# b/models/briggs_rauscher_delays/.~lock.param_set.csv# new file mode 100644 index 00000000..23d8b4b2 --- /dev/null +++ b/models/briggs_rauscher_delays/.~lock.param_set.csv# @@ -0,0 +1 @@ +,taylorjh,shockley.whitman.edu,15.07.2019 10:45,file:///home/taylorjh/.config/libreoffice/4; \ No newline at end of file diff --git a/models/briggs_rauscher_delays/model_impl.hpp b/models/briggs_rauscher_delays/model_impl.hpp new file mode 100644 index 00000000..fddb5524 --- /dev/null +++ b/models/briggs_rauscher_delays/model_impl.hpp @@ -0,0 +1,74 @@ +// In this header file, define your model! +// This includes functions to describe each reaction. +// Make sure that you've first completed reaction_list.h and specie_list.h +#ifndef MODEL_IMPL_H +#define MODEL_IMPL_H +#include "core/reaction.hpp" +#include "core/specie.hpp" +#include "core/model.hpp" +#include "sim/base.hpp" +//#include "context.hpp" +#include +#include + +/* + +Define all of your reaction rate functions in `model_impl.hpp`. +For example, if you enumerated a reaction `R_ONE`, you should declare a + function like this: + + RATETYPE reaction::active_rate(const Ctxt& c) { return 6.0; } + + +Or, for a more interesting reaction rate, you might do something like: + + + RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(R_TWO) * c.getCon(SPECIE_ONE) * c.neighbors.calculateNeighborAvg(SPECIE_TWO); + } + +Refer to the Context API (Section ) for instructions on how to get delays + and critical values for more complex reaction rate functions. + +*/ + +//Declare the rate of radical reaction to be constant written in param_set.csv +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(radical); +} + +//Declare the rate of the non-radical reaction to be a constant written in param_set.csv times current concentration of I times the current concentration of HIO +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(non_radical)*(c.getCon(I)+1)*(c.getCon(HIO)); +} + +//Declare the rate of HIO decay reaction to be a constant written in param_set.csv times the current concentration of HIO +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(hio_decay)*c.getCon(HIO); +} + +//Declare the rate of I decay reaction to be a constant written in param_set.csv times the current concentration of I +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(i_decay)*(c.getCon(I)); +} + +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(i_decay_delay)*(c.getCon(I), c.getDelay(dreact_i_decay_delay)); +} + +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(hio_decay_delay)*(c.getCon(HIO), c.getDelay(dreact_hio_decay_delay)); +} +#endif // MODEL_IMPL_H diff --git a/models/briggs_rauscher_delays/param_set.csv b/models/briggs_rauscher_delays/param_set.csv new file mode 100644 index 00000000..6756ad83 --- /dev/null +++ b/models/briggs_rauscher_delays/param_set.csv @@ -0,0 +1,2 @@ +radical, non_radical, hio_decay, i_decay,i_decay_delay,hio_decay_delay,dreact_i_decay_delay,dreact_hio_decay_delay, , +6.260973,4.693214,0.908639,0.801779,1.2,1.3,52,47, , diff --git a/models/briggs_rauscher_delays/reaction_deltas.hpp b/models/briggs_rauscher_delays/reaction_deltas.hpp new file mode 100644 index 00000000..a8855feb --- /dev/null +++ b/models/briggs_rauscher_delays/reaction_deltas.hpp @@ -0,0 +1,47 @@ +#include "utility/common_utils.hpp" +#include "core/reaction.hpp" + +#include + +/* + +Define each reaction's reactants and products in reaction_deltas.hpp. +Say a reaction enumerated as R_ONE has the following chemical formula: + + 2A + B --> C + +The proper way to define that reaction's state change vector is as follows: + +STATIC_VAR int num_deltas_R_ONE = 3; +STATIC_VAR int deltas_R_ONE[] = {-2, -1, 1}; +STATIC_VAR specie_id delta_ids_R_ONE[] = {A, B, C}; + +*/ + +//Reaction that synthesizes single HIO molecule +STATIC_VAR int num_deltas_radical = 1; +STATIC_VAR int deltas_radical[] = {1}; +STATIC_VAR specie_id delta_ids_radical[] = {HIO}; + +//Non-radical reaction(takes 2 HIO molecules to create 1 I molucule) +STATIC_VAR int num_deltas_non_radical = 2; +STATIC_VAR int deltas_non_radical[] = {-2, 1}; +STATIC_VAR specie_id delta_ids_non_radical[] = {HIO, I}; + +//Reaction that gets rid of single HIO molecule +STATIC_VAR int num_deltas_hio_decay = 1; +STATIC_VAR int deltas_hio_decay[] = {-1}; +STATIC_VAR specie_id delta_ids_hio_decay[] = {HIO}; + +//Reaction that gets rid of single I molecule +STATIC_VAR int num_deltas_i_decay = 1; +STATIC_VAR int deltas_i_decay[] = {-1}; +STATIC_VAR specie_id delta_ids_i_decay[] = {I}; + +STATIC_VAR int num_deltas_i_decay_delay = 1; +STATIC_VAR int deltas_i_decay_delay[] = {-1}; +STATIC_VAR specie_id delta_ids_i_decay_delay[] = {I}; + +STATIC_VAR int num_deltas_hio_decay_delay = 1; +STATIC_VAR int deltas_hio_decay_delay[] = {-1}; +STATIC_VAR specie_id delta_ids_hio_decay_delay[] = {HIO}; diff --git a/models/briggs_rauscher_delays/reactions_list.hpp b/models/briggs_rauscher_delays/reactions_list.hpp new file mode 100644 index 00000000..11ef5d4f --- /dev/null +++ b/models/briggs_rauscher_delays/reactions_list.hpp @@ -0,0 +1,33 @@ +// In this file, we declare the X-Macro for the list of reactions to +// be simulated. +// Each reaction must have a declared reaction rate function in +// model_impl.h +// For example, to declare three reactions named "one", "two", and "three", +// of which "three" is a delayed reaction, use the syntax below. +// +// REACTION(one) +// REACTION(two) +// DELAY_REACTION(three) + +#ifndef DELAY_REACTION +#define DELAY_REACTION REACTION +#define UNDO_DELAY_REACTION_DEF +#endif + +//Briggs-Rauscher radical reaction to synthesize HIO and initialize concentrations +REACTION(radical) +////Briggs-Rauscher radical reaction to convert HIO to I +REACTION(non_radical) +//Reaction to balance out excess HIO created +REACTION(hio_decay) +//Reaction to balance out excess I created +REACTION(i_decay) + +DELAY_REACTION(i_decay_delay) + +DELAY_REACTION(hio_decay_delay) + +#ifdef UNDO_DELAY_REACTION_DEF +#undef DELAY_REACTION +#undef UNDO_DELAY_REACTION_DEF +#endif diff --git a/models/briggs_rauscher_delays/specie_list.hpp b/models/briggs_rauscher_delays/specie_list.hpp new file mode 100644 index 00000000..d810d984 --- /dev/null +++ b/models/briggs_rauscher_delays/specie_list.hpp @@ -0,0 +1,25 @@ +// In this file, we declare the X-Macro for the list of reactions to +// be simulated. +// Each reaction must have a declared reaction rate function in +// model_impl.h +// For example, to declare three reactions named "one", "two", and "three", +// use the syntax below +//#define LIST_OF_SPECIES +// SPECIE(specie_one) +// SPECIE(two) +// SPECIE(three) + +#ifndef CRITICAL_SPECIE +#define CRITICAL_SPECIE SPECIE +#define UNDO_CRITICAL_SPECIE_DEF +#endif + +//Species relevant to the model(HIO and I) +SPECIE(HIO) +SPECIE(I) + + +#ifdef UNDO_CRITICAL_SPECIE_DEF +#undef CRITICAL_SPECIE +#undef UNDO_CRITICAL_SPECIE_DEF +#endif diff --git a/models/delay_reaction/param_sets.csv b/models/delay_reaction/param_sets.csv index 58c704b0..c77e3cf5 100644 --- a/models/delay_reaction/param_sets.csv +++ b/models/delay_reaction/param_sets.csv @@ -1,2 +1,2 @@ -reac1, reac2, dreac_reac1, dreac_reac2, , , -0, 0, 100, 100, , , \ No newline at end of file +reac1, reac2, dreac_reac1, dreac_reac2, , +10,0,100,100, , diff --git a/source/Anderson_main.cpp b/source/Anderson_main.cpp new file mode 100644 index 00000000..84d9d86d --- /dev/null +++ b/source/Anderson_main.cpp @@ -0,0 +1,55 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/determ/determ.hpp" +#include "sim/stoch/anderson_next_reaction_simulation.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::stochastic::Anderson_Next_Reaction_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Anderson_Next_Reaction_Simulation; + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, args.adj_graph, ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); + +} diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8b008f14..7b54d7d7 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -23,7 +23,10 @@ function(SIMCORELIB localname simdir) ${DENSE_SOURCE_DIR}/source/sim/determ/determ.cpp ${DENSE_SOURCE_DIR}/source/sim/determ/baby_cl.cpp ${DENSE_SOURCE_DIR}/source/sim/stoch/fast_gillespie_direct_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/sorting_direct_simulation.cpp ${DENSE_SOURCE_DIR}/source/sim/stoch/next_reaction_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/anderson_next_reaction_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/Gillespie_Direct_Simulation.cpp ${DENSE_SOURCE_DIR}/source/sim/stoch/stoch.cpp ${DENSE_SOURCE_DIR}/source/utility/common_utils.cpp ${DENSE_SOURCE_DIR}/source/utility/color.cpp @@ -38,10 +41,16 @@ function(SIMCORELIB localname simdir) ${DENSE_SOURCE_DIR}/source/run_simulation.hpp ${DENSE_SOURCE_DIR}/source/Sim_Builder.hpp ${DENSE_SOURCE_DIR}/source/Sim_Initializer.hpp - ${DENSE_SOURCE_DIR}/source/search/sres.cpp - ${DENSE_SOURCE_DIR}/source/search/libsres/ESES.cpp - ${DENSE_SOURCE_DIR}/source/search/libsres/ESSRSort.cpp - ${DENSE_SOURCE_DIR}/source/search/libsres/sharefunc.cpp + ${DENSE_SOURCE_DIR}/source/search/sres.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/ESES.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/ESSRSort.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/sharefunc.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/propensity_groups.hpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/rejection_based_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/log_direct_method.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/sorting_direct_simulation.cpp + ${DENSE_SOURCE_DIR}/source/rejection_based_main.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/rxn_struct.hpp ) target_include_directories(${localname} PUBLIC ${simdir}) target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) @@ -60,36 +69,47 @@ function(DETERMINISTIC_SIMULATION localname simdir) SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/deterministic_main.cpp) endfunction(DETERMINISTIC_SIMULATION localname simdir) +function(SORTING_DIRECT_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Sorting_Direct_Main.cpp) +endfunction(SORTING_DIRECT_SIMULATION localname simdir) + +function(REJECTION_BASED_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/rejection_based_main.cpp) +endfunction(REJECTION_BASED_SIMULATION localname simdir) + function(GILLESPIE_SIMULATION localname simdir) - SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Fast_Gillespie_Main.cpp) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Gillespie_Direct_main.cpp) endfunction(GILLESPIE_SIMULATION localname simdir) -function(CELL_GROWTH localname simdir) - SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Cell_Grow_Main.cpp) -endfunction(CELL_GROWTH localname simdir) +function(SORTING_DIRECT_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/sorting_direct_Main.cpp) +endfunction(SORTING_DIRECT_SIMULATION localname simdir) + +function(ANDERSON_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Anderson_main.cpp) +endfunction(ANDERSON_SIMULATION localname simdir) + + function(FAST_GILLESPIE_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Fast_Gillespie_Main.cpp) +endfunction(FAST_GILLESPIE_SIMULATION localname simdir) function(STOCH_NR_SIMULATION localname simdir) SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Next_Reaction_Main.cpp) endfunction(STOCH_NR_SIMULATION localname simdir) +function(LOG_DIRECT_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/log_direct_main.cpp) +endfunction(LOG_DIRECT_SIMULATION localname simdir) -function(PARAMSEARCH localname simdir) - SIMCORELIB(${localname}_lib ${simdir}) - add_executable(${localname} ${PROJECT_SOURCE_DIR}/source/param_search_main.cpp) - target_include_directories(${localname} PUBLIC ${simdir}) - target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source) - target_link_libraries(${localname} PUBLIC ${localname}_lib) -endfunction(PARAMSEARCH localname simdir) +#function(PARAMSEARCH localname simdir) +# SIMCORELIB(${localname}_lib ${simdir}) +# add_executable(${localname} ${PROJECT_SOURCE_DIR}/source/param_search_main.cpp) +# target_include_directories(${localname} PUBLIC ${simdir}) +# target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source) +# target_link_libraries(${localname} PUBLIC ${localname}_lib) +#endfunction(PARAMSEARCH localname simdir) -function(BENCHMARK localname simdir) - SIMCORELIB(${localname}_lib ${simdir}) - add_executable(${localname} ${PROJECT_SOURCE_DIR}/source/Fast_Gillespie_Main.cpp) - target_include_directories(${localname} PUBLIC ${simdir}) - target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source) - target_link_libraries(${localname} PUBLIC ${localname}_lib) -endfunction(BENCHMARK localname simdir) - function(CUDASIMCORELIB localname simdir) if (NOT TARGET ${localname}) @@ -168,14 +188,22 @@ if( ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${PROJECT_BINARY_DIR}/source) CSV_GEN(csv_gen ${PROJECT_BINARY_DIR}) DETERMINISTIC_SIMULATION(simulation ${PROJECT_BINARY_DIR}) set_target_properties(simulation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - GILLESPIE_SIMULATION(gillespie ${PROJECT_BINARY_DIR}) - set_target_properties(gillespie PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - CELL_GROWTH(cell_growth ${PROJECT_BINARY_DIR}) - set_target_properties(cell_growth PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + REJECTION_BASED_SIMULATION(rejection ${PROJECT_BINARY_DIR}) + set_target_properties(rejection PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + FAST_GILLESPIE_SIMULATION(fast_gillespie ${PROJECT_BINARY_DIR}) + set_target_properties(fast_gillespie PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") STOCH_NR_SIMULATION(nextreaction ${PROJECT_BINARY_DIR}) set_target_properties(nextreaction PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - PARAMSEARCH(paramsearch ${PROJECT_BINARY_DIR}) - set_target_properties(paramsearch PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + SORTING_DIRECT_SIMULATION(sortingreaction ${PROJECT_BINARY_DIR}) + set_target_properties(sortingreaction PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + ANDERSON_SIMULATION(anderson ${PROJECT_BINARY_DIR}) + set_target_properties(anderson PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + SORTING_DIRECT_SIMULATION(sortingdirect ${PROJECT_BINARY_DIR}) + set_target_properties(sortingdirect PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + GILLESPIE_SIMULATION(gillespie ${PROJECT_BINARY_DIR}) + set_target_properties(gillespie PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + LOG_DIRECT_SIMULATION(log_direct ${PROJECT_BINARY_DIR}) + set_target_properties(log_direct PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") if (${CUDA_FOUND}) CUDA_SIMULATION(cuda_simulation ${PROJECT_BINARY_DIR}) set_target_properties(cuda_simulation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") diff --git a/source/CMakeLists.txt.orig b/source/CMakeLists.txt.orig new file mode 100644 index 00000000..77c6122d --- /dev/null +++ b/source/CMakeLists.txt.orig @@ -0,0 +1,198 @@ +#include_directories("${CMAKE_CURRENT_SOURCE_DIR}") + +function(target_link_simlibraries targetname simlibname) + target_link_libraries(${targetname} ${simlibname}) + target_include_directories(${targetname} PUBLIC ${simlibname}) +endfunction(target_link_simlibraries targetname simlibname) + +function(CSV_GEN localname simdir) + add_executable(${localname} + ${DENSE_SOURCE_DIR}/source/csv_gen.cpp + ${DENSE_SOURCE_DIR}/source/utility/color.cpp + ${DENSE_SOURCE_DIR}/source/io/csvw.cpp) + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + target_include_directories(${localname} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +endfunction(CSV_GEN) + +function(SIMCORELIB localname simdir) + if (NOT TARGET ${localname}) + add_library(${localname} + ${DENSE_SOURCE_DIR}/source/core/build_once.cpp + ${DENSE_SOURCE_DIR}/source/sim/base.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/determ.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/baby_cl.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/fast_gillespie_direct_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/next_reaction_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/anderson_next_reaction_simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/Gillespie_Direct_Simulation.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/stoch.cpp + ${DENSE_SOURCE_DIR}/source/utility/common_utils.cpp + ${DENSE_SOURCE_DIR}/source/utility/color.cpp + ${DENSE_SOURCE_DIR}/source/utility/preprocessor.cpp + ${DENSE_SOURCE_DIR}/source/io/arg_parse.cpp + ${DENSE_SOURCE_DIR}/source/io/csvr.cpp + ${DENSE_SOURCE_DIR}/source/io/csvr_sim.cpp + ${DENSE_SOURCE_DIR}/source/io/csvw.cpp + ${DENSE_SOURCE_DIR}/source/io/ezxml/ezxml.c + ${DENSE_SOURCE_DIR}/source/arg_parse.hpp + ${DENSE_SOURCE_DIR}/source/parse_analysis_entries.hpp + ${DENSE_SOURCE_DIR}/source/run_simulation.hpp + ${DENSE_SOURCE_DIR}/source/Sim_Builder.hpp + ${DENSE_SOURCE_DIR}/source/Sim_Initializer.hpp + ${DENSE_SOURCE_DIR}/source/search/sres.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/ESES.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/ESSRSort.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/sharefunc.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/propensity_groups.hpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/rejection_based_simulation.cpp + ${DENSE_SOURCE_DIR}/source/rejection_based_main.cpp + ${DENSE_SOURCE_DIR}/source/sim/stoch/rxn_struct.hpp + + ) + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + endif (NOT TARGET ${localname}) +endfunction(SIMCORELIB localname simdir) + +function(SIMULATION localname simdir mainfile) + SIMCORELIB(${localname}_lib ${simdir}) + add_executable(${localname} ${mainfile}) + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + target_link_libraries(${localname} PUBLIC ${localname}_lib) +endfunction(SIMULATION localname simdir mainfile) + +function(DETERMINISTIC_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/deterministic_main.cpp) +endfunction(DETERMINISTIC_SIMULATION localname simdir) + +function(REJECTION_BASED_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/rejection_based_main.cpp) +endfunction(REJECTION_BASED_SIMULATION localname simdir) + +function(GILLESPIE_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Gillespie_Direct_main.cpp) +endfunction(GILLESPIE_SIMULATION localname simdir) + +function(ANDERSON_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Anderson_main.cpp) +endfunction(ANDERSON_SIMULATION localname simdir) + + function(FAST_GILLESPIE_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Fast_Gillespie_Main.cpp) +endfunction(FAST_GILLESPIE_SIMULATION localname simdir) + +function(STOCH_NR_SIMULATION localname simdir) + SIMULATION(${localname} ${simdir} ${DENSE_SOURCE_DIR}/source/Next_Reaction_Main.cpp) +endfunction(STOCH_NR_SIMULATION localname simdir) + + +#function(PARAMSEARCH localname simdir) +# SIMCORELIB(${localname}_lib ${simdir}) +# add_executable(${localname} ${PROJECT_SOURCE_DIR}/source/param_search_main.cpp) +# target_include_directories(${localname} PUBLIC ${simdir}) +# target_include_directories(${localname} PUBLIC ${PROJECT_SOURCE_DIR}/source) +# target_link_libraries(${localname} PUBLIC ${localname}_lib) +#endfunction(PARAMSEARCH localname simdir) + + + +function(CUDASIMCORELIB localname simdir) + if (NOT TARGET ${localname}) + CUDA_INCLUDE_DIRECTORIES(${simdir} ${DENSE_SOURCE_DIR}/source) + configure_file(${DENSE_SOURCE_DIR}/source/core/build_once.cpp ${DENSE_SOURCE_DIR}/source/core/build_once.cu COPYONLY) + cuda_add_library(${localname} + ${DENSE_SOURCE_DIR}/source/core/build_once.cu + ${DENSE_SOURCE_DIR}/source/sim/set_cuda.cu + ${DENSE_SOURCE_DIR}/source/sim/base.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/determ.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/determ_cuda.cu + ${DENSE_SOURCE_DIR}/source/sim/cell_param.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/baby_cl.cpp + ${DENSE_SOURCE_DIR}/source/sim/determ/baby_cl_cuda.cu + ${DENSE_SOURCE_DIR}/source/io/arg_parse.cpp + ${DENSE_SOURCE_DIR}/source/utility/common_utils.cpp + ${DENSE_SOURCE_DIR}/source/utility/color.cpp + ${DENSE_SOURCE_DIR}/source/utility/preprocessor.cpp + ${DENSE_SOURCE_DIR}/source/io/csvr.cpp + ${DENSE_SOURCE_DIR}/source/io/csvr_sim.cpp + ${DENSE_SOURCE_DIR}/source/io/csvw.cpp + ${DENSE_SOURCE_DIR}/source/io/csvw_sim.cpp + ${DENSE_SOURCE_DIR}/source/io/ezxml/ezxml.c) + + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + target_link_libraries(${localname} ${CUDA_LIBRARIES}) + endif (NOT TARGET ${localname}) +endfunction(CUDASIMCORELIB localname simdir) + +function(CUDA_SIMULATION localname simdir) + CUDASIMCORELIB(${localname}_lib ${simdir}) + CUDA_INCLUDE_DIRECTORIES(${simdir} ${DENSE_SOURCE_DIR}/source) + cuda_add_executable(${localname} ${DENSE_SOURCE_DIR}/source/main_cuda.cu) + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + target_link_libraries(${localname} ${CUDA_LIBRARIES}) + target_link_libraries(${localname} ${localname}_lib) +endfunction(CUDA_SIMULATION localname simdir) + +function(PARAM_SEARCH_LIB localname simdir) + if (NOT TARGET ${localname}) + add_library(${localname} + ${DENSE_SOURCE_DIR}/source/search/libsres/ESES.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/ESSRSort.cpp + ${DENSE_SOURCE_DIR}/source/search/libsres/sharefunc.cpp + ${DENSE_SOURCE_DIR}/source/search/sres.cpp) + target_include_directories(${localname} PUBLIC ${simdir}) + target_include_directories(${localname} PUBLIC ${DENSE_SOURCE_DIR}/source) + endif (NOT TARGET ${localname}) +endfunction(PARAM_SEARCH_LIB localname simdir) + + +if( ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${PROJECT_BINARY_DIR}/source) + set(BUILD_TESTS_ONLY FALSE) + if (NOT EXISTS ${PROJECT_BINARY_DIR}/reaction_deltas.hpp) + message("No reaction_deltas.cpp found in build directory") + set(BUILD_TESTS_ONLY TRUE) + endif (NOT EXISTS ${PROJECT_BINARY_DIR}/reaction_deltas.hpp) + if (NOT EXISTS ${PROJECT_BINARY_DIR}/model_impl.hpp) + message("No model_impl.hpp found in build directory") + set(BUILD_TESTS_ONLY TRUE) + endif (NOT EXISTS ${PROJECT_BINARY_DIR}/model_impl.hpp) + if (NOT EXISTS ${PROJECT_BINARY_DIR}/reactions_list.hpp) + message("No reactions_list.hpp found in build directory") + set(BUILD_TESTS_ONLY TRUE) + endif (NOT EXISTS ${PROJECT_BINARY_DIR}/reactions_list.hpp) + if (NOT EXISTS ${PROJECT_BINARY_DIR}/specie_list.hpp) + message("No specie_list.hpp found in build directory") + set(BUILD_TESTS_ONLY TRUE) + endif (NOT EXISTS ${PROJECT_BINARY_DIR}/specie_list.hpp) + + if (${BUILD_TESTS_ONLY}) + message(WARNING "No or incomplete model implementation found - building test cases only") + else (${BUILD_TESTS_ONLY}) + CSV_GEN(csv_gen ${PROJECT_BINARY_DIR}) + DETERMINISTIC_SIMULATION(simulation ${PROJECT_BINARY_DIR}) + set_target_properties(simulation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + REJECTION_BASED_SIMULATION(rejection ${PROJECT_BINARY_DIR}) + set_target_properties(rejection PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + FAST_GILLESPIE_SIMULATION(fast_gillespie ${PROJECT_BINARY_DIR}) + set_target_properties(fast_gillespie PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + STOCH_NR_SIMULATION(nextreaction ${PROJECT_BINARY_DIR}) + set_target_properties(nextreaction PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + ANDERSON_SIMULATION(anderson ${PROJECT_BINARY_DIR}) + set_target_properties(anderson PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + GILLESPIE_SIMULATION(gillespie ${PROJECT_BINARY_DIR}) + set_target_properties(gillespie PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + if (${CUDA_FOUND}) + CUDA_SIMULATION(cuda_simulation ${PROJECT_BINARY_DIR}) + set_target_properties(cuda_simulation PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") + endif (${CUDA_FOUND}) + # Forces csv_gen to run before all the test_'s are built. + # This occurs when 'make' is run. + add_custom_target(csv_gen_run ${PROJECT_BINARY_DIR}/source/csv_gen ${PROJECT_BINARY_DIR}/ ) + add_dependencies(csv_gen_run csv_gen) + add_dependencies(simulation csv_gen_run) + endif (${BUILD_TESTS_ONLY}) +endif(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${PROJECT_BINARY_DIR}/source) \ No newline at end of file diff --git a/source/Fast_Gillespie_Main.cpp b/source/Fast_Gillespie_Main.cpp index e387a0a9..6a1b18c9 100644 --- a/source/Fast_Gillespie_Main.cpp +++ b/source/Fast_Gillespie_Main.cpp @@ -54,3 +54,4 @@ int main(int argc, char* argv[]){ run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); } + diff --git a/source/Gillespie_Direct_main.cpp b/source/Gillespie_Direct_main.cpp new file mode 100644 index 00000000..33ce2e83 --- /dev/null +++ b/source/Gillespie_Direct_main.cpp @@ -0,0 +1,55 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/determ/determ.hpp" +#include "sim/stoch/Gillespie_Direct_Simulation.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::Stochastic_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Stochastic_Simulation; + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, args.adj_graph, ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); + +} diff --git a/source/Sim_Builder.hpp b/source/Sim_Builder.hpp index ef278287..92ebd6db 100644 --- a/source/Sim_Builder.hpp +++ b/source/Sim_Builder.hpp @@ -11,11 +11,18 @@ #include "io/csvw_sim.hpp" #include "sim/determ/determ.hpp" #include "sim/stoch/fast_gillespie_direct_simulation.hpp" +#include "sim/stoch/log_direct_method.hpp" #include "sim/stoch/next_reaction_simulation.hpp" +#include "sim/stoch/sorting_direct_simulation.hpp" +#include "sim/stoch/anderson_next_reaction_simulation.hpp" +#include "sim/stoch/Gillespie_Direct_Simulation.hpp" #include "model_impl.hpp" #include "io/ezxml/ezxml.h" +#include "sim/stoch/rejection_based_simulation.hpp" +#include "sim/stoch/sorting_direct_simulation.hpp" #include "arg_parse.hpp" + using style::Color; #include @@ -29,11 +36,16 @@ using style::Color; #include #include +using dense::Stochastic_Simulation; using dense::csvw_sim; using dense::CSV_Streamed_Simulation; using dense::Deterministic_Simulation; using dense::Fast_Gillespie_Direct_Simulation; using dense::stochastic::Next_Reaction_Simulation; +using dense::stochastic::Log_Direct_Simulation; +using dense::stochastic::Anderson_Next_Reaction_Simulation; +using dense::Sorting_Direct_Simulation; +using dense::stochastic::Rejection_Based_Simulation; using dense::conc_vector; namespace dense { @@ -59,7 +71,6 @@ namespace dense { template<> class Sim_Builder { using This = Sim_Builder; - public: This& operator= (This&&); Sim_Builder (This const&) = default; @@ -141,8 +152,83 @@ namespace dense { std::vector conc; NGraph::Graph adjacency_graph; }; + template<> + class Sim_Builder { + using This = Sim_Builder; + + public: + Sim_Builder (This const&) = default; + This& operator= (This&&); + Sim_Builder(Real* pf, Real** gf, NGraph::Graph adj_graph, int argc, char* argv[]){ + arg_parse::init(argc, argv); + using style::Mode; + style::configure(arg_parse::get("n", "no-color", nullptr, false) ? Mode::disable : Mode::force); + seed = 0; + if (!arg_parse::get("r", "rand-seed", &seed, false)) { + seed = std::random_device()(); + } + std::cout << "Stochastic simulation seed: " << seed << '\n'; + perturbation_factors = pf; + gradient_factors = gf; + std::string init_conc; + bool i_or_o = arg_parse::get("d", "initial-conc", &init_conc, false); + conc_vector(init_conc, i_or_o, &conc); + adjacency_graph = std::move(adj_graph); + } + std::vector get_simulations(std::vector param_sets){ + std::vector simulations; + for (auto& parameter_set : param_sets) { + simulations.emplace_back(std::move(parameter_set), perturbation_factors, gradient_factors, seed, conc, adjacency_graph); + } + return simulations; + } + private: + Real* perturbation_factors; + Real** gradient_factors; + int seed; + std::vector conc; + NGraph::Graph adjacency_graph; + }; + template<> + class Sim_Builder { + using This = Sim_Builder; + + public: + Sim_Builder (This const&) = default; + This& operator= (This&&); + Sim_Builder(Real* pf, Real** gf, NGraph::Graph adj_graph, int argc, char* argv[]){ + arg_parse::init(argc, argv); + using style::Mode; + style::configure(arg_parse::get("n", "no-color", nullptr, false) ? Mode::disable : Mode::force); + seed = 0; + if (!arg_parse::get("r", "rand-seed", &seed, false)) { + seed = std::random_device()(); + } + std::cout << "Stochastic simulation seed: " << seed << '\n'; + perturbation_factors = pf; + gradient_factors = gf; + std::string init_conc; + bool i_or_o = arg_parse::get("d", "initial-conc", &init_conc, false); + conc_vector(init_conc, i_or_o, &conc); + adjacency_graph = std::move(adj_graph); + } + std::vector get_simulations(std::vector param_sets){ + std::vector simulations; + for (auto& parameter_set : param_sets) { + simulations.emplace_back(std::move(parameter_set), perturbation_factors, gradient_factors, seed, conc, adjacency_graph); + } + return simulations; + } + private: + Real* perturbation_factors; + Real** gradient_factors; + int seed; + std::vector conc; + NGraph::Graph adjacency_graph; + }; + template<> - class Sim_Builder { + class Sim_Builder { using This = Sim_Builder; public: @@ -156,8 +242,6 @@ namespace dense { if (!arg_parse::get("r", "rand-seed", &seed, false)) { seed = std::random_device()(); } - // Warn user that they are not running deterministic sim - std::cout << style::apply(Color::yellow) << "Running stochastic simulation. To run deterministic simulation, specify a step size using the [-s | --step-size] flag." << style::reset() << '\n'; std::cout << "Stochastic simulation seed: " << seed << '\n'; perturbation_factors = pf; gradient_factors = gf; @@ -181,5 +265,135 @@ namespace dense { std::vector conc; NGraph::Graph adjacency_graph; }; + + template<> + class Sim_Builder { + using This = Sim_Builder; + + public: + Sim_Builder (This const&) = default; + This& operator= (This&&); + Sim_Builder(Real* pf, Real** gf, NGraph::Graph adj_graph, int argc, char* argv[]){ + arg_parse::init(argc, argv); + using style::Mode; + style::configure(arg_parse::get("n", "no-color", nullptr, false) ? Mode::disable : Mode::force); + seed = 0; + if (!arg_parse::get("r", "rand-seed", &seed, false)) { + seed = std::random_device()(); + } + std::cout << "Stochastic simulation seed: " << seed << '\n'; + delta = 0.2; + if(!arg_parse::get("dd", "delta", &delta, false)){ + delta = 0.2; + } + y = 0; + if(!arg_parse::get("y", "y-value", &y, false)){ + y = 0; + } + perturbation_factors = pf; + gradient_factors = gf; + std::string init_conc; + bool i_or_o = arg_parse::get("d", "initial-conc", &init_conc, false); + conc_vector(init_conc, i_or_o, &conc); + adjacency_graph = std::move(adj_graph); + } + std::vector get_simulations(std::vector param_sets){ + std::vector simulations; + for (auto& parameter_set : param_sets) { + simulations.emplace_back(std::move(parameter_set), perturbation_factors, gradient_factors, seed, conc, adjacency_graph, delta, y); + } + return simulations; + } + private: + Real* perturbation_factors; + Real** gradient_factors; + int seed; + double delta; + int y; + std::vector conc; + NGraph::Graph adjacency_graph; + }; + + template<> + class Sim_Builder { + using This = Sim_Builder; + + public: + Sim_Builder (This const&) = default; + This& operator= (This&&); + Sim_Builder(Real* pf, Real** gf, NGraph::Graph adj_graph, int argc, char* argv[]){ + arg_parse::init(argc, argv); + using style::Mode; + style::configure(arg_parse::get("n", "no-color", nullptr, false) ? Mode::disable : Mode::force); + seed = 0; + if (!arg_parse::get("r", "rand-seed", &seed, false)) { + seed = std::random_device()(); + } + std::cout << "Stochastic simulation seed: " << seed << '\n'; + perturbation_factors = pf; + gradient_factors = gf; + adjacency_graph = std::move(adj_graph); + std::string init_conc; + bool i_or_o = arg_parse::get("d", "initial-conc", &init_conc, false); + conc_vector(init_conc, i_or_o, &conc); + } + + std::vector get_simulations(std::vector param_sets){ + std::vector simulations; + for (auto& parameter_set : param_sets) { + simulations.emplace_back(std::move(parameter_set), adjacency_graph, conc, perturbation_factors, gradient_factors, seed); + } + return simulations; + } + + private: + Real* perturbation_factors; + Real** gradient_factors; + int seed; + std::vector conc; + NGraph::Graph adjacency_graph; + }; + + template<> + class Sim_Builder { + using This = Sim_Builder; + + public: + Sim_Builder (This const&) = default; + This& operator= (This&&); + Sim_Builder(Real* pf, Real** gf, NGraph::Graph adj_graph, int argc, char* argv[]){ + arg_parse::init(argc, argv); + using style::Mode; + style::configure(arg_parse::get("n", "no-color", nullptr, false) ? Mode::disable : Mode::force); + seed = 0; + if (!arg_parse::get("r", "rand-seed", &seed, false)) { + seed = std::random_device()(); + } + std::cout << "Stochastic simulation seed: " << seed << '\n'; + perturbation_factors = pf; + gradient_factors = gf; + adjacency_graph = std::move(adj_graph); + std::string init_conc; + bool i_or_o = arg_parse::get("d", "initial-conc", &init_conc, false); + conc_vector(init_conc, i_or_o, &conc); + } + + std::vector get_simulations(std::vector param_sets){ + std::vector simulations; + for (auto& parameter_set : param_sets) { + simulations.emplace_back(std::move(parameter_set), adjacency_graph, conc, perturbation_factors, gradient_factors, seed); + } + return simulations; + } + + private: + Real* perturbation_factors; + Real** gradient_factors; + int seed; + std::vector conc; + NGraph::Graph adjacency_graph; + }; + } + #endif diff --git a/source/Sorting_Direct_Main.cpp b/source/Sorting_Direct_Main.cpp new file mode 100644 index 00000000..f73df77b --- /dev/null +++ b/source/Sorting_Direct_Main.cpp @@ -0,0 +1,55 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/stoch/sorting_direct_simulation.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::Sorting_Direct_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Sorting_Direct_Simulation; + auto num_vertices = args.adj_graph.num_vertices(); + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, std::move(args.adj_graph), ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)), + parse_analysis_entries(argc, argv, num_vertices)); +} diff --git a/source/arg_parse.hpp b/source/arg_parse.hpp index 92ec3d97..74c10416 100644 --- a/source/arg_parse.hpp +++ b/source/arg_parse.hpp @@ -41,6 +41,12 @@ using dense::graph_constructor; using dense::Static_Args; using dense::Param_Static_Args; +using dense::csvw_sim; +using dense::CSV_Streamed_Simulation; +using dense::Deterministic_Simulation; +using dense::Fast_Gillespie_Direct_Simulation; +using dense::stochastic::Next_Reaction_Simulation; + namespace dense{ void display_usage(std::ostream& out); @@ -354,6 +360,7 @@ arg_parse::init(argc, argv); return param_args; } + } #endif diff --git a/source/deterministic_main.cpp b/source/deterministic_main.cpp index f6203f5e..0376500f 100644 --- a/source/deterministic_main.cpp +++ b/source/deterministic_main.cpp @@ -59,4 +59,6 @@ Snapshot<> data = simulation.snapshot(); template Real Reaction_Traits::calculate_rate_for(Region region) { } + */ + diff --git a/source/log_direct_main.cpp b/source/log_direct_main.cpp new file mode 100644 index 00000000..939cc027 --- /dev/null +++ b/source/log_direct_main.cpp @@ -0,0 +1,54 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/determ/determ.hpp" +#include "sim/stoch/log_direct_method.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::stochastic::Log_Direct_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Log_Direct_Simulation; + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, args.adj_graph, ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); +} diff --git a/source/parse_analysis_entries.hpp b/source/parse_analysis_entries.hpp index c43f6515..998bdde3 100644 --- a/source/parse_analysis_entries.hpp +++ b/source/parse_analysis_entries.hpp @@ -125,4 +125,6 @@ std::vector>>> parse return named_analysis_vector; } } + #endif + diff --git a/source/rejection_based_main.cpp b/source/rejection_based_main.cpp new file mode 100644 index 00000000..82089337 --- /dev/null +++ b/source/rejection_based_main.cpp @@ -0,0 +1,61 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/determ/determ.hpp" +#include "sim/stoch/rejection_based_simulation.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::stochastic::Rejection_Based_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Rejection_Based_Simulation; + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, args.adj_graph, ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); +} +/* +Snapshot<> snapshot; +Snapshot<> data = simulation.snapshot(); +template +Real Reaction_Traits::calculate_rate_for(Region region) { +} +*/ \ No newline at end of file diff --git a/source/run_simulation.hpp b/source/run_simulation.hpp index e3754188..d5689221 100644 --- a/source/run_simulation.hpp +++ b/source/run_simulation.hpp @@ -12,6 +12,7 @@ #include "sim/determ/determ.hpp" #include "sim/stoch/fast_gillespie_direct_simulation.hpp" #include "sim/stoch/next_reaction_simulation.hpp" +#include "sim/stoch/anderson_next_reaction_simulation.hpp" #include "model_impl.hpp" #include "io/ezxml/ezxml.h" #include "measurement/details.hpp" @@ -35,10 +36,10 @@ using dense::CSV_Streamed_Simulation; using dense::Deterministic_Simulation; using dense::Fast_Gillespie_Direct_Simulation; using dense::stochastic::Next_Reaction_Simulation; +using dense::stochastic::Anderson_Next_Reaction_Simulation; using dense::Details; - //std::string left_pad (std::string string, std::size_t min_size, char padding = ' '); std::string left_pad (std::string string, std::size_t min_size, char padding = ' ') { @@ -69,7 +70,7 @@ template #else template #endif -void run_simulation( +std::vector run_simulation( std::chrono::duration duration, std::chrono::duration notify_interval, std::vector simulations, @@ -81,12 +82,14 @@ void run_simulation( #else template #endif - void run_simulation( + std::vector run_simulation( std::chrono::duration duration, std::chrono::duration notify_interval, std::vector simulations, std::vector>>> analysis_entries){ + struct Callback { + Callback( std::unique_ptr> analysis, Simulation & simulation, @@ -107,7 +110,6 @@ void run_simulation( csvw log; }; - std::vector callbacks; // If multiple sets, set file name to "x_####.y" for (std::size_t i = 0; i < simulations.size(); ++i) { @@ -126,6 +128,7 @@ void run_simulation( Real analysis_chunks = duration / notify_interval; int notifications_per_min = decltype(duration)(1.0) / notify_interval; + std::vector perf; for (dense::Natural a = 0; a < analysis_chunks; a++) { std::vector bad_simulations; @@ -152,18 +155,28 @@ void run_simulation( for (auto & simulation : simulations) { auto age = simulation.age_by(notify_interval); if (a % notifications_per_min == 0) { + perf.push_back(simulation.get_perf().at(0)); std::cout << "Time: " << age / Minutes{1} << '\n'; } } } +// csvw csv_out("benchmark_data.csv"); +// for (int i = 0; (unsigned)i < perf.size(); ++i){ +// for(int j = 0; (unsigned)j < perf[i].size(); ++j){ +// csv_out.add_data(perf[i][j]); +// } +// } + for (auto& callback : callbacks) { callback.analysis->finalize(); callback.analysis->show(&callback.log); } - + + return perf; } + #ifndef __cpp_concepts template #else @@ -270,4 +283,4 @@ void run_simulation( } } -#endif \ No newline at end of file +#endif diff --git a/source/sim/base.hpp b/source/sim/base.hpp index 2a9e3d18..d51cf553 100644 --- a/source/sim/base.hpp +++ b/source/sim/base.hpp @@ -36,9 +36,7 @@ concept bool Simulation_Concept() { { simulation_const.get_concentration(Natural{}, specie_id{}, Natural{}) } -> Real; { simulation_const.get_concentration(Natural{}, specie_id{}) } -> Real; { simulation_const.calculate_neighbor_average(Natural{}, specie_id{}, Natural{}) } -> Real; - { simulation.add_cell(Natural{}, Natural{})} -> void; - { simulation.remove_cell(Natural{})} -> void; - { simulation.get_performance(std::chrono::duration{})}-> Real; + { simulation.get_performance()} noexcept -> std::vector; }; } # endif @@ -130,9 +128,10 @@ class Simulation { CUDA_AGNOSTIC Natural& cell_count () noexcept; + ///calculate how many reaction are fired in a second for each time step and push into performance vector + void push_performance(std::chrono::duration elapsed) noexcept; ///calculate how many reaction are fired in a second for each time step - Real get_performance(std::chrono::duration elapsed) noexcept; - + std::vector get_performance() noexcept; Real step(bool restart) noexcept; //add_cell_base: takes a virtual cell and adds it to the graph @@ -293,6 +292,7 @@ class Simulation { Parameter_Set parameter_set_ = {}; //adjacency_graph: graph that contains physical cell nodes NGraph::Graph adjacency_graph; + std::vector performance_; //neighbors_by_cell_ and neighbor_count_by_cell_ are structures of virtual cell ids @@ -300,7 +300,8 @@ class Simulation { Natural* neighbor_count_by_cell_ = {}; public: - + + Real max_delays[NUM_SPECIES] = {}; // The maximum number of time steps that each specie might be accessed in the past cell_param cell_parameters_; @@ -381,10 +382,17 @@ inline Real Simulation::step (bool restart) noexcept { } CUDA_AGNOSTIC -inline Real Simulation::get_performance(std::chrono::duration elapsed) noexcept{ - return Real{step_/elapsed.count()}; +inline void Simulation::push_performance(std::chrono::duration elapsed) noexcept{ + performance_.push_back(step_/elapsed.count()); } +CUDA_AGNOSTIC +inline std::vector Simulation::get_performance() noexcept{ + return performance_; +} + +CUDA_AGNOSTIC + CUDA_AGNOSTIC inline Simulation::~Simulation () noexcept = default; diff --git a/source/sim/determ/determ.cpp b/source/sim/determ/determ.cpp index de232946..ac294b97 100644 --- a/source/sim/determ/determ.cpp +++ b/source/sim/determ/determ.cpp @@ -16,7 +16,9 @@ Minutes dense::Deterministic_Simulation::age_by (Minutes duration) { Simulation::step(false); } auto finish = std::chrono::high_resolution_clock::now(); - std::cout<< "steps per second: "< get_perf(){ + return Simulation::get_performance(); + } + + }; } diff --git a/source/sim/stoch/Gillespie_Direct_Simulation.cpp b/source/sim/stoch/Gillespie_Direct_Simulation.cpp new file mode 100644 index 00000000..c5e2b400 --- /dev/null +++ b/source/sim/stoch/Gillespie_Direct_Simulation.cpp @@ -0,0 +1,237 @@ +#include +#include "Gillespie_Direct_Simulation.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Stochastic_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Stochastic_Simulation::age_by (Minutes duration) { + auto end_time = age() + duration; + auto start = std::chrono::high_resolution_clock::now(); + Simulation::step(true); + while (age() < end_time) { + Minutes tau, t_until_event; + + while ((tau = generateTau()) > (t_until_event = time_until_next_event())) { + Simulation::age_by(t_until_event); + executeDelayRXN(); + if (age() >= end_time){ + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); + } + } + + tauLeap(); + Simulation::age_by(tau); + } + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); +} + +/* + * GENERATETAU + * return "tau": possible timestep leap calculated from a random variable +*/ +Minutes Stochastic_Simulation::generateTau() { + auto r = getRandVariable(); + auto log_inv_r = -std::log(r); + + return Minutes{ log_inv_r / get_total_propensity() }; +} + +/* + * GETSOONESTDELAY + * return "dTime": the time that the next scheduled delay reaction will fire + * if no delay reaction is scheduled, the maximum possible float is returned +*/ +Minutes Stochastic_Simulation::getSoonestDelay() const { + return event_schedule.empty() ? + Minutes{ std::numeric_limits::infinity() } : + event_schedule.top().time; +} + +Minutes Stochastic_Simulation::time_until_next_event() const { + return getSoonestDelay() - age(); +} + +/* + * EXECUTEDELAYRXN + * calls fireReaction for the next scheduled delay reaction + * precondition: a delay reaction is scheduled + * postcondition: the soonest scheduled delay reaction is removed from the schedule +*/ +void Stochastic_Simulation::executeDelayRXN() { + event delay_rxn = event_schedule.top(); + fireReaction(delay_rxn.cell, delay_rxn.rxn); + event_schedule.pop(); +} + +/* + * GETRANDVARIABLE + * return "u": a random variable between 0.0 and 1.0 +*/ + +Real Stochastic_Simulation::getRandVariable() { + return distribution_(generator); +} + +/* + * TAULEAP + * chooses a reaction to fire or schedule and moves forward in time + * arg "tau": timestep to leap forward by +*/ +void Stochastic_Simulation::tauLeap(){ + + Real propensity_portion = getRandVariable() * get_total_propensity(); + + int j = choose_reaction(propensity_portion); + int r = j % NUM_REACTIONS; + int c = j / NUM_REACTIONS; + + fireOrSchedule(c,(reaction_id)r); +} + +/* + * FIREORSCHEDULE + * fires or schedules a reaction firing in a specific cell + * arg "c": the cell that the reaction takes place in + * arg "rid": the reaction to fire or schedule +*/ +void Stochastic_Simulation::fireOrSchedule(int cell, reaction_id rid){ + + delay_reaction_id dri = dense::model::getDelayReactionId(rid); + + if (dri!=NUM_DELAY_REACTIONS) { + event_schedule.push({ age() + Minutes{ Context(*this, cell).getDelay(dri) }, cell, rid }); + } + else { + fireReaction(cell, rid); + } +} + +/* + * FIREREACTION + * fires a reaction by properly decrementing and incrementing its inputs and outputs + * arg "*c": pointer to a context of the cell to fire the reaction in + * arg "rid": reaction to fire +*/ +void Stochastic_Simulation::fireReaction(dense::Natural cell, reaction_id rid){ + const reaction_base& r = dense::model::getReaction(rid); + const specie_id* specie_deltas = r.getSpecieDeltas(); + Simulation::step(false); + for (int i=0; i neighbor_dependencies[NUM_REACTIONS]; + std::set dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::set& neighbordeps_tofill,std::set& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.insert(sp); + return 0.0; + }; + private: + std::set& interdeps_tofill; + std::set& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + #define REACTION(name) \ + for (dense::Natural n=0; n& intradeps = dependencies[n]; \ + const std::set& interdeps = neighbor_dependencies[n]; \ + std::set::iterator intra = intradeps.begin(); \ + std::set::iterator inter = interdeps.begin(); \ + bool intraRelated = false; \ + bool interRelated = false; \ + for (std::size_t in=0; in(NUM_SPECIES, 0)) - , propensities(cell_count) + Stochastic_Simulation(const Parameter_Set& ps, Real* pnFactorsPert, Real** pnFactorsGrad, int seed, std::vector conc, NGraph::Graph adj_graph) + : Simulation(ps, std::move(adj_graph), pnFactorsPert, pnFactorsGrad) + , concs(cell_count(), conc) + , propensities(cell_count()) , generator{seed} { initPropensityNetwork(); initPropensities(); @@ -179,18 +179,25 @@ class Stochastic_Simulation : public Simulation { */ CUDA_AGNOSTIC __attribute_noinline__ void update_propensities(dense::Natural cell_, reaction_id rid) { - #define REACTION(name) \ - for (auto rxname : propensity_network) { \ - auto id = rxname[0]; \ - for (std::size_t r=0; r< propensity_network[id].size(); r++) { \ - if (name == propensity_network[id][r]) { \ - for (dense::Natural n=0; n < neighbor_count_by_cell_[cell_]; n++) { \ - int n_cell = neighbors_by_cell_[cell_][n]; \ - auto& p = propensities[n_cell][name];\ - auto new_p = dense::model::reaction_##name.active_rate(Context(*this, n_cell)); \ - total_propensity_ += new_p - p;\ - p = new_p;\ - } \ + #define REACTION(name) \ + for (std::size_t i=0; i< propensity_network[rid].size(); i++) { \ + if ( name == propensity_network[rid][i] ) { \ + auto& p = propensities[cell_][name];\ + auto new_p = dense::model::reaction_##name.active_rate(Context(*this, cell_)); \ + total_propensity_ += new_p - p;\ + p = new_p;\ + } \ + } \ + \ + for (std::size_t r=0; r< neighbor_propensity_network[rid].size(); r++) { \ + if (name == neighbor_propensity_network[rid][r]) { \ + for (dense::Natural n=0; n < neighbor_count_by_cell_[cell_]; n++) { \ + int n_cell = neighbors_by_cell_[cell_][n]; \ + Context neighbor(*this, n_cell); \ + auto& p = propensities[n_cell][name];\ + auto new_p = dense::model::reaction_##name.active_rate(neighbor); \ + total_propensity_ += new_p - p;\ + p = new_p;\ } \ } \ } @@ -231,6 +238,11 @@ class Stochastic_Simulation : public Simulation { Minutes age_by(Minutes duration); + std::vector get_perf(){ + return Simulation::get_performance(); + } + + private: Minutes time_until_next_event () const; diff --git a/source/sim/stoch/anderson_next_reaction_simulation.cpp b/source/sim/stoch/anderson_next_reaction_simulation.cpp new file mode 100644 index 00000000..723fe170 --- /dev/null +++ b/source/sim/stoch/anderson_next_reaction_simulation.cpp @@ -0,0 +1,253 @@ +#include +#include "anderson_next_reaction_simulation.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Anderson_Next_Reaction_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Anderson_Next_Reaction_Simulation::age_by (Minutes duration) { + auto end_time = age() + duration; + auto start = std::chrono::high_resolution_clock::now(); + Simulation::step(true); + while (age() < end_time) { + //std::cout << "Age: " << age() / Minutes{1} << '\n'; + // 2. Let mu be the reaction whose putative time, tau_mu, stored in P is least. + auto next_reaction = reaction_schedule.top(); + // 3. Let tau be tau_mu. + auto tau = next_reaction.second; + auto cr_pair = decode(next_reaction.first); + auto c = cr_pair.first; + auto r = cr_pair.second; + // 4. Change the number of molecules of reflect execution of reaction mu. + fireOrSchedule(c, r); + // Set t <- tau. + //std::cout << "Tau: " << tau / Minutes{1} << '\n'; + Simulation::age_by(tau - age()); + // 5. For each edge (mu, alpha) in the dependency graph: + update_propensities_and_taus(c, r); + // 6. Go to step 2. + } + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); +} + +/* + * GENERATETAU + * return "tau": possible timestep leap calculated from a random variable +*/ +Minutes Anderson_Next_Reaction_Simulation::generateTau(Real propensity) { + auto result = Minutes{ -std::log(getRandVariable()) / propensity }; + if (result.count() < 0) std::cout << "Prop: " << propensity << '\n'; + return result; +} + +/* + * GETSOONESTDELAY + * return "dTime": the time that the next scheduled delay reaction will fire + * if no delay reaction is scheduled, the maximum possible float is returned +*/ +Minutes Anderson_Next_Reaction_Simulation::getSoonestDelay() const { + return reaction_schedule.empty() ? + Minutes{ std::numeric_limits::infinity() } : + reaction_schedule.top().second; +} + +Minutes Anderson_Next_Reaction_Simulation::time_until_next_event() const { + return getSoonestDelay() - age(); +} + +/* + * EXECUTEDELAYRXN + * calls fireReaction for the next scheduled delay reaction + * precondition: a delay reaction is scheduled + * postcondition: the soonest scheduled delay reaction is removed from the schedule +*/ +void Anderson_Next_Reaction_Simulation::executeDelayRXN() { + std::pair next_reaction_pair = reaction_schedule.top(); + std::pair pair_ids = decode(next_reaction_pair.first); + + fireReaction(pair_ids.first, pair_ids.second); + reaction_schedule.pop(); // TODO: UPDATE, DON"T POP +} + +/* + * GETRANDVARIABLE + * return "u": a random variable between 0.0 and 1.0 +*/ + +Real Anderson_Next_Reaction_Simulation::getRandVariable() { + return distribution_(generator); +} + +/* + * TAULEAP + * chooses a reaction to fire or schedule and moves forward in time + * arg "tau": timestep to leap forward by +*/ +void Anderson_Next_Reaction_Simulation::tauLeap(){ + + std::pair j = choose_reaction(); + reaction_id r =j.second; + int c = j.first; + + fireOrSchedule(c,r); +} + +/* + * FIREORSCHEDULE + * fires or schedules a reaction firing in a specific cell + * arg "c": the cell that the reaction takes place in + * arg "rid": the reaction to fire or schedule +*/ +void Anderson_Next_Reaction_Simulation::fireOrSchedule(int cell, reaction_id rid){ + + delay_reaction_id dri = dense::model::getDelayReactionId(rid); + + if (dri!=NUM_DELAY_REACTIONS) { + event_id rxn_id = encode(cell,rid); + Minutes reaction_tau = Minutes{ Context(*this, cell).getDelay(dri)}; + std::pair reaction_pair = std::make_pair(rxn_id,reaction_tau); + reaction_schedule.push(reaction_pair); + } + else { + fireReaction(cell, rid); + } +} + +/* + * FIREREACTION + * fires a reaction by properly decrementing and incrementing its inputs and outputs + * arg "*c": pointer to a context of the cell to fire the reaction in + * arg "rid": reaction to fire +*/ +void Anderson_Next_Reaction_Simulation::fireReaction(dense::Natural cell, reaction_id rid){ + const reaction_base& r = dense::model::getReaction(rid); + const specie_id* specie_deltas = r.getSpecieDeltas(); + Simulation::step(false); + for (int i=0; i neighbor_dependencies[NUM_REACTIONS]; + std::set dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::set& neighbordeps_tofill,std::set& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.insert(sp); + return 0.0; + }; + private: + std::set& interdeps_tofill; + std::set& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + #define REACTION(name) \ + for (dense::Natural n=0; n& intradeps = dependencies[n]; \ + const std::set& interdeps = neighbor_dependencies[n]; \ + std::set::iterator intra = intradeps.begin(); \ + std::set::iterator inter = interdeps.begin(); \ + bool intraRelated = false; \ + bool interRelated = false; \ + for (std::size_t in=0; in(r)]); + auto crxnid = encode(c, static_cast(r)); + std::pair event_pair = std::make_pair(crxnid, tau); + reaction_schedule.push(event_pair); + } + } +} + +}} diff --git a/source/sim/stoch/anderson_next_reaction_simulation.hpp b/source/sim/stoch/anderson_next_reaction_simulation.hpp new file mode 100644 index 00000000..924580d2 --- /dev/null +++ b/source/sim/stoch/anderson_next_reaction_simulation.hpp @@ -0,0 +1,262 @@ +#ifndef SIM_STOCH_ANDERSON_NEXT_REACTION_SIMULATION_HPP +#define SIM_STOCH_ANDERSON_NEXT_REACTION_SIMULATION_HPP + +#include "sim/base.hpp" +#include "core/parameter_set.hpp" +#include "core/model.hpp" +#include "core/specie.hpp" +#include "sim/cell_param.hpp" +#include "core/reaction.hpp" +#include "indexed_priority_queue.hpp" +#include +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * Anderson_Next_Reaction_Simulation + * uses the Next Reaction Algorithm +*/ +class Anderson_Next_Reaction_Simulation : public Simulation { + +public: + + using Context = dense::Context; + + using event_id = Natural; + private: + + //"event" represents a delayed reaction scheduled to fire later + struct event { + Minutes time; + Natural cell; + reaction_id reaction; + friend bool operator<(event const& a, event const &b) { return a.time < b.time;} + friend bool operator>(event const& a, event const& b) { return b < a; } + }; + + //"reaction_schedule" is a set ordered by time of delay reactions that will fire + indexed_priority_queue reaction_schedule; + //indexed_priority_queue reaction_schedule; + + //"concs" stores current concentration levels for every species in every cell + std::vector > concs; + //"propensities" stores probability of each rxn firing, calculated from active rates + std::vector > propensities; + //for each rxn, stores intracellular reactions whose rates are affected by a firing of that rxn + std::vector propensity_network[NUM_REACTIONS]; + //for each rxn, stores intercellular reactions whose rates are affected by a firing of that rxn + std::vector neighbor_propensity_network[NUM_REACTIONS]; + //random number generator + std::default_random_engine generator; + + Real total_propensity_ = {}; + static std::uniform_real_distribution distribution_; + + Minutes generateTau(Real); + Minutes getSoonestDelay() const; + void executeDelayRXN(); + Real getRandVariable(); + void tauLeap(); + void initPropensityNetwork(); + void generateRXNTaus(Real tau); + void fireOrSchedule(int c, reaction_id rid); + void initPropensities(); + + public: + + /* + * ContextStoch: + * iterator for observers to access conc levels with + */ + using SpecieRates = CUDA_Array; + + private: + void fireReaction(dense::Natural cell, const reaction_id rid); + + public: + /* + * Constructor: + * calls simulation base constructor + * initializes fields "t" and "generator" + */ + Anderson_Next_Reaction_Simulation(const Parameter_Set& ps, Real* pnFactorsPert, Real** pnFactorsGrad, int seed, std::vector conc, NGraph::Graph adj_graph) + : Simulation(ps, std::move(adj_graph), pnFactorsPert, pnFactorsGrad) + , reaction_schedule(NUM_REACTIONS * cell_count()) + , concs(cell_count(), conc) + , propensities(cell_count()) + , generator(seed) { + // 1.a. generate the dependency graph + initPropensityNetwork(); + // 1.b. calculate the propensity function a_i for all i + initPropensities(); + // 1.c. for each i, generate a putative time, tau_i according to + // an exponential distribution with parameter a_i; + // 1.d. store the values in an indexed priority queue P; + for (dense::Natural c = 0; c < cell_count(); ++c) { + for (int i = 0; i < NUM_REACTIONS; ++i) { + auto r = static_cast(i); + auto eid = encode(c, r); + auto tau = generateTau(propensities[c][r]); + reaction_schedule.emplace(eid, tau); + } + } + } + + Real get_concentration (dense::Natural cell, specie_id species) const { + return concs.at(cell).at(species); + } + + Real get_concentration (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + return get_concentration(cell, species); + } + + void update_concentration (dense::Natural cell_, specie_id sid, int delta) { + auto& concentration = concs[cell_][sid]; + concentration = std::max(concentration + delta, 0); + } + + + /* + * GETTOTALPROPENSITY + * sums the propensities of every reaction in every cell + * called by "generateTau" in simulation_stoch.cpp + * return "sum": the propensity sum + */ + // Todo: store this as a cached variable and change it as propensities change; + // sum += new_value - old_value; + __attribute_noinline__ Real get_total_propensity() const { + Real sum = total_propensity_; // 0.0; + /*for (dense::Natural c = 0; c < _cells_total; ++c) { + for (int r=0; r choose_reaction() { + auto next_reaction_encoded_id = reaction_schedule.top().first; + auto decoded_event_id = decode(next_reaction_encoded_id); + return decoded_event_id; + } + + /* + * UPDATEPROPENSITIES + * recalculates the propensities of reactions affected by the firing of "rid" + * arg "rid": the reaction that fired + */ + CUDA_AGNOSTIC + __attribute_noinline__ void update_propensities_and_taus(dense::Natural cell_, reaction_id rid) { + #define REACTION(name)\ + if (name == rid) { /* alpha == mu */\ + /* 5.a. update a_alpha (propensity) */\ + auto& a = propensities[cell_][name];\ + auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, cell_)), Real{0}); \ + a = new_a;\ + /* 5.c. generate a random number according to an exponential\ + distribution with parameter a_mu */\ + auto p = generateTau(new_a);\ + /* Set tau_alpha <- p + t */\ + auto tau_alpha = p + age();\ + /* 5.d. replace the old tau_alpha in P with the new value */\ + reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ + } + #include "reactions_list.hpp" + #undef REACTION + for (std::size_t i=0; i< propensity_network[rid].size(); i++) { + #define REACTION(name)\ + if ( name == propensity_network[rid][i] ) { /* alpha != mu */\ + /* 5.a. update a_alpha (propensity) */\ + auto& a = propensities[cell_][name];\ + auto old_a = a;\ + auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, cell_)), Real{0});\ + a = new_a;\ + /* 5.b. set tau_alpha <- (a_alpha_old / a_alpha_new)(tau_alpha - t) + t */\ + auto tau_alpha = reaction_schedule.at(encode(cell_, name));\ + tau_alpha = (old_a / new_a)*(tau_alpha - age()) + age();\ + /* 5.d. replace the old tau_alpha in P with the new value */\ + reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ + } + #include "reactions_list.hpp" + #undef REACTION + } + for (std::size_t r=0; r< neighbor_propensity_network[rid].size(); r++) { + #define REACTION(name)\ + if (name == neighbor_propensity_network[rid][r]) { \ + for (dense::Natural n=0; n < neighbor_count_by_cell_[cell_]; n++) { \ + int n_cell = neighbors_by_cell_[cell_][n]; /* alpha != mu */\ + /* 5.a. update a_alpha (propensity) */\ + auto& a = propensities[n_cell][name];\ + auto old_a = a;\ + auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, n_cell)), Real{0}); \ + a = new_a;\ + /* 5.b. set tau_alpha <- (a_alpha_old / a_alpha_new)(tau_alpha - t) + t */\ + auto tau_alpha = reaction_schedule.at(encode(cell_, name));\ + tau_alpha = (old_a / new_a)*(tau_alpha - age()) + age();\ + /* 5.d. replace the old tau_alpha in P with the new value */\ + reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ + } \ + } + #include "reactions_list.hpp" + #undef REACTION + } + } + + + /* + * CALCULATENEIGHBORAVG + * arg "sp": the specie to average from the surrounding cells + * arg "delay": unused, but used in deterministic context. Kept for polymorphism + * returns "avg": average concentration of specie in current and neighboring cells + */ + Real calculate_neighbor_average (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + Real sum = 0; + for (dense::Natural i = 0; i < neighbor_count_by_cell_[cell]; ++i) { + sum += concs[neighbors_by_cell_[cell][i]][species]; + } + return sum / neighbor_count_by_cell_[cell]; + } + + Minutes age_by(Minutes duration); + + std::vector get_perf(){ + return Simulation::get_performance(); + } + + private: + + Minutes time_until_next_event () const; + + event_id encode(Natural cell, reaction_id reaction){ + Natural rxn_id = static_cast(reaction); + return (cell*NUM_REACTIONS)+rxn_id; + } + std::pair decode(event_id e){ + reaction_id rxn_id = static_cast(e % NUM_REACTIONS); + Natural c = e / NUM_REACTIONS; + return std::make_pair(c,rxn_id); + } + + void initTau(); + + +}; + +} +} + +#endif diff --git a/source/sim/stoch/completetree.hpp b/source/sim/stoch/completetree.hpp new file mode 100644 index 00000000..cf30808e --- /dev/null +++ b/source/sim/stoch/completetree.hpp @@ -0,0 +1,193 @@ +#ifndef COMPLETE_TREE +#define COMPLETE_TREE + +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + + + + /* This complete tree class is meant to be subclassed to build various + * data structures. Because most of those data structures require + * updates when values are modified, only const access to elements is + * granted publicly, while there are protected methods for non-const + * element access. + */ + template < + typename P, + typename T + > + class complete_tree { + + private: + + enum class ignore {}; + + template + using underlying_if_enum = typename std::conditional< + std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, E, ignore>::type + >::type, + E + >::type; + + public: + + using size_type = std::ptrdiff_t; + using position_type = P; + using entry_type = T; + using iterator = entry_type*; + using const_iterator = entry_type const*; + using reference = entry_type&; + using const_reference = entry_type const&; + + complete_tree() = delete; + + complete_tree(position_type max_size) : + _max_size{max_size}, + _tree(_max_size) {} + + complete_tree(complete_tree const&) = default; + + complete_tree(complete_tree &&) = default; + + complete_tree& operator=(complete_tree const&) = default; + + complete_tree& operator=(complete_tree &&) = default; + + ~complete_tree() = default; + + //Tree property methods + size_type max_size() const { + return static_cast(_max_size); + } + + size_type size() const { + return _size; + } + + bool empty() const { + return _size == 0; + } + + //Tree modification methods + // + protected: + void add_entry(entry_type entry) { + _tree.at(last()+1) = entry; + _size++; + } + + template + void emplace_entry(Args&&... args) { + add_entry(entry_type(std::forward(args)...)); + } + + void remove_last_entry() { + if (empty()) return; + _size--; + } + + //Iterator methods + public: + const_iterator begin() const { + return iterator_for(root()); + } + + const_iterator end() const { + return iterator_for(last()) + 1; + } + + const_iterator iterator_for(position_type node) const { + return _tree.data() + node; + } + + protected: + iterator iterator_for(position_type node) { + return const_cast(const_this().iterator_for(node)); + } + + iterator begin() { + return iterator_for(root()); + } + + iterator end() { + return iterator_for(last()) + 1; + } + + public: + //Position methods + static constexpr position_type root() { return 0; } + position_type last() const { return _size - 1; } + position_type null_node() const { + return _max_size; + } + + static position_type parent_of(position_type node) { + return ((node + 1) >> 1) - 1; + } + + static position_type left_of(position_type node) { + return (node << 1) + 1; + } + + static position_type right_of(position_type node) { + return (node + 1) << 1; + } + + //Element access + const_reference top() const { + return value_of(root()); + } + + const_reference operator[](position_type i) const { + return _tree[i]; + } + + const_reference at(position_type i) const { + if (i >= _size) { + throw std::out_of_range("Index out of range"); + } + return _tree[i]; + } + + + complete_tree const& const_this() const { + return static_cast(*this); + } + + const_reference value_of(position_type node) const { + return *iterator_for(node); + } + + protected: + reference value_of(position_type node) { + return const_cast(const_this().value_of(node)); + } + + reference operator[](position_type i) { + return _tree[i]; + } + + reference at(position_type i) { + if (i >= _size) { + throw std::out_of_range("Index out of range"); + } + return _tree[i]; + } + + private: + position_type _max_size; + std::vector _tree; + position_type _size = 0; + + }; + +} +} +#endif diff --git a/source/sim/stoch/fast_gillespie_direct_simulation.cpp b/source/sim/stoch/fast_gillespie_direct_simulation.cpp index 68262c4d..0b847a5d 100644 --- a/source/sim/stoch/fast_gillespie_direct_simulation.cpp +++ b/source/sim/stoch/fast_gillespie_direct_simulation.cpp @@ -34,18 +34,19 @@ Minutes Fast_Gillespie_Direct_Simulation::age_by (Minutes duration) { while ((tau = generateTau()) > (t_until_event = time_until_next_event())) { Simulation::age_by(t_until_event); executeDelayRXN(); - if (age() >= end_time) return age(); + if (age() >= end_time){ + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); + } } tauLeap(); Simulation::age_by(tau); } - if(std::isnan(age() / Minutes{1})){ - throw(std::out_of_range("Time is out of range")); - } auto finish = std::chrono::high_resolution_clock::now(); - std::cout<< "reactions fired per second: "< get_perf(){ + return Simulation::get_performance(); + } + + private: Minutes time_until_next_event () const; diff --git a/source/sim/stoch/heap.hpp b/source/sim/stoch/heap.hpp new file mode 100644 index 00000000..6656286d --- /dev/null +++ b/source/sim/stoch/heap.hpp @@ -0,0 +1,79 @@ +#ifndef DENSE_SIM_HEAP +#define DENSE_SIM_HEAP +#include "completetree.hpp" +#include "utility/numerics.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + + +//Class to randomly select an index where each index's probability of being +// selected is weighted by a given vector. +template +class heap { + public: + heap() = default; + + void pop() { + if (_tree().empty()) return; + if (_tree().root() != _tree().last()) { + _tree().swap(_tree().root(), _tree().last()); + } + _tree().remove_last_entry(); + sift_down(_tree().root()); + } + + template + void push(T entry) { + _tree().add_entry(entry); + sift_up(_tree().last()); + } + + template + void update(PosType i, ValType new_weight) { + _tree().value_of(i) = new_weight; + update_position(i); + } + + protected: + void update_position(PosType i) { + sift_up(i) || sift_down(i); + } + + private: + + bool sift_up(PosType node) { + PosType start = node, parent; + while (node != _tree().root() && _tree().less(node, parent = _tree().parent_of(node))) { + _tree().swap_with_child(parent, node); + node = parent; + } + return node != start; + } + + bool sift_down(PosType node) { + PosType start = node, min_child; + while (_tree().left_of(node) < _tree().size() && _tree().less(min_child = min_child_of(node), node)) { + _tree().swap_with_child(node, min_child); + node = min_child; + } + return node != start; + } + + PosType min_child_of(PosType node) const { + auto left = _tree().left_of(node); + auto right = _tree().right_of(node); + return (right < _tree().size() && _tree().less(right, left)) ? right : left; + } + + Tree& _tree() { return *static_cast(this); } + const Tree& _tree() const { return *static_cast(this); } +}; + +} +} +#endif diff --git a/source/sim/stoch/heap_random_selector.hpp b/source/sim/stoch/heap_random_selector.hpp new file mode 100644 index 00000000..c5ac2fc1 --- /dev/null +++ b/source/sim/stoch/heap_random_selector.hpp @@ -0,0 +1,97 @@ +#ifndef DENSE_SIM_HEAP_TREE +#define DENSE_SIM_HEAP_TREE +#include "completetree.hpp" +#include "weightsum_tree.hpp" +#include "heap.hpp" +#include "utility/numerics.hpp" +#include +#include +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + + +//Class to randomly select an index where each index's probability of being +// selected is weighted by a given vector. +template ::digits> +class heap_random_selector : protected complete_tree >, + public heap, IntType>, + protected weightsum_tree, IntType, precision> { + public: + using BaseTree = complete_tree >; + using Heap = heap, IntType>; + using WeightSum = weightsum_tree, IntType, IntType, precision>; + friend Heap; + friend WeightSum; + using PosType = typename BaseTree::position_type; + + heap_random_selector() = delete; + heap_random_selector(PosType p) : BaseTree(p), Heap() {}; + + bool empty() { return BaseTree::empty(); } + + template + heap_random_selector(std::vector& weights) : + BaseTree(weights.size()), + Heap() + { + for (int i = 0; i < weights.size(); i++) { + auto w = weights[i]; + BaseTree::add_entry(std::tuple(i, w, 0.0)); + Heap::update_position(BaseTree::last()); + } + WeightSum::compute_weights(); + } + + //Methods of BaseTree we want to make available + std::tuple top() { + return BaseTree::top(); + } + + //Methods of WeightSum we want to make available + template + IntType operator()(URNG& g) { + return id_of(WeightSum::operator()(g)); + } + + private: + void remove_last_entry() { + auto last = BaseTree::value_of(BaseTree::last()); + WeightSum::update_weight(BaseTree::last(), 0); + BaseTree::remove_last_entry(); + } + + + Real& weight_of(PosType p) { + return std::get<1>(BaseTree::value_of(p)); + } + Real& weightsum_of(PosType p) { + return std::get<2>(BaseTree::value_of(p)); + } + + IntType& id_of(PosType p) { return std::get<0>(BaseTree::value_of(p)); } + + void swap(PosType i, PosType j) { + std::swap(id_of(i), id_of(j)); + WeightSum::swap(i, j); + } + + void swap_with_child(PosType parent, PosType child) { + std::swap(id_of(parent), id_of(child)); + WeightSum::swap_with_child(parent, child); + } + + bool less(PosType a, PosType b) const { + return std::greater()(std::get<1>(BaseTree::value_of(a)), std::get<1>(BaseTree::value_of(b))); + } + + +}; + +} +} +#endif diff --git a/source/sim/stoch/heap_tree.hpp b/source/sim/stoch/heap_tree.hpp new file mode 100644 index 00000000..86a2d010 --- /dev/null +++ b/source/sim/stoch/heap_tree.hpp @@ -0,0 +1,63 @@ +#ifndef DENSE_SIM_HEAP_TREE +#define DENSE_SIM_HEAP_TREE +#include "completetree.hpp" +#include "heap.hpp" +#include "utility/numerics.hpp" +#include +#include +#include + +namespace dense { +namespace stochastic { + + +//Class to randomly select an index where each index's probability of being +// selected is weighted by a given vector. +template > +class heap_tree : public complete_tree, + public heap, int> { + public: + using BaseTree = complete_tree; + using Heap = heap, int>; + friend Heap; + using PosType = typename BaseTree::position_type; + static PosType left_of(PosType i) { return BaseTree::left_of(i);} + static PosType right_of(PosType i) { return BaseTree::right_of(i);} + static PosType parent_of(PosType i) { return BaseTree::parent_of(i);} + + //Weights can be of any type, but most be convertable to Real values + heap_tree() = delete; + heap_tree(PosType p, Compare compare = Compare{}) : BaseTree(p), Heap(), _compare{compare} {}; + + heap_tree(std::vector& weights) : + BaseTree(weights.size()), + Heap() + { + for (auto w : weights) { + BaseTree::add_entry(w); + Heap::update_position(BaseTree::last()); + } + } + private: + + void swapWithChild(PosType parent, PosType child) { + std::swap(BaseTree::value_of(parent), BaseTree::value_of(child)); + } + + void swap(PosType i, PosType j) { + std::swap(BaseTree::value_of(i), BaseTree::value_of(j)); + } + + bool less(PosType a, PosType b) const { + return _compare(BaseTree::value_of(a), BaseTree::value_of(b)); + } + + Compare _compare{}; + + PosType id_of(PosType p) { return p; } + +}; + +} +} +#endif diff --git a/source/sim/stoch/heap_usage.cpp b/source/sim/stoch/heap_usage.cpp new file mode 100644 index 00000000..c2eddafe --- /dev/null +++ b/source/sim/stoch/heap_usage.cpp @@ -0,0 +1,20 @@ +#include "heap_tree.hpp" +#include +#include + + +using namespace dense::stochastic; + + +int main() { + std::vector items = {10, 4, 3, 42, 15, 82, 95, 49, 2}; + heap_tree > ht(items); + + std::sort(items.rbegin(), items.rend()); + + for (auto i : items) { + std::cout << i << ", " << ht.top() << std::endl; + ht.pop(); + } + return 0; +} diff --git a/source/sim/stoch/hwrstest.cpp b/source/sim/stoch/hwrstest.cpp new file mode 100644 index 00000000..b20788bc --- /dev/null +++ b/source/sim/stoch/hwrstest.cpp @@ -0,0 +1,40 @@ +#include "heap_random_selector.hpp" + +#include +#include + +using namespace dense::stochastic; + +int main() { + std::default_random_engine generator; + std::vector weights = {1, 2, 3, 4}; + + heap_random_selector selector(weights); + std::cout << "Constructed" << std::endl; + std::vector counts(weights.size()); + + while (!selector.empty()) { + counts = std::vector(weights.size()); + for (int i = 0; i < 100000; i++) { + int index = selector(generator); + if (index < 0 || index >= weights.size()) { + std::cout << "Error, index out of range" << std::endl; + } else { + counts[index]++; + } + } + for (auto c : counts) { + std::cout << c << ','; + } + std::cout << std::endl; + std::cout << std::endl; + + auto top = selector.top(); + + std::cout << std::get<0>(top) << ", " + << std::get<1>(top) << ", " + << std::get<2>(top) << std::endl; + + selector.pop(); + } +} diff --git a/source/sim/stoch/indexed_collection.hpp b/source/sim/stoch/indexed_collection.hpp new file mode 100644 index 00000000..5569b852 --- /dev/null +++ b/source/sim/stoch/indexed_collection.hpp @@ -0,0 +1,81 @@ +#ifndef INDEXED_COLLECTION +#define INDEXED_COLLECTION + +#include +#include +#include +#include + +#include "completetree.hpp" +#include "heap.hpp" + +namespace dense { +namespace stochastic { + +//An indexed collection is meant to be a mix-in of a complete tree. +//It requires that tree entries store an ID of some kind, and keeps an +// up-to-date map of where entries corresponding to particular user-provided +// indexes can be found. +template < + class Tree, + typename IndexType, + typename PosType, + typename MappedType +> +class indexed_collection { + public: + indexed_collection() = delete; + indexed_collection(IndexType max_size) : + _node_for_index(max_size, max_size) {} + + //Element access + const MappedType& operator[](IndexType i) const { + return _tree().value_of(_node_for_index[i]); + } + + MappedType const& at(IndexType i) const { + auto node = _node_for_index[i]; + if (node == _tree().null_node()) { + throw std::out_of_range("Index out of range"); + } + return _tree().value_of(node); + } + + protected: + PosType node_for_index(IndexType i) const { + return _node_for_index[i]; + } + + MappedType& operator[](IndexType i) { + return _tree().value_of(_node_for_index[i]); + } + + + void associate(IndexType i, PosType p) { + _node_for_index[i] = p; + } + + void dissociate(IndexType i) { + _node_for_index[i] = _tree().null_node(); + } + + void swap(PosType a, PosType b) { + std::swap(_tree().id_of(a), _tree().id_of(b)); + associate(_tree().id_of(a), a); + associate(_tree().id_of(b), b); + } + + void swap_with_child(PosType a, PosType b) { + swap(a, b); + } + + private: + std::vector _node_for_index; + Tree& _tree() { return *static_cast(this); } + const Tree& _tree() const { return *static_cast(this); } +}; + +} +} + +#endif diff --git a/source/sim/stoch/indexed_priority_queue.hpp b/source/sim/stoch/indexed_priority_queue.hpp index b86cbd40..f73913a7 100644 --- a/source/sim/stoch/indexed_priority_queue.hpp +++ b/source/sim/stoch/indexed_priority_queue.hpp @@ -1,22 +1,55 @@ +#ifndef IND_PRI_Q +#define IND_PRI_Q + #include #include #include #include +#include "completetree.hpp" +#include "heap.hpp" +#include "indexed_collection.hpp" + namespace dense { namespace stochastic { +namespace { + enum class ignore{}; +} + template < typename I, typename T, typename Compare = std::less > - class indexed_priority_queue { + class indexed_priority_queue : + //Indexed priority queue extends a complete tree... + public complete_tree< + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore>::type>::type, + I>::type, + std::pair >, + + //... using the heap mix-in + protected heap< indexed_priority_queue, + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore>::type>::type, + I>::type >, + + //... and the indexed collection mix-in + public indexed_collection< indexed_priority_queue, + I, + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore>::type>::type, + I>::type, + T> + { private: - enum class ignore {}; - template using underlying_if_enum = typename std::conditional< std::is_enum::value, @@ -38,14 +71,20 @@ namespace stochastic { using const_iterator = value_type const*; using reference = value_type&; using const_reference = value_type const&; + using BaseTree = complete_tree; + using Heap = heap, node_type>; + using Index = indexed_collection, index_type, node_type, mapped_type>; + + friend Heap; + friend Index; indexed_priority_queue() = delete; indexed_priority_queue(I max_size, Compare compare = Compare{}) : - _max_size{static_cast(max_size)}, - _compare{compare}, - _heap(_max_size), - _map(_max_size, null_node()) {} + BaseTree(max_size), + Heap(), + Index(max_size), + _compare{compare} {} indexed_priority_queue(indexed_priority_queue const&) = default; @@ -57,67 +96,36 @@ namespace stochastic { ~indexed_priority_queue() = default; - size_type max_size() const { - return _max_size; - } - - size_type size() const { - return _size; - } - - bool empty() const { - return _size == 0; - } - void push(value_type value) { - auto& node = node_at(value.first); - if (node == null_node()) { - ++_size; - node = last(); - } - value_of(node) = value; - sift_up(node) || sift_down(node); - } - - void pop() { - if (empty()) return; - auto node = root(); - auto i = value_of(node).first; - if (node != last()) { - swap(node, last()); + auto node = Index::node_for_index(value.first); + if (node == BaseTree::null_node()) { + Heap::push(value); + } else { + Heap::update(node, value); } - --_size; - sift_down(node); - node_at(i) = null_node(); - } - - const_iterator begin() const { - return iterator_for(root()); } - const_iterator end() const { - return iterator_for(last()) + 1; - } - - const_reference top() const { - return value_of(root()); + void pop() { + auto index_removed = id_of(BaseTree::root()); + Heap::pop(); + Index::dissociate(index_removed); } mapped_type const& operator[](index_type i) const { - return value_of(node_at(i)).second; + return BaseTree::value_of(Index::node_for_index(i)).second; } const_iterator find(index_type i) const { - auto node = node_at(i); - return node == null_node() ? end() : iterator_for(node); + auto node = Index::node_for_index(i); + return node == BaseTree::null_node() ? BaseTree::end() : BaseTree::iterator_for(node); } mapped_type const& at(index_type i) const { - auto node = node_at(i); - if (node == null_node()) { + auto node = Index::node_for_index(i); + if (node == BaseTree::null_node()) { throw std::out_of_range("Index out of range"); } - return value_of(node).second; + return BaseTree::value_of(node).second; } template @@ -125,101 +133,36 @@ namespace stochastic { push(value_type(std::forward(args)...)); } + private: + void add_entry(value_type v) { + BaseTree::add_entry(v); + auto newp = BaseTree::last(); + Index::associate(id_of(newp), newp); + } indexed_priority_queue const& const_this() const { return static_cast(*this); } bool less(node_type a, node_type b) const { - return _compare(value_of(a).second, value_of(b).second); - } - - node_type const& node_at(index_type i) const { - return _map[static_cast(i)]; - } - - node_type& node_at(index_type i) { - return const_cast(const_this().node_at(i)); - } - - const_iterator iterator_for(node_type node) const { - return _heap.data() + node; - } - - iterator iterator_for(node_type node) { - return const_cast(const_this().iterator_for(node)); - } - - const_reference value_of(node_type node) const { - return *iterator_for(node); - } - - reference value_of(node_type node) { - return const_cast(const_this().value_of(node)); - } - - static constexpr node_type root() { return 0; } - node_type last() const { return _size - 1; } - - node_type parent_of(node_type node) const { - return ((node + 1) >> 1) - 1; - } - - node_type left_of(node_type node) const { - return (node << 1) + 1; - } - - node_type right_of(node_type node) const { - return (node + 1) << 1; - } - - node_type min_child_of(node_type node) const { - auto left = left_of(node); - auto right = right_of(node); - return (right < _size && less(right, left)) ? right : left; + return _compare(BaseTree::value_of(a).second, BaseTree::value_of(b).second); } void swap(node_type a, node_type b) { - using std::swap; - swap(value_of(a), value_of(b)); - node_at(value_of(a).first) = a; - node_at(value_of(b).first) = b; + std::swap(BaseTree::value_of(a).second, BaseTree::value_of(b).second); + Index::swap(a, b); } - bool sift_up(node_type node) { - node_type start = node, parent; - while (node != root() && less(node, parent = parent_of(node))) { - swap(node, parent); - node = parent; - } - return node != start; - } - - bool sift_down(node_type node) { - node_type start = node, min_child; - while (left_of(node) < _size && less(min_child = min_child_of(node), node)) { - swap(node, min_child); - node = min_child; - } - return node != start; + void swap_with_child(node_type a, node_type b) { + swap(a, b); } - node_type _max_size; + index_type& id_of(node_type p) { return BaseTree::value_of(p).first; } mapped_compare _compare{}; - - node_type null_node() const { - return _max_size; - } - - std::vector _heap; - - std::vector _map; - - node_type _size = 0; - }; - } -} \ No newline at end of file +} + +#endif diff --git a/source/sim/stoch/log_direct_method.cpp b/source/sim/stoch/log_direct_method.cpp new file mode 100644 index 00000000..3a8965d4 --- /dev/null +++ b/source/sim/stoch/log_direct_method.cpp @@ -0,0 +1,244 @@ +#include +#include "log_direct_method.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Log_Direct_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Log_Direct_Simulation::age_by (Minutes duration) { + auto start = std::chrono::high_resolution_clock::now(); + Simulation::step(true); + auto end_time = age() + duration; + while (age() < end_time) { + Minutes tau, t_until_event; + tau = generateTau(); + /* + while ((tau = generateTau()) > (t_until_event = time_until_next_event())) { + Simulation::age_by(t_until_event); + executeDelayRXN(); + if (age() >= end_time) return age(); + } + if(end_time < (age() + tau)){ + Minutes diff = end_time - age(); + Simulation::age_by(diff); + return age(); + } + */ + tauLeap(); + Simulation::age_by(tau); + } + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); +} + +/* + * GENERATETAU + * return "tau": possible timestep leap calculated from a random variable +*/ +Minutes Log_Direct_Simulation::generateTau() { + auto r = getRandVariable(); + auto log_inv_r = -std::log(r); + + return Minutes{ log_inv_r / get_total_propensity() }; +} + +/* + * GETSOONESTDELAY + * return "dTime": the time that the next scheduled delay reaction will fire + * if no delay reaction is scheduled, the maximum possible float is returned +*/ +/* +Minutes Log_Direct_Simulation::getSoonestDelay() const { + return event_schedule.empty() ? + Minutes{ std::numeric_limits::infinity() } : + event_schedule.top().time; +} + +Minutes Log_Direct_Simulation::time_until_next_event() const { + return getSoonestDelay() - age(); +} +*/ + +/* + * EXECUTEDELAYRXN + * calls fireReaction for the next scheduled delay reaction + * precondition: a delay reaction is scheduled + * postcondition: the soonest scheduled delay reaction is removed from the schedule +*/ +/* +void Log_Direct_Simulation::executeDelayRXN() { + event delay_rxn = event_schedule.top(); + fireReaction(delay_rxn.cell, delay_rxn.rxn); + event_schedule.pop(); +} +*/ + +/* + * GETRANDVARIABLE + * return "u": a random variable between 0.0 and 1.0 +*/ + +Real Log_Direct_Simulation::getRandVariable() { + return distribution_(generator); +} + +/* + * TAULEAP + * chooses a reaction to fire or schedule and moves forward in time + * arg "tau": timestep to leap forward by +*/ +void Log_Direct_Simulation::tauLeap(){ + int j = choose_reaction(); + int r = j % NUM_REACTIONS; + int c = j / NUM_REACTIONS; + fireOrSchedule(c,(reaction_id)r); +} + +/* + * FIREORSCHEDULE + * fires or schedules a reaction firing in a specific cell + * arg "c": the cell that the reaction takes place in + * arg "rid": the reaction to fire or schedule +*/ +void Log_Direct_Simulation::fireOrSchedule(int cell, reaction_id rid){ + /* + delay_reaction_id dri = dense::model::getDelayReactionId(rid); + + if (dri!=NUM_DELAY_REACTIONS) { + event_schedule.push({ age() + Minutes{ Context(*this, cell).getDelay(dri) }, cell, rid }); + } + else { + fireReaction(cell, rid); + } + */ + fireReaction(cell, rid); +} + +/* + * FIREREACTION + * fires a reaction by properly decrementing and incrementing its inputs and outputs + * arg "*c": pointer to a context of the cell to fire the reaction in + * arg "rid": reaction to fire +*/ +void Log_Direct_Simulation::fireReaction(dense::Natural cell, reaction_id rid){ + Simulation::step(false); + const reaction_base& r = dense::model::getReaction(rid); + const specie_id* specie_deltas = r.getSpecieDeltas(); + for (int i=0; i prop_list; + for (dense::Natural c = 0; c < cell_count(); ++c) { + Context ctxt(*this,c); + #define REACTION(name) \ + prop_list.push_back(dense::model::reaction_##name.active_rate(ctxt)); + #include "reactions_list.hpp" + #undef REACTION + } + //initialize propensity random selector + propensities = fast_random_selector(prop_list); +} + +/* + * INITPROPENSITYNETWORK + * populates the "propensity_network" and "neighbor_propensity_network" data structures + * finds inter- and intracellular reactions that have rates affected by the firing of each rxn +*/ +void Log_Direct_Simulation::initPropensityNetwork() { + + std::set neighbor_dependencies[NUM_REACTIONS]; + std::set dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::set& neighbordeps_tofill,std::set& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.insert(sp); + return 0.0; + }; + private: + std::set& interdeps_tofill; + std::set& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + #define REACTION(name) \ + for (dense::Natural n=0; n& intradeps = dependencies[n]; \ + const std::set& interdeps = neighbor_dependencies[n]; \ + std::set::iterator intra = intradeps.begin(); \ + std::set::iterator inter = interdeps.begin(); \ + bool intraRelated = false; \ + bool interRelated = false; \ + for (std::size_t in=0; in +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * STOCHASTIC SIMULATOR: + * superclasses: simulation_base, Observable + * uses Gillespie's tau leaping algorithm + * uses Barrio's delay SSA +*/ +class Log_Direct_Simulation : public Simulation { + +public: + + using Context = dense::Context; + + private: + + //"event" represents a delayed reaction scheduled to fire later + struct event { + Minutes time; + Natural cell; + reaction_id rxn; + friend bool operator<(event const& a, event const &b) { return a.time < b.time;} + friend bool operator>(event const& a, event const& b) { return b < a; } + }; + + /* + //"event_schedule" is a set ordered by time of delay reactions that will fire + std::priority_queue, std::greater> event_schedule; + */ + + //"concs" stores current concentration levels for every species in every cell + std::vector > concs; + //"propensities" stores probability of each rxn firing, calculated from active rates, and + // enables weighted random selection from among its elements + fast_random_selector propensities; + //for each rxn, stores intracellular reactions whose rates are affected by a firing of that rxn + std::vector propensity_network[NUM_REACTIONS]; + //for each rxn, stores intercellular reactions whose rates are affected by a firing of that rxn + std::vector neighbor_propensity_network[NUM_REACTIONS]; + //random number generator + std::default_random_engine generator = std::default_random_engine{ std::random_device()() }; + + static std::uniform_real_distribution distribution_; + + Minutes generateTau(); + Minutes getSoonestDelay() const; + void executeDelayRXN(); + Real getRandVariable(); + void tauLeap(); + void initPropensityNetwork(); + void generateRXNTaus(Real tau); + void fireOrSchedule(int c, reaction_id rid); + void initPropensities(); + + public: + + /* + * ContextStoch: + * iterator for observers to access conc levels with + */ + using SpecieRates = CUDA_Array; + + private: + void fireReaction(dense::Natural cell, const reaction_id rid); + + public: + /* + * Constructor: + * calls simulation base constructor + * initializes fields "t" and "generator" + */ + + Log_Direct_Simulation(const Parameter_Set& ps, NGraph::Graph adj_graph, std::vector conc, Real* pnFactorsPert, Real** pnFactorsGrad, int seed) + : Simulation(ps, adj_graph, pnFactorsPert, pnFactorsGrad) + , concs(cell_count(), conc) + , propensities(cell_count()*NUM_REACTIONS) + , generator{seed} { + initPropensityNetwork(); + initPropensities(); + } + + std::vector get_perf(){ + return Simulation::get_performance(); + } + + Real get_total_propensity() const {return propensities.total_weight();} + + Real get_concentration (dense::Natural cell, specie_id species) const { + return concs.at(cell).at(species); + } + + Real get_concentration (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + return get_concentration(cell, species); + } + + void update_concentration (dense::Natural cell_, specie_id sid, int delta) { + auto& concentration = concs[cell_][sid]; + concentration = std::max(concentration + delta, 0); + } + + + /* + * CHOOSEREACTION + * randomly chooses a reaction biased by their propensities + * arg "propensity_portion": the propensity sum times a random variable between 0.0 and 1.0 + * return "j": the index of the reaction chosen in RSO. + */ + CUDA_AGNOSTIC + __attribute_noinline__ int choose_reaction() { + return propensities(generator); + } + + /* + * UPDATEPROPENSITIES + * recalculates the propensities of reactions affected by the firing of "rid" + * arg "rid": the reaction that fired + */ + CUDA_AGNOSTIC + __attribute_noinline__ void update_propensities(dense::Natural cell_, reaction_id rid) { + #define REACTION(name) \ + for (std::size_t i=0; i< propensity_network[rid].size(); i++) { \ + if ( name == propensity_network[rid][i] ) { \ + propensities.update_weight(encode(cell_,name), \ + dense::model::reaction_##name.active_rate(Context(*this, cell_))); \ + } \ + } \ + for (std::size_t r=0; r< neighbor_propensity_network[rid].size(); r++) { \ + if (name == neighbor_propensity_network[rid][r]) { \ + for (dense::Natural n=0; n < neighbor_count_by_cell_[cell_]; n++) { \ + int n_cell = neighbors_by_cell_[cell_][n]; \ + Context neighbor(*this, n_cell); \ + propensities.update_weight(encode(n_cell, name), \ + dense::model::reaction_##name.active_rate(neighbor)); \ + } \ + } \ + } + #include "reactions_list.hpp" + #undef REACTION + } + + + /* + * CALCULATENEIGHBORAVG + * arg "sp": the specie to average from the surrounding cells + * arg "delay": unused, but used in deterministic context. Kept for polymorphism + * returns "avg": average concentration of specie in current and neighboring cells + */ + Real calculate_neighbor_average (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + Real sum = 0; + for (dense::Natural i = 0; i < neighbor_count_by_cell_[cell]; ++i) { + sum += concs[neighbors_by_cell_[cell][i]][species]; + } + return sum / neighbor_count_by_cell_[cell]; + } + + Minutes age_by(Minutes duration); + + private: + int encode(Natural cell, reaction_id reaction){ + Natural rxn_id = static_cast(reaction); + return (cell*NUM_REACTIONS)+rxn_id; + } + + Minutes time_until_next_event () const; + +}; + +} +} + +#endif diff --git a/source/sim/stoch/modifiable_heap_random_selector.hpp b/source/sim/stoch/modifiable_heap_random_selector.hpp new file mode 100644 index 00000000..a538d9d4 --- /dev/null +++ b/source/sim/stoch/modifiable_heap_random_selector.hpp @@ -0,0 +1,195 @@ +#ifndef MODIFIABLE_HEAP_RANDOM_SELECTOR +#define MODIFIABLE_HEAP_RANDOM_SELECTOR + +#include +#include +#include +#include + +#include "completetree.hpp" +#include "heap.hpp" +#include "indexed_collection.hpp" +#include "weightsum_tree.hpp" + +namespace dense { +namespace stochastic { + +namespace { + enum class ignore_me{}; +} + + template < + typename I, size_t precision = std::numeric_limits::digits + > + class fast_random_selector : + //Extends a complete tree... + protected complete_tree< + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore_me>::type>::type, + I>::type, + std::tuple >, + + //... using the heap mix-in + protected heap< fast_random_selector, + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore_me>::type>::type, + I>::type >, + + //... and the weightsum tree mix-in + protected weightsum_tree< fast_random_selector, + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore_me>::type>::type, + I>::type, + precision>, + + //... AND the indexed collection mix-in + protected indexed_collection< fast_random_selector, + I, + typename std::conditional< std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, I, ignore_me>::type>::type, + I>::type, + std::tuple> + { + + private: + + template + using underlying_if_enum = typename std::conditional< + std::is_enum::value, + typename std::underlying_type< + typename std::conditional::value, E, ignore_me>::type + >::type, + E + >::type; + + public: + + using size_type = std::ptrdiff_t; + using index_type = I; + using This = fast_random_selector; + using node_type = underlying_if_enum; + using value_type = std::tuple; + using iterator = value_type*; + using const_iterator = value_type const*; + using reference = value_type&; + using const_reference = value_type const&; + using BaseTree = complete_tree; + using Heap = heap; + using WeightSum = weightsum_tree; + using Index = indexed_collection; + + friend Heap; + friend Index; + friend WeightSum; + + fast_random_selector() = delete; + + fast_random_selector(I max_size) : + BaseTree(max_size), + Heap(), + WeightSum(), + Index(max_size) + {} + + template + fast_random_selector(std::vector& weights) : + BaseTree(weights.size()), + Heap(), + WeightSum(), + Index(weights.size()) + { + for (unsigned int i = 0; i < weights.size(); i++) { + auto w = weights[i]; + //Heap::push will add entries through the add_entry method, which + // will create index associations + Heap::push(std::tuple(i, Real(w), 0.0)); + } + WeightSum::compute_weights(); + } + + fast_random_selector(fast_random_selector const&) = default; + + fast_random_selector(fast_random_selector &&) = default; + + fast_random_selector& operator=(fast_random_selector const&) = default; + + fast_random_selector& operator=(fast_random_selector &&) = default; + + ~fast_random_selector() = default; + + + //Methods of WeightSum we want to make available + template + index_type operator()(URNG& g) { + return id_of(WeightSum::operator()(g)); + } + + void update_weight(index_type i, Real new_weight) { + auto node = Index::node_for_index(i); + WeightSum::update_weight(Index::node_for_index(i), new_weight); + Heap::update_position(node); + } + + Real total_weight() const { return WeightSum::total_weight(); } + + private: + //Must call WeightSum::compute_weights() after this, before using random selection + void add_entry(value_type v) { + BaseTree::add_entry(v); + auto newp = BaseTree::last(); + Index::associate(id_of(newp), newp); + } + + Real& weight_of(node_type n) { + return std::get<1>(BaseTree::value_of(n)); + } + + const Real& weight_of(node_type n) const { + return const_cast(this)->weight_of(n); + } + + Real& weightsum_of(node_type n) { + return std::get<2>(BaseTree::value_of(n)); + } + + const Real& weightsum_of(node_type n) const { + return const_cast(this)->weightsum_of(n); + } + + void remove_last_entry() { + auto last = BaseTree::value_of(BaseTree::last()); + WeightSum::update_weight(BaseTree::last(), 0); + BaseTree::remove_last_entry(); + } + + fast_random_selector const& const_this() const { + return static_cast(*this); + } + + //Max-heap property + bool less(node_type a, node_type b) const { + return weight_of(a) > weight_of(b); + } + + void swap(node_type a, node_type b) { + std::swap(BaseTree::value_of(a).second, BaseTree::value_of(b).second); + WeightSum::swap(a, b); + Index::swap(a, b); + } + + void swap_with_child(node_type a, node_type b) { + Index::swap(a, b); + WeightSum::swap_with_child(a, b); + } + + index_type& id_of(node_type p) { return std::get<0>(BaseTree::value_of(p)); } + + }; +} +} + +#endif diff --git a/source/sim/stoch/next_reaction_simulation.cpp b/source/sim/stoch/next_reaction_simulation.cpp index 688a1365..74c155fd 100644 --- a/source/sim/stoch/next_reaction_simulation.cpp +++ b/source/sim/stoch/next_reaction_simulation.cpp @@ -46,7 +46,7 @@ Minutes Next_Reaction_Simulation::age_by (Minutes duration) { // 6. Go to step 2. } auto finish = std::chrono::high_resolution_clock::now(); - std::cout<< "reactions fired per second: "< next_reaction_pair = reaction_schedule.top(); std::pair pair_ids = decode(next_reaction_pair.first); - + fireReaction(pair_ids.first, pair_ids.second); reaction_schedule.pop(); // TODO: UPDATE, DON"T POP } @@ -120,7 +120,7 @@ void Next_Reaction_Simulation::tauLeap(){ void Next_Reaction_Simulation::fireOrSchedule(int cell, reaction_id rid){ delay_reaction_id dri = dense::model::getDelayReactionId(rid); - + if (dri!=NUM_DELAY_REACTIONS) { event_id rxn_id = encode(cell,rid); Minutes reaction_tau = Minutes{ Context(*this, cell).getDelay(dri)}; @@ -145,7 +145,7 @@ void Next_Reaction_Simulation::fireReaction(dense::Natural cell, reaction_id rid for (int i=0; i(i); - auto eid = encode(c, r); - auto tau = generateTau(propensities[c][r]); - reaction_schedule.emplace(eid, tau); - } - } + initTau(); } Real get_concentration (dense::Natural cell, specie_id species) const { @@ -171,32 +164,30 @@ class Next_Reaction_Simulation : public Simulation { */ CUDA_AGNOSTIC __attribute_noinline__ void update_propensities_and_taus(dense::Natural cell_, reaction_id rid) { + //rid just fired, so schedule a new time for it #define REACTION(name)\ + if (name == rid) { /* alpha == mu */\ + /* 5.a. update a_alpha (propensity) */\ + auto& a = propensities[cell_][name];\ + /* 5.c. generate a random number according to an exponential\ + distribution with parameter a_mu */\ + auto p = generateTau(a);\ + /* Set tau_alpha <- p + t */\ + auto tau_alpha = p + age();\ + /* 5.d. replace the old tau_alpha in P with the new value */\ + reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ + }\ for (std::size_t i=0; i< propensity_network[rid].size(); i++) { \ - if (name == rid) { /* alpha == mu */\ - /* 5.a. update a_alpha (propensity) */\ - auto& a = propensities[cell_][name];\ - auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, cell_)), Real{0}); \ - a = new_a;\ - /* 5.c. generate a random number according to an exponential\ - distribution with parameter a_mu */\ - auto p = generateTau(new_a);\ - /* Set tau_alpha <- p + t */\ - auto tau_alpha = p + age();\ - /* 5.d. replace the old tau_alpha in P with the new value */\ - reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ - } else if ( name == propensity_network[rid][i] ) { /* alpha != mu */\ - /* 5.a. update a_alpha (propensity) */\ - auto& a = propensities[cell_][name];\ - auto old_a = a;\ - auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, cell_)), Real{0});\ - a = new_a;\ - /* 5.b. set tau_alpha <- (a_alpha_old / a_alpha_new)(tau_alpha - t) + t */\ - auto tau_alpha = reaction_schedule.at(encode(cell_, name));\ - tau_alpha = (old_a / new_a)*(tau_alpha - age()) + age();\ - /* 5.d. replace the old tau_alpha in P with the new value */\ - reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ - } \ + /* 5.a. update a_alpha (propensity) */\ + auto& a = propensities[cell_][name];\ + auto old_a = a;\ + auto new_a = std::max(dense::model::reaction_##name.active_rate(Context(*this, cell_)), Real{0});\ + a = new_a;\ + /* 5.b. set tau_alpha <- (a_alpha_old / a_alpha_new)(tau_alpha - t) + t */\ + auto tau_alpha = reaction_schedule.at(encode(cell_, name));\ + tau_alpha = (old_a / new_a)*(tau_alpha - age()) + age();\ + /* 5.d. replace the old tau_alpha in P with the new value */\ + reaction_schedule.emplace(encode(cell_, name), tau_alpha);\ } \ for (std::size_t r=0; r< neighbor_propensity_network[rid].size(); r++) { \ if (name == neighbor_propensity_network[rid][r]) { \ @@ -237,10 +228,15 @@ class Next_Reaction_Simulation : public Simulation { Minutes age_by(Minutes duration); + std::vector get_perf(){ + return Simulation::get_performance(); + } + + private: Minutes time_until_next_event () const; - + event_id encode(Natural cell, reaction_id reaction){ Natural rxn_id = static_cast(reaction); return (cell*NUM_REACTIONS)+rxn_id; @@ -254,4 +250,6 @@ class Next_Reaction_Simulation : public Simulation { }; } } + #endif + diff --git a/source/sim/stoch/propensity_groups.hpp b/source/sim/stoch/propensity_groups.hpp new file mode 100644 index 00000000..9297d190 --- /dev/null +++ b/source/sim/stoch/propensity_groups.hpp @@ -0,0 +1,255 @@ +#ifndef PROPENSITY_GROUPS +#define PROPENSITY_GROUPS + +#include +#include "rxn_struct.hpp" +#include "rejection_based_simulation.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include +#include "random_selector.hpp" + +namespace dense { +namespace stochastic { + + class Propensity_Groups{ + public: + + Propensity_Groups() : chooser(1) { + }; + + void init_propensity_groups(std::vector& reactions){ + bool temp = false; + std::cout << "initializing \n"; + for(Rxn reaction : reactions){ + place_in_group(reaction, true, temp); + } + init_p_values(); + init_organized_groups(); + chooser = nonuniform_int_distribution(organized_p_values); + std::cout << "initialized \n"; + } + + + void update_groups( std::vector& old_reactions, std::vector& new_reactions){ + + for(size_t i = 0; i < old_reactions.size(); i++){ + + int current_group = group_index(old_reactions[i].get_index()); + int reaction_index = find_reaction_index(old_reactions[i]); + update_p_value(old_reactions[i], false); + if(reaction_index >= 0){ + if(groups[current_group].size() <= 1){ + groups[current_group].clear(); + }else{ + groups[current_group].erase(groups[current_group].begin()+reaction_index); + } + /* if(groups[current_group].empty()){ + * std::cout << "deleting group \n"; + * groups.erase(groups.begin() + current_group); + * std::cout << "deleting map element \n" <(organized_p_values); + } + + + + int get_minimal_group_l(std::default_random_engine& gen){ + + return organized_groups[chooser(gen)]; + } + + + std::vector get_group_at_index(int l){ return groups[group_index(l)];} + + + + Real get_p_naught(){ return p_naught;} + + private: + + std::vector group_map; + std::vector> groups; + std::vector p_values; + std::vector organized_groups; + std::vector organized_p_values; + Real p_naught; + nonuniform_int_distribution chooser; + + + + void place_in_group(Rxn reaction, bool initializing, bool& made_new_group) { + + const int p = reaction.get_index(); + const int current_group = group_index(p); + + if(initializing){ + (void)made_new_group; + } + + //Create new group + if(current_group == -1){ + if(!initializing){ + made_new_group = true; + } + std::vector to_insert; + to_insert.push_back(reaction); + groups.push_back(to_insert); + p_values.push_back(0.0); + group_map.push_back(p); + sort_groups(); + } + + //add to existing group + else { + groups[current_group].push_back(reaction); + if(!initializing){ + made_new_group = false; + } + } + } + + + + void init_p_values(){ + p_naught = 0; + for(size_t i = 0; i < groups.size(); i++){ + Real p_i = 0; + for(size_t j = 0; j = 0) && (organized_p_values[j] > p_val)){ + organized_p_values[j+1] = organized_p_values[j]; + organized_groups[j+1] = organized_groups[j]; + j = j - 1; + } + organized_p_values[j+1] = p_val; + organized_groups[j+1] = group; + i++; + } + } + + void sort_groups(){ + size_t i = 1; + while(i < groups.size()){ + int group_val = group_map[i]; + Real p_val = p_values[i]; + std::vector group = groups[i]; + int j = i - 1; + while((j >= 0) && (group_map[j] > group_val)){ + group_map[j+1] = group_map[j]; + p_values[j+1] = p_values[j]; + groups[j+1] = groups[j]; + j = j-1; + } + group_map[j+1] = group_val; + p_values[j+1] = p_val; + groups[j+1] = group; + i++; + } + } + void update_p_value(Rxn reaction, bool adding_to){ + int current_group = group_index(reaction.get_index()); + if(adding_to){ + p_values[current_group] += reaction.upper_bound; + p_naught += reaction.upper_bound; + update_organized_p_value(reaction.get_index(), p_values[current_group]); + } + else{ + p_values[current_group] -= reaction.upper_bound; + p_naught -= reaction.upper_bound; + update_organized_p_value(reaction.get_index(), p_values[current_group]); + } + } + + + + int group_index(int index){ + int s = group_map.size()-1; + int i = 0; + while(i <= s){ + int m = (s+i)/2; + if(group_map[m] == index){ + return m; + } + if(group_map[m] < index){ + i = m+1; + } + else if(group_map[m] > index){ + s = m-1; + } + } + return -1; + } + int find_reaction_index(Rxn reaction){ + int current_group = group_index(reaction.get_index()); + for(size_t i = 0; i < groups[current_group].size(); i++){ + if(groups[current_group][i] == reaction){ + return i; + } + } + std::cout << "reaction with bound " << reaction.upper_bound << " is not in group with index " << group_map[current_group] << '\n'; + return -1; + + } + }; + + + +} +} +#endif diff --git a/source/sim/stoch/propensity_groups1.hpp b/source/sim/stoch/propensity_groups1.hpp new file mode 100644 index 00000000..7acf1d25 --- /dev/null +++ b/source/sim/stoch/propensity_groups1.hpp @@ -0,0 +1,231 @@ +#ifndef PROPENSITY_GROUPS1 +#define PROPENSITY_GROUPS1 + +#include +#include "rxn_struct.hpp" +#include "rejection_based_simulation.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + + class Propensity_Groups{ + public: + + Propensity_Groups() = default; + + void init_propensity_groups(std::vector& reactions){ + for(Rxn reaction : reactions){ + place_in_group(reaction); + } + init_p_values(); + } + + + void update_groups( std::vector& old_reactions, std::vector& new_reactions){ + + for(size_t i = 0; i < old_reactions.size(); i++){ + update_p_value(old_reactions[i], false); + int current_group = group_index(old_reactions[i].get_index()); + int reaction_index = find_reaction_index(old_reactions[i]); + if(reaction_index >= 0){ + if(groups[current_group].size() <= 1){ + groups[current_group].clear(); + }else{ + groups[current_group].erase(groups[current_group].begin()+reaction_index); + } + /* if(groups[current_group].empty()){ + * std::cout << "deleting group \n"; + * groups.erase(groups.begin() + current_group); + * std::cout << "deleting map element \n" < test_factor){ + return i; + } + i++; + } + std::cout << "sum of p values is: " << sum_p_values << '\n' << + "text factor is: " << test_factor << '\n' << "this is not ok \n"; + return -1; + } + + + std::vector get_group_at_index(int l){ return groups[l];} + + int get_l_value(int index){ + return group_map[index]; + } + + + + Real get_p_naught(){ return p_naught;} + + private: + + std::vector group_map; + std::vector> groups; + std::vector p_values; + Real p_naught; + + + + void place_in_group(Rxn reaction) { + + const int p = reaction.get_index(); + + + const int current_group = group_index(p); + + //Create new group + if(current_group == -1){ + std::vector to_insert; + to_insert.push_back(reaction); + + if(group_map.size() == 0){ + group_map.push_back(p); + groups.push_back(to_insert); + p_values.push_back(0.0); + + } + else if(group_map.size() == 1){ + if(group_map[0] > p){ + group_map.insert(group_map.begin(), p); + groups.insert(groups.begin(), to_insert); + p_values.insert(p_values.begin(), 0.0); + } + else{ + + group_map.push_back(p); + groups.push_back(to_insert); + p_values.push_back(0.0); + } + } + + else{ + if( group_map[0] > p){ + group_map.insert(group_map.begin(), p); + groups.insert(groups.begin(), to_insert); + p_values.insert(p_values.begin(),0.0); + return; + } + else{ + for(size_t i = 0; i < group_map.size(); i++){ + if(i+1 < group_map.size()){ + if((group_map[i] < p) && (group_map[i+1] > p)){ + group_map.insert((group_map.begin()+i+1), p); + groups.insert((groups.begin()+i+1), to_insert); + p_values.insert((p_values.begin()+i+1),0.0); + return; + } + } else{ + group_map.push_back(p); + groups.push_back(to_insert); + p_values.push_back(0.0); + return; + } + } + } + } + } + + //add to existing group + else { + groups[current_group].push_back(reaction); + } + } + + + + void init_p_values(){ + p_naught = 0; + for(size_t i = 0; i < groups.size(); i++){ + int p_i = 0; + for(size_t j = 0; j index){ + s = m-1; + } + } + return -1; + } + + + int find_reaction_index(Rxn reaction){ + int current_group = group_index(reaction.get_index()); + for(size_t i = 0; i < groups[current_group].size(); i++){ + if(groups[current_group][i] == reaction){ + return i; + } + } + std::cout << "reaction with bound " << reaction.upper_bound << " is not in group with index " << group_map[current_group] << '\n'; + return -1; + + } + }; + + + +} +} +#endif \ No newline at end of file diff --git a/source/sim/stoch/random_selector.hpp b/source/sim/stoch/random_selector.hpp new file mode 100644 index 00000000..557272e2 --- /dev/null +++ b/source/sim/stoch/random_selector.hpp @@ -0,0 +1,60 @@ +#ifndef RANDOM_SELECTOR +#define RANDOM_SELECTOR +#include "completetree.hpp" +#include "weightsum_tree.hpp" +#include "utility/numerics.hpp" +#include +#include +#include + +namespace dense { +namespace stochastic { + + +//Class to randomly select an index where each index's probability of being +// selected is weighted by a given vector. +template ::digits> +class nonuniform_int_distribution : protected complete_tree >, + public weightsum_tree, IntType, precision> { + public: + using This = nonuniform_int_distribution; + using BaseTree = complete_tree >; + using WeightSum = weightsum_tree; + friend WeightSum; + using PosType = typename BaseTree::position_type; + static PosType left_of(PosType i) { return BaseTree::left_of(i);} + static PosType right_of(PosType i) { return BaseTree::right_of(i);} + static PosType parent_of(PosType i) { return BaseTree::parent_of(i);} + + //Weights can be of any type, but most be convertable to Real values + nonuniform_int_distribution() = delete; + nonuniform_int_distribution(PosType p) : BaseTree(p), WeightSum(*this) {}; + + template + nonuniform_int_distribution(std::vector& weights) : + BaseTree(weights.size()), + WeightSum(*this) + { + for (auto w : weights) { + BaseTree::emplace_entry(w, 0.0); + } + WeightSum::compute_weights(); + } + + Real& weight_of(PosType p) { + return BaseTree::value_of(p).first; + } + Real& weightsum_of(PosType p) { + return BaseTree::value_of(p).second; + } + const Real& weightsum_of(PosType p) const { + return const_cast(this)->weightsum_of(p); + } + + PosType id_of(PosType p) { return p; } + +}; + +} +} +#endif diff --git a/source/sim/stoch/rejection_based_simulation.cpp b/source/sim/stoch/rejection_based_simulation.cpp new file mode 100644 index 00000000..616c1d29 --- /dev/null +++ b/source/sim/stoch/rejection_based_simulation.cpp @@ -0,0 +1,338 @@ +#include +#include "rejection_based_simulation.hpp" +#include "rxn_struct.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include "propensity_groups.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Rejection_Based_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Rejection_Based_Simulation::age_by(Minutes duration){ + auto end_time = age() + duration; + auto start = std::chrono::high_resolution_clock::now(); + Simulation::step(true); + while(age() < end_time){ + auto min_group_index = propensity_groups.get_minimal_group_l(generator); + bool reaction_fired = false; + std::vector> changed_species; + bool all_delays_fired = false; + Rxn reaction_to_be_fired; + while(!reaction_fired){ + auto r_2 = getRandVariable(); + Minutes tau = Minutes{(-1/propensity_groups.get_p_naught())*(std::log(r_2))}; + all_delays_fired = fire_delay_reactions(tau); + if(all_delays_fired){ + reaction_fired = rejection_tests(reaction_to_be_fired, min_group_index); + if(reaction_fired){ + schedule_or_fire_reaction(reaction_to_be_fired); + } + Simulation::age_by(tau); + }else{ + reaction_fired = true; + } + } + if(all_delays_fired){ + if(check_bounds(changed_species, reaction_to_be_fired)){ + update_bounds(changed_species); + } + } + } + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); +} + + + +void Rejection_Based_Simulation::schedule_or_fire_reaction(Rxn& rxn){ + Delay_Rxn delay_reaction; + delay_reaction.rxn = rxn; + delay_reaction.delay_reaction = dense::model::getDelayReactionId(rxn.reaction); + if(delay_reaction.delay_reaction != NUM_DELAY_REACTIONS){ + delay_reaction.delay =( age() + Minutes{Context(*this, delay_reaction.rxn.cell).getDelay(delay_reaction.delay_reaction)}); + delay_schedule.push(delay_reaction); + } + else{ + fire_reaction(rxn); + } + +} + +void Rejection_Based_Simulation::fire_reaction(Rxn& rxn){ + const reaction_base& rn = dense::model::getReaction(rxn.reaction); + const specie_id* specie_deltas = rn.getSpecieDeltas(); + Simulation::step(false); + for(int i = 0; i < rn.getNumDeltas(); i++){ + update_concentration(rxn.cell, specie_deltas[i], rn.getDeltas()[i]); + } +} + +void Rejection_Based_Simulation::init_bounds() { + for(int i = 0; i temp_lower_bounds; + std::vector temp_upper_bounds; + + for(size_t j = 0; j < NUM_SPECIES; j++){ + Real lower; + Real upper; + if(concs[i][j] >= (y/delta) || concs[i][j] <= y){ + lower = concs[i][j]*(1-delta); + upper = concs[i][j]*(1+delta); + } + else{ + lower = concs[i][j] - y; + upper = concs[i][j] + y; + } + temp_lower_bounds.push_back(std::max(0.0,lower)); + temp_upper_bounds.push_back(std::max(0.0, upper)); + } + concentration_bounds[0].push_back(temp_lower_bounds); + concentration_bounds[1].push_back(temp_upper_bounds); + ConcentrationContext lower_context(concentration_bounds[0][i], *this, i); + ConcentrationContext upper_context(concentration_bounds[1][i], *this, i); + + + Rxn rxn; + #define REACTION(name) \ + rxn.reaction = name; \ + rxn.cell = i; \ + rxn.lower_bound = std::max(0.0,dense::model::reaction_##name.active_rate(lower_context)); \ + rxn.upper_bound = std::max(0.0,dense::model::reaction_##name.active_rate(upper_context)); \ + reactions.push_back(rxn); + #include "reactions_list.hpp" + #undef REACTION + } + } + + + +void Rejection_Based_Simulation::init_dependancy_graph(){ + + std::vector neighbor_dependencies[NUM_REACTIONS]; + std::vector dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::vector& neighbordeps_tofill,std::vector& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.push_back(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.push_back(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.push_back(sp); + return 0.0; + }; + private: + std::vector& interdeps_tofill; + std::vector& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + for(int i = 0; i < NUM_REACTIONS; i++){ + for( auto s : dependencies[i]){ + depends_on_species[s].push_back((reaction_id)i); + depends_on_reaction[i].push_back(s); + } + for(auto s : neighbor_dependencies[i]){ + depends_on_neighbor_species[s].push_back((reaction_id)i); + } + } +} + + + +bool Rejection_Based_Simulation::fire_delay_reactions(Minutes tau){ + if(!delay_schedule.empty()){ + Minutes delay_count = Minutes{0}; + while(delay_schedule.top().delay < age() + tau){ + auto reaction = delay_schedule.top(); + delay_schedule.pop(); + fire_reaction(reaction.rxn); + delay_count += (reaction.delay- age()); + std::vector> changed; + if(check_bounds(changed, reaction.rxn)){ + Simulation::age_by(delay_count); + update_bounds(changed); + return false; + } + } + } + return true; +} + +bool Rejection_Based_Simulation::rejection_tests(Rxn& rxn, int min_group_index){ + auto min_group = propensity_groups.get_group_at_index(min_group_index); + auto min_group_l_value = min_group_index; + Real two_power = pow(2,min_group_l_value); + bool mu_found = false; + int mu; + while(!mu_found){ + Real r_2 = getRandVariable(); + mu = (int)(min_group.size() * r_2); + + #define DOUBLE_PRECISION_VARIABLE + #ifdef DOUBLE_PRECISION_VARIABLE + Real r_3 = (min_group.size() * r_2) -mu; + + #else + + Real r_3 = getRandVariable(); + #endif + #undef DOUBLE_PRECISION_VARIABLE + if(r_3 <= (min_group[mu].upper_bound/(two_power+1))){ + mu_found = true; + } + } + Real r_4 = getRandVariable(); + Rxn reaction = min_group.at(mu); + bool accepted = false; + + + if(r_4 <= reaction.lower_bound/reaction.upper_bound){ + + accepted = true; + + } + else { + auto propensity = get_real_propensity(reaction); + if(r_4 <= propensity/reaction.upper_bound){ + accepted = true; + } + + } + + if(accepted){ + rxn = reaction; + } + else{ + (void)rxn; + } + + return accepted; +} + + +Real Rejection_Based_Simulation::get_real_propensity(Rxn rxn){ + return std::max(dense::model::active_rate(rxn.reaction, Context(*this, rxn.cell)), Real{0}); +} + +bool Rejection_Based_Simulation::check_bounds(std::vector>& changed_species, Rxn fired_reaction){ + bool changed = false; + std::vector> new_concs; + dense::Natural c = fired_reaction.cell; + for(auto r : depends_on_reaction[fired_reaction.reaction]){ + if(concs[c][r] < concentration_bounds[0][c][r] || concs[c][r] > concentration_bounds[1][c][r]){ + auto new_pair = std::pair(c,r); + new_concs.push_back(new_pair); + if(!changed){ + changed = true; + } + } + } + if(changed){ + changed_species = new_concs; + } + return changed; +} + +//finish +void Rejection_Based_Simulation::update_bounds(std::vector>& to_update){ + + std::vector old_reactions; + std::vector new_reactions; + + for(std::pair specie : to_update){ + + int current_conc = concs[specie.first][specie.second]; + Real lower; + Real upper; + if(current_conc >= (y/delta) || current_conc <= y){ + upper = current_conc*(1+delta); + lower = current_conc*(1-delta); + } + else{ + upper = current_conc + y; + lower = current_conc - y; + + } + concentration_bounds[0][specie.first][specie.second] = std::max(0.0,lower); + concentration_bounds[1][specie.first][specie.second] = std::max(0.0,upper); + int begin_bounds = specie.first*NUM_REACTIONS; + for(reaction_id r : depends_on_species[specie.second]){ + Rxn old_reaction = reactions[begin_bounds+r]; + Rxn new_reaction; + new_reaction.cell = old_reaction.cell; + new_reaction.reaction = old_reaction.reaction; + ConcentrationContext lower_context(concentration_bounds[0][specie.first], *this, specie.first); + ConcentrationContext upper_context(concentration_bounds[1][specie.first], *this, specie.first); + new_reaction.lower_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, lower_context)); + new_reaction.upper_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, upper_context)); + if(!((old_reaction.upper_bound == new_reaction.upper_bound)&& (old_reaction.lower_bound == new_reaction.lower_bound))){ + reactions[begin_bounds+r] = new_reaction; + old_reactions.push_back(old_reaction); + new_reactions.push_back(new_reaction); + } + } + for(reaction_id r : depends_on_neighbor_species[specie.second]){ + for(dense::Natural c = 0; c < neighbor_count_by_cell_[specie.first]; c++){ + Rxn old_reaction = reactions[begin_bounds+r]; + Rxn new_reaction; + new_reaction.cell = neighbors_by_cell_[specie.first][c]; + new_reaction.reaction = old_reaction.reaction; + ConcentrationContext lower_context(concentration_bounds[0][specie.first], *this, specie.first); + ConcentrationContext upper_context(concentration_bounds[1][specie.first],*this, specie.first); + new_reaction.lower_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, lower_context)); + new_reaction.upper_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, upper_context)); + int cell_reaction = (neighbors_by_cell_[old_reaction.cell][c]*NUM_REACTIONS)+r; + if(!((old_reaction.upper_bound == new_reaction.upper_bound)&& (old_reaction.lower_bound == new_reaction.lower_bound))){ + reactions[cell_reaction] = new_reaction; + old_reactions.push_back(old_reaction); + new_reactions.push_back(new_reaction); + } + } + } + } + propensity_groups.update_groups(old_reactions, new_reactions); +} + + +Real Rejection_Based_Simulation::getRandVariable(){ + return distribution_(generator); +} + + + + + +} +} diff --git a/source/sim/stoch/rejection_based_simulation.hpp b/source/sim/stoch/rejection_based_simulation.hpp new file mode 100644 index 00000000..aa71b963 --- /dev/null +++ b/source/sim/stoch/rejection_based_simulation.hpp @@ -0,0 +1,189 @@ +#ifndef REJECTION_BASED_SIMULATION_HPP +#define REJECTION_BASED_SIMULATION_HPP + +#include "sim/base.hpp" +#include "core/parameter_set.hpp" +#include "core/model.hpp" +#include "core/specie.hpp" +#include "sim/cell_param.hpp" +#include "core/reaction.hpp" +#include "propensity_groups.hpp" +#include +#include +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * Anderson_Next_Reaction_Simulation + * uses the Next Reaction Algorithm +*/ +class Rejection_Based_Simulation : public Simulation { +public: + + using Context = dense::Context; + + using event_id = dense::Natural; + + using SpecieRates = CUDA_Array; + +private: + //"concs" contains the current concentration of each species in every cell + std::vector> concs; + + //"concentration_bounds" contains the current concentration bounds (std::pair)of each species in every cell. Array row 0 is lower bounds, array row 1 is upper bounds. + std::vector> concentration_bounds[2]; + + //"reaction_propensity_bounds" keeps track of the current propensity bounds(std::pair) of ech reaction in every cell + std::vector reactions; + + //"depends_on_species" keeps track of which reactions are affected by a change in concentraion of a species in its own cell + std::vector depends_on_species[NUM_SPECIES]; + + + //"depends_on_neighbor_species" keeps track of which reactions are affected by a change in concentraion of a species in a neighboring cell + std::vector depends_on_neighbor_species[NUM_SPECIES]; + + //"depends_on_reaction" is a dependency graph that shows which specie concentrations are affected by a given reaction firing + + std::vector depends_on_reaction[NUM_REACTIONS]; + + //"propensity_groups" is the partitions of all reactions based on their propensities + Propensity_Groups propensity_groups; + + //"delay_schedule" keeps track of all delay reactions scheduled to fire + std::priority_queue,std::greater> delay_schedule; + + std::default_random_engine generator; + + double delta; + + int y; + + + + static std::uniform_real_distribution distribution_; + + void init_bounds(); + // + void init_dependancy_graph(); + // + bool fire_delay_reactions(Minutes tau); + // + bool rejection_tests( Rxn& rxn,int min_group_index); + // + void schedule_or_fire_reaction(Rxn& next_reaction); + // + void fire_reaction(Rxn& rxn); + // + bool check_bounds(std::vector>& changed_species, Rxn fired_reaction); + // + void update_bounds(std::vector>& to_update); + // + Real get_real_propensity(Rxn rxn); + // + Real getRandVariable(); +public: + + + + + Rejection_Based_Simulation(const Parameter_Set& ps, Real* pnFactorsPert, Real** pnFactorsGrad, int seed, std::vector conc, NGraph::Graph adj_graph) : Simulation(ps, std::move(adj_graph), pnFactorsPert, pnFactorsGrad) + , concs(cell_count(), conc) + , delay_schedule() + , generator(seed){ + init_bounds(); + propensity_groups.init_propensity_groups(reactions); + init_dependancy_graph(); + } + + Rejection_Based_Simulation(const Parameter_Set& ps, Real* pnFactorsPert, Real** pnFactorsGrad, int seed, std::vector conc, NGraph::Graph adj_graph, double d, int yval) : Simulation(ps, std::move(adj_graph), pnFactorsPert, pnFactorsGrad) + , concs(cell_count(), conc) + , delay_schedule() + , generator(seed) + , delta(d) + , y(yval){ + init_bounds(); + propensity_groups.init_propensity_groups(reactions); + init_dependancy_graph(); + } + + Real get_concentration(dense::Natural cell, specie_id species) const { + return concs.at(cell).at(species); + } + + Real get_concentration(dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + return get_concentration(cell, species); + } + + void update_concentration(dense::Natural cell_, specie_id sid, int delta){ + auto& concentration = concs[cell_][sid]; + concentration = std::max(concentration +delta, 0); + } + + + Minutes age_by(Minutes duration); + + Real calculate_neighbor_average (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + Real sum = 0; + for (dense::Natural i = 0; i < neighbor_count_by_cell_[cell]; ++i) { + sum += concs[neighbors_by_cell_[cell][i]][species]; + } + return sum / neighbor_count_by_cell_[cell]; + } + + std::vector get_perf(){ + return Simulation::get_performance(); + } + +private: + //"event" represents a delayed reaction scheduled to fire later + struct event { + Minutes time; + Minutes cell; + reaction_id reaction; + friend bool operator<( const event& a, const event& b){return a.time < b.time;} + friend bool operator>(const event& a, const event& b){ return b < a;} + }; + + + + + + +}; + + + +class ConcentrationContext { + public: + ConcentrationContext(std::vector concentrations, Rejection_Based_Simulation& sim, Natural cell) : + concs(concentrations), ctxt(sim, cell) {}; + Real getCon(specie_id specie, int = 0) const { + return concs.at(specie); + } + Real getCon(specie_id specie){ + return concs.at(specie); + } + Real getRate(reaction_id reaction) const { return ctxt.getRate(reaction);}; + Real getDelay(delay_reaction_id reaction) const { return ctxt.getDelay(reaction); } + Real getCritVal(critspecie_id reaction) const { return ctxt.getCritVal(reaction); } + Real calculateNeighborAvg(specie_id sp, int = 0) const { + (void)sp; + return 0.0; + } + private: + + std::vector concs; + Context ctxt; + }; + +} +} +#endif diff --git a/source/sim/stoch/rxn_struct.hpp b/source/sim/stoch/rxn_struct.hpp new file mode 100644 index 00000000..c0ec32c5 --- /dev/null +++ b/source/sim/stoch/rxn_struct.hpp @@ -0,0 +1,38 @@ +#ifndef RXN_STRUCT +#define RXN_STRUCT +#include +#include "rxn_struct.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense{ +namespace stochastic{ +struct Rxn { + dense::Natural cell; + reaction_id reaction; + Real upper_bound; + Real lower_bound; + friend bool operator==(const Rxn& a, const Rxn& b){ return (a.cell == b.cell && a.reaction == b.reaction);} + friend bool operator<(const Rxn& a, const Rxn& b){return (a.upper_bound < b.upper_bound);} + friend bool operator> (const Rxn& a, const Rxn& b){return (b < a);} + friend bool operator<=(const Rxn& a, const Rxn& b){return((a < b) || (a.upper_bound == b.upper_bound)); } + + int get_index() {if(upper_bound == 0) {return 0;} else{return (int)(std::log2(upper_bound));}} + +}; + +struct Delay_Rxn { + Rxn rxn; + delay_reaction_id delay_reaction; + Minutes delay; + friend bool operator<(const Delay_Rxn& a, const Delay_Rxn b){return a.delay < b.delay;} + friend bool operator>(const Delay_Rxn& a, const Delay_Rxn b){return b < a;} +}; +} +} +#endif \ No newline at end of file diff --git a/source/sim/stoch/set_cuda.hpp b/source/sim/stoch/set_cuda.hpp new file mode 100644 index 00000000..648baef0 --- /dev/null +++ b/source/sim/stoch/set_cuda.hpp @@ -0,0 +1,335 @@ +#include +#include "rejection_based_simulation.hpp" +#include "rxn_struct.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include "propensity_groups.hpp" +#include +#include +#include +#include + +namespace dense { +namespace stochastic { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Rejection_Based_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Rejection_Based_Simulation::age_by(Minutes duration){ + auto end_time = age() + duration; + while(age() < end_time){ + auto r_1 = getRandVariable(); + auto min_group_index = propensity_groups.get_minimal_group_index(r_1); + bool reaction_fired = false; + std::vector> changed_species; + bool all_delays_fired = false; + while(!reaction_fired){ + auto r_2 = getRandVariable(); + Minutes tau = Minutes{(-1/propensity_groups.get_p_naught())*(std::log(r_2))}; + all_delays_fired = fire_delay_reactions(tau); + if(all_delays_fired){ + Rxn reaction_to_be_fired; + reaction_fired = rejection_tests(reaction_to_be_fired, min_group_index); + if(reaction_fired){ + schedule_or_fire_reaction(reaction_to_be_fired); + } + Simulation::age_by(tau); + }else{ + reaction_fired = true; + } + } + if(all_delays_fired){ + if(check_bounds(changed_species)){ + update_bounds(changed_species); + } + } + } + return age(); +} + + + +void Rejection_Based_Simulation::schedule_or_fire_reaction(Rxn& rxn){ + Delay_Rxn delay_reaction; + delay_reaction.rxn = rxn; + delay_reaction.delay_reaction = dense::model::getDelayReactionId(rxn.reaction); + if(delay_reaction.delay_reaction != NUM_DELAY_REACTIONS){ + delay_reaction.delay =( age() + Minutes{Context(*this, delay_reaction.rxn.cell).getDelay(delay_reaction.delay_reaction)}); + delay_schedule.push(delay_reaction); + } + else{ + fire_reaction(rxn); + } + +} + +void Rejection_Based_Simulation::fire_reaction(Rxn& rxn){ + const reaction_base& rn = dense::model::getReaction(rxn.reaction); + const specie_id* specie_deltas = rn.getSpecieDeltas(); + for(int i = 0; i < rn.getNumDeltas(); i++){ + update_concentration(rxn.cell, specie_deltas[i], rn.getDeltas()[i]); + } +} + +void Rejection_Based_Simulation::init_bounds() { + for(int i = 0; i temp_lower_bounds; + std::vector temp_upper_bounds; + + for(size_t j = 0; j < NUM_SPECIES; j++){ + Real lower; + Real upper; + if(concs[i][j] >= (y/delta) || concs[i][j] <= y){ + lower = concs[i][j]*(1-delta); + upper = concs[i][j]*(1+delta); + } + else{ + lower = concs[i][j] - y; + upper = concs[i][j] + y; + } + temp_lower_bounds.push_back(std::max(0.0,lower)); + temp_upper_bounds.push_back(std::max(0.0, upper)); + } + concentration_bounds[0].push_back(temp_lower_bounds); + concentration_bounds[1].push_back(temp_upper_bounds); + ConcentrationContext lower_context(concentration_bounds[0][i], *this, i); + ConcentrationContext upper_context(concentration_bounds[1][i], *this, i); + + + Rxn rxn; + #define REACTION(name) \ + rxn.reaction = name; \ + rxn.cell = i; \ + rxn.lower_bound = std::max(0.0,dense::model::reaction_##name.active_rate(lower_context)); \ + rxn.upper_bound = std::max(0.0,dense::model::reaction_##name.active_rate(upper_context)); \ + reactions.push_back(rxn); + #include "reactions_list.hpp" + #undef REACTION + } + } + + + +void Rejection_Based_Simulation::init_dependancy_graph(){ + + std::vector neighbor_dependencies[NUM_REACTIONS]; + std::vector dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::vector& neighbordeps_tofill,std::vector& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.push_back(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.push_back(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.push_back(sp); + return 0.0; + }; + private: + std::vector& interdeps_tofill; + std::vector& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + for(int i = 0; i < NUM_REACTIONS; i++){ + for( auto s : dependencies[i]){ + depends_on_species[s].push_back((reaction_id)i); + } + for(auto s : neighbor_dependencies[i]){ + depends_on_neighbor_species[s].push_back((reaction_id)i); + } + } +} + + + +bool Rejection_Based_Simulation::fire_delay_reactions(Minutes tau){ + if(!delay_schedule.empty()){ + Minutes delay_count = Minutes{0}; + while(delay_schedule.top().delay < age() + tau){ + auto reaction = delay_schedule.top(); + delay_schedule.pop(); + fire_reaction(reaction.rxn); + delay_count += (reaction.delay- age()); + std::vector> changed; + if(check_bounds(changed)){ + Simulation::age_by(delay_count); + update_bounds(changed); + return false; + } + } + } + return true; +} + +bool Rejection_Based_Simulation::rejection_tests(Rxn& rxn, int min_group_index){ + auto min_group = propensity_groups.get_group_at_index(min_group_index); + auto min_group_l_value = propensity_groups.get_l_value(min_group_index); + Real two_power = pow(2,min_group_l_value); + bool mu_found = false; + int mu; + while(!mu_found){ + Real r_2 = getRandVariable(); + mu = (int)(min_group.size() * r_2); + + #define DOUBLE_PRECISION_VARIABLE + #ifdef DOUBLE_PRECISION_VARIABLE + Real r_3 = (min_group.size() * r_2) -mu; + + #else + + Real r_3 = getRandVariable(); + #endif + #undef DOUBLE_PRECISION_VARIABLE + if(r_3 <= (min_group[mu].upper_bound/two_power)){ + mu_found = true; + } + } + Real r_4 = getRandVariable(); + Rxn reaction = min_group.at(mu); + bool accepted = false; + + + if(r_4 <= reaction.lower_bound/reaction.upper_bound){ + + accepted = true; + + } + else { + auto propensity = get_real_propensity(reaction); + if(r_4 <= propensity/reaction.upper_bound){ + accepted = true; + } + + } + + if(accepted){ + rxn = reaction; + } + else{ + (void)rxn; + } + + return accepted; +} + + +Real Rejection_Based_Simulation::get_real_propensity(Rxn rxn){ + return std::max(dense::model::active_rate(rxn.reaction, Context(*this, rxn.cell)), Real{0}); +} + +bool Rejection_Based_Simulation::check_bounds(std::vector>& changed_species){ + bool changed = false; + std::vector> new_concs; + + for(dense::Natural c = 0; c < cell_count(); c++){ + for(dense::Natural r = 0; r < NUM_SPECIES; r++){ + if(concs[c][r] < concentration_bounds[0][c][r] || concs[c][r] > concentration_bounds[1][c][r]){ + auto new_pair = std::pair(c,r); + new_concs.push_back(new_pair); + if(!changed){ + changed = true; + } + } + } + } + if(changed){ + changed_species = new_concs; + } + return changed; +} + +//finish +void Rejection_Based_Simulation::update_bounds(std::vector>& to_update){ + + std::vector old_reactions; + std::vector new_reactions; + + for(std::pair specie : to_update){ + + int current_conc = concs[specie.first][specie.second]; + Real lower; + Real upper; + if(current_conc >= (y/delta) || current_conc <= y){ + upper = current_conc*(1+delta); + lower = current_conc*(1-delta); + } + else{ + upper = current_conc + y; + lower = current_conc - y; + + } + concentration_bounds[0][specie.first][specie.second] = std::max(0.0,lower); + concentration_bounds[1][specie.first][specie.second] = std::max(0.0,upper); + int begin_bounds = specie.first*NUM_REACTIONS; + for(reaction_id r : depends_on_species[specie.second]){ + Rxn old_reaction = reactions[begin_bounds+r]; + Rxn new_reaction; + new_reaction.cell = old_reaction.cell; + new_reaction.reaction = old_reaction.reaction; + ConcentrationContext lower_context(concentration_bounds[0][specie.first], *this, specie.first); + ConcentrationContext upper_context(concentration_bounds[1][specie.first], *this, specie.first); + new_reaction.lower_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, lower_context)); + new_reaction.upper_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, upper_context)); + if(!((old_reaction.upper_bound == new_reaction.upper_bound)&& (old_reaction.lower_bound == new_reaction.lower_bound))){ + reactions[begin_bounds+r] = new_reaction; + old_reactions.push_back(old_reaction); + new_reactions.push_back(new_reaction); + } + } + for(reaction_id r : depends_on_neighbor_species[specie.second]){ + for(dense::Natural c = 0; c < neighbor_count_by_cell_[specie.first]; c++){ + Rxn old_reaction = reactions[begin_bounds+r]; + Rxn new_reaction; + new_reaction.cell = neighbors_by_cell_[specie.first][c]; + new_reaction.reaction = old_reaction.reaction; + ConcentrationContext lower_context(concentration_bounds[0][specie.first], *this, specie.first); + ConcentrationContext upper_context(concentration_bounds[1][specie.first],*this, specie.first); + new_reaction.lower_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, lower_context)); + new_reaction.upper_bound = std::max(0.0,dense::model::active_rate(new_reaction.reaction, upper_context)); + int cell_reaction = (neighbors_by_cell_[old_reaction.cell][c]*NUM_REACTIONS)+r; + if(!((old_reaction.upper_bound == new_reaction.upper_bound)&& (old_reaction.lower_bound == new_reaction.lower_bound))){ + reactions[cell_reaction] = new_reaction; + old_reactions.push_back(old_reaction); + new_reactions.push_back(new_reaction); + } + } + } + } + propensity_groups.update_groups(old_reactions, new_reactions); +} + + +Real Rejection_Based_Simulation::getRandVariable(){ + return distribution_(generator); +} + + + + + +} +}rejectio \ No newline at end of file diff --git a/source/sim/stoch/sorting_direct_simulation.cpp b/source/sim/stoch/sorting_direct_simulation.cpp new file mode 100644 index 00000000..eb0ca82e --- /dev/null +++ b/source/sim/stoch/sorting_direct_simulation.cpp @@ -0,0 +1,256 @@ +#include +#include "sorting_direct_simulation.hpp" +#include "sim/cell_param.hpp" +#include "model_impl.hpp" +#include "core/model.hpp" +#include +#include +#include +#include + +namespace dense { + +/* + * SIMULATE + * main simulation loop + * notifies observers + * precondition: t=0 + * postcondition: ti>=time_total +*/ + +std::uniform_real_distribution Sorting_Direct_Simulation::distribution_ = std::uniform_real_distribution{0.0, 1.0}; + +CUDA_AGNOSTIC +Minutes Sorting_Direct_Simulation::age_by (Minutes duration) { + auto start = std::chrono::high_resolution_clock::now(); + Simulation::step(true); + auto end_time = age() + duration; + while (age() < end_time) { + Minutes tau, t_until_event; + tau = generateTau(); + /* + while ((tau = generateTau()) > (t_until_event = time_until_next_event())) { + Simulation::age_by(t_until_event); + executeDelayRXN(); + if (age() >= end_time) return age(); + } + */ + if(end_time < (age() + tau)){ + Minutes diff = end_time - age(); + Simulation::age_by(diff); + return age(); + } + tauLeap(); + Simulation::age_by(tau); + } + auto finish = std::chrono::high_resolution_clock::now(); + Simulation::push_performance(finish - start); + return age(); +} + +/* + * GENERATETAU + * return "tau": possible timestep leap calculated from a random variable +*/ +Minutes Sorting_Direct_Simulation::generateTau() { + auto r = getRandVariable(); + auto log_inv_r = -std::log(r); + + return Minutes{ log_inv_r / get_total_propensity() }; +} + +/* + * GETSOONESTDELAY + * return "dTime": the time that the next scheduled delay reaction will fire + * if no delay reaction is scheduled, the maximum possible float is returned +*/ +/* +Minutes Sorting_Direct_Simulation::getSoonestDelay() const { + return event_schedule.empty() ? + Minutes{ std::numeric_limits::infinity() } : + event_schedule.top().time; +} + +Minutes Sorting_Direct_Simulation::time_until_next_event() const { + return getSoonestDelay() - age(); +} +*/ + +/* + * EXECUTEDELAYRXN + * calls fireReaction for the next scheduled delay reaction + * precondition: a delay reaction is scheduled + * postcondition: the soonest scheduled delay reaction is removed from the schedule +*/ +/* +void Sorting_Direct_Simulation::executeDelayRXN() { + event delay_rxn = event_schedule.top(); + fireReaction(delay_rxn.cell, delay_rxn.rxn); + event_schedule.pop(); +} +*/ + +/* + * GETRANDVARIABLE + * return "u": a random variable between 0.0 and 1.0 +*/ + +Real Sorting_Direct_Simulation::getRandVariable() { + return distribution_(generator); +} + +/* + * TAULEAP + * chooses a reaction to fire or schedule and moves forward in time + * arg "tau": timestep to leap forward by +*/ +void Sorting_Direct_Simulation::tauLeap(){ + + Real propensity_portion = getRandVariable() * get_total_propensity(); + + int RSOIndex = choose_reaction(propensity_portion); + int j = RSO[RSOIndex]; + int r = j % NUM_REACTIONS; + int c = j / NUM_REACTIONS; + + fireOrSchedule(c,(reaction_id)r); + if (RSOIndex != 0) { + auto Temp = RSO[RSOIndex]; + RSO[RSOIndex] = RSO[RSOIndex - 1]; + RSO[RSOIndex] = Temp; + } +} + +/* + * FIREORSCHEDULE + * fires or schedules a reaction firing in a specific cell + * arg "c": the cell that the reaction takes place in + * arg "rid": the reaction to fire or schedule +*/ +void Sorting_Direct_Simulation::fireOrSchedule(int cell, reaction_id rid){ + /* + delay_reaction_id dri = dense::model::getDelayReactionId(rid); + + if (dri!=NUM_DELAY_REACTIONS) { + event_schedule.push({ age() + Minutes{ Context(*this, cell).getDelay(dri) }, cell, rid }); + } + else { + fireReaction(cell, rid); + } + */ + fireReaction(cell, rid); +} + +/* + * FIREREACTION + * fires a reaction by properly decrementing and incrementing its inputs and outputs + * arg "*c": pointer to a context of the cell to fire the reaction in + * arg "rid": reaction to fire +*/ +void Sorting_Direct_Simulation::fireReaction(dense::Natural cell, reaction_id rid){ + Simulation::step(false); + const reaction_base& r = dense::model::getReaction(rid); + const specie_id* specie_deltas = r.getSpecieDeltas(); + for (int i=0; i neighbor_dependencies[NUM_REACTIONS]; + std::set dependencies[NUM_REACTIONS]; + + class DependanceContext { + public: + DependanceContext(std::set& neighbordeps_tofill,std::set& deps_tofill) : + interdeps_tofill(neighbordeps_tofill), intradeps_tofill(deps_tofill) {}; + Real getCon(specie_id sp, int = 0) const { + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getCon(specie_id sp){ + intradeps_tofill.insert(sp); + return 0.0; + }; + Real getRate(reaction_id) const { return 0.0; }; + Real getDelay(delay_reaction_id) const { return 0.0; }; + Real getCritVal(critspecie_id) const { return 0.0; }; + Real calculateNeighborAvg(specie_id sp, int = 0) const { + interdeps_tofill.insert(sp); + return 0.0; + }; + private: + std::set& interdeps_tofill; + std::set& intradeps_tofill; + }; + + #define REACTION(name) \ + const reaction& r##name = dense::model::reaction_##name; \ + r##name.active_rate( DependanceContext (neighbor_dependencies[name],dependencies[name])); + #include "reactions_list.hpp" + #undef REACTION + + #define REACTION(name) \ + for (dense::Natural n=0; n& intradeps = dependencies[n]; \ + const std::set& interdeps = neighbor_dependencies[n]; \ + std::set::iterator intra = intradeps.begin(); \ + std::set::iterator inter = interdeps.begin(); \ + bool intraRelated = false; \ + bool interRelated = false; \ + for (std::size_t in=0; in +#include +#include +#include + +namespace dense { + +/* + * STOCHASTIC SIMULATOR: + * superclasses: simulation_base, Observable + * uses Gillespie's tau leaping algorithm + * uses Barrio's delay SSA +*/ +class Sorting_Direct_Simulation : public Simulation { + +public: + + using Context = dense::Context; + + private: + + //"event" represents a delayed reaction scheduled to fire later + struct event { + Minutes time; + Natural cell; + reaction_id rxn; + friend bool operator<(event const& a, event const &b) { return a.time < b.time;} + friend bool operator>(event const& a, event const& b) { return b < a; } + }; + + /* + //"event_schedule" is a set ordered by time of delay reactions that will fire + std::priority_queue, std::greater> event_schedule; + */ + + //"RSO" is Reaction Search Order that sorted and stored the propensities of reactions approximately throughout the simulation + std::vector RSO; //[cell_count() * NUM_REACTIONS] + + //"concs" stores current concentration levels for every species in every cell + std::vector > concs; + //"propensities" stores probability of each rxn firing, calculated from active rates + std::vector > propensities; + //for each rxn, stores intracellular reactions whose rates are affected by a firing of that rxn + std::vector propensity_network[NUM_REACTIONS]; + //for each rxn, stores intercellular reactions whose rates are affected by a firing of that rxn + std::vector neighbor_propensity_network[NUM_REACTIONS]; + //random number generator + std::default_random_engine generator = std::default_random_engine{ std::random_device()() }; + + Real total_propensity_ = {}; + static std::uniform_real_distribution distribution_; + + Minutes generateTau(); + Minutes getSoonestDelay() const; + void executeDelayRXN(); + Real getRandVariable(); + void tauLeap(); + void initPropensityNetwork(); + void generateRXNTaus(Real tau); + void fireOrSchedule(int c, reaction_id rid); + void initPropensities(); + + public: + + /* + * ContextStoch: + * iterator for observers to access conc levels with + */ + using SpecieRates = CUDA_Array; + + private: + void fireReaction(dense::Natural cell, const reaction_id rid); + + public: + /* + * Constructor: + * calls simulation base constructor + * initializes fields "t" and "generator" + */ + + Sorting_Direct_Simulation(const Parameter_Set& ps, NGraph::Graph adj_graph, std::vector conc, Real* pnFactorsPert, Real** pnFactorsGrad, int seed) + : Simulation(ps, adj_graph, pnFactorsPert, pnFactorsGrad) + , concs(cell_count(), conc) + , propensities(cell_count()) + , generator{seed} { + initPropensityNetwork(); + initPropensities(); + } + + std::vector get_perf(){ + return Simulation::get_performance(); + } + + + Real get_concentration (dense::Natural cell, specie_id species) const { + return concs.at(cell).at(species); + } + + Real get_concentration (dense::Natural cell, specie_id species, dense::Natural delay) const { + (void)delay; + return get_concentration(cell, species); + } + + void update_concentration (dense::Natural cell_, specie_id sid, int delta) { + auto& concentration = concs[cell_][sid]; + concentration = std::max(concentration + delta, 0); + } + + + /* + * GETTOTALPROPENSITY + * sums the propensities of every reaction in every cell + * called by "generateTau" in simulation_stoch.cpp + * return "sum": the propensity sum + */ + // Todo: store this as a cached variable and change it as propensities change; + // sum += new_value - old_value; + __attribute_noinline__ Real get_total_propensity() const { + Real sum = total_propensity_; // 0.0; + /*for (dense::Natural c = 0; c < _cells_total; ++c) { + for (int r=0; r get_perf(){ + return Simulation::get_performance(); + } + + private: Minutes time_until_next_event () const; diff --git a/source/sim/stoch/weightsum_tree.hpp b/source/sim/stoch/weightsum_tree.hpp new file mode 100644 index 00000000..7d0e3e77 --- /dev/null +++ b/source/sim/stoch/weightsum_tree.hpp @@ -0,0 +1,100 @@ +#ifndef WEIGHTSUM_TREE +#define WEIGHTSUM_TREE +#include "completetree.hpp" +#include "utility/numerics.hpp" +#include +#include +#include + +namespace dense { +namespace stochastic { + + +//Class to randomly select an index where each index's probability of being +// selected is weighted by a given vector. +template ::digits> +class weightsum_tree { + public: + //Weights can be of any type, but most be convertable to Real values + weightsum_tree() = default; + + void compute_weights() { + _total_weight = sum_weights(_tree().root()); + } + + void swap_with_child(PosType parent, PosType child) { + Real weight_diff = _tree().weight_of(parent) - _tree().weight_of(child); + _tree().weightsum_of(child) += weight_diff; + std::swap(_tree().weight_of(parent), _tree().weight_of(child)); + } + + void swap(PosType i, PosType j) { + Real old_i_weight = _tree().weight_of(i); + update_weight(i, _tree().weight_of(j)); + update_weight(j, old_i_weight); + } + + void update_weight(PosType i, Real new_weight) { + Real weight_diff = new_weight - _tree().weight_of(i); + _tree().weight_of(i) = new_weight; + while (i != _tree().root()) { + _tree().weightsum_of(i) += weight_diff; + i = Tree::parent_of(i); + } + _tree().weightsum_of(i) += weight_diff; + _total_weight += weight_diff; + } + + Real total_weight() const { return _total_weight; } + + template + PosType operator()(URNG& g) { + + Real target = std::generate_canonical(g)*_total_weight; + PosType node = _tree().root(); + //Loop until target random value is in between weight(left) and weight(left) + value(node) + while(checked_weightsum(Tree::left_of(node)) > target || + _tree().weight_of(node) + checked_weightsum(Tree::left_of(node)) < target) { + if (checked_weightsum(Tree::left_of(node)) > target) { + node = Tree::left_of(node); + } else { + target -= _tree().weight_of(node) + _tree().weightsum_of(Tree::left_of(node)); + node = Tree::right_of(node); + } + //Should this ever happen? No, but floating-point rounding means it's + // theoretically possible, and it's better to reboot than crash at this point + if (node > _tree().last()) { + node = _tree().root(); + target = std::generate_canonical(g)*_total_weight; + } + } + return node; //Should never happen? + } + + private: + Tree& _tree() { return *static_cast(this); } + const Tree& _tree() const { return *static_cast(this); } + Real checked_weightsum(PosType node) const { return node > _tree().last() ? 0 : _tree().weightsum_of(node); } + Real checked_weight(PosType node) const { return node > _tree().last() ? 0 : _tree().weight_of(node); } + Real sum_weights(PosType i) { + if (i > _tree().last()) return 0.0f; + _tree().weightsum_of(i) = + sum_weights(Tree::left_of(i)) + sum_weights(Tree::right_of(i)) + + _tree().weight_of(i); + return _tree().weightsum_of(i); + } + bool isAncestor(PosType i, PosType j) { + unsigned int ilz = __builtin_clz(i+1); + unsigned int jlz = __builtin_clz(j+1); + if (ilz > jlz) { + return (j >> (ilz - jlz)) == i; + } + return false; + } + + Real _total_weight; +}; + +} +} +#endif diff --git a/source/sim/stoch/wrstest.cpp b/source/sim/stoch/wrstest.cpp new file mode 100644 index 00000000..43bab28d --- /dev/null +++ b/source/sim/stoch/wrstest.cpp @@ -0,0 +1,28 @@ +#include "random_selector.hpp" + +#include +#include + +using namespace dense::stochastic; + +int main() { + std::default_random_engine generator; + std::vector weights = {4, 3, 2, 1}; + + nonuniform_int_distribution selector(weights); + std::cout << "Constructed" << std::endl; + std::vector counts(weights.size()); + + for (int i = 0; i < 100000; i++) { + int index = selector(generator); + if (index < 0 || index >= weights.size()) { + std::cout << "Error, index out of range" << std::endl; + } else { + counts[index]++; + } + } + for (auto c : counts) { + std::cout << c << ','; + } + std::cout << std::endl; +} diff --git a/source/sorting_direct_Main.cpp b/source/sorting_direct_Main.cpp new file mode 100644 index 00000000..cb2508e8 --- /dev/null +++ b/source/sorting_direct_Main.cpp @@ -0,0 +1,62 @@ +#include "io/arg_parse.hpp" +#include "measurement/oscillation.hpp" +#include "measurement/basic.hpp" +#include "measurement/bad_simulation_error.hpp" +#include "utility/style.hpp" +#include "utility/common_utils.hpp" +#include "io/csvr_sim.hpp" +#include "io/csvw_sim.hpp" +#include "sim/determ/determ.hpp" +#include "sim/stoch/sorting_direct_simulation.hpp" +#include "model_impl.hpp" +#include "io/ezxml/ezxml.h" +#include "Sim_Builder.hpp" +#include "run_simulation.hpp" +#include "arg_parse.hpp" +#include "parse_analysis_entries.hpp" + +using style::Color; + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using dense::csvw_sim; +using dense::Sorting_Direct_Simulation; +using dense::Sim_Builder; +using dense::parse_static_args; +using dense::parse_analysis_entries; +using dense::Static_Args; +using dense::run_simulation; + + +int main(int argc, char* argv[]){ + int ac = argc; + char** av = argv; + + Static_Args args = parse_static_args(argc, argv); + if(args.help == 1){ + return EXIT_SUCCESS; + } + if(args.help == 2){ + return EXIT_FAILURE; + } + using Simulation = Sorting_Direct_Simulation; + Sim_Builder sim = Sim_Builder(args.perturbation_factors, args.gradient_factors, args.adj_graph, ac, av); + run_simulation(args.simulation_duration, args.analysis_interval, std::move(sim.get_simulations(args.param_sets)),parse_analysis_entries(argc, argv, args.adj_graph.num_vertices())); +} +/* +Snapshot<> snapshot; +Snapshot<> data = simulation.snapshot(); +template +Real Reaction_Traits::calculate_rate_for(Region region) { +} +<<<<<<< HEAD +*/ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index d78d895c..c511f959 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,5 +1,7 @@ -add_subdirectory(her_model_2014) -add_subdirectory(Belousov-Zhabotinksy) -add_subdirectory(Nan_Test) -add_subdirectory(time_test) +add_subdirectory(ndiff) +#add_subdirectory(her_model_2014) +#add_subdirectory(Belousov-Zhabotinksy) +#add_subdirectory(Nan_Test) +#add_subdirectory(time_test) +add_subdirectory(simple_model) #add_subdirectory(new_model) diff --git a/test/her_model_2014/Makefile b/test/her_model_2014/Makefile index b65019e3..27a781a7 100644 --- a/test/her_model_2014/Makefile +++ b/test/her_model_2014/Makefile @@ -48,10 +48,10 @@ RM = /usr/bin/cmake -E remove -f EQUALS = = # The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/mcclelnr/DENSE +CMAKE_SOURCE_DIR = /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks # The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/mcclelnr/DENSE/test/her_model_2014 +CMAKE_BINARY_DIR = /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks #============================================================================= # Targets provided globally by CMake. @@ -67,17 +67,6 @@ rebuild_cache/fast: rebuild_cache .PHONY : rebuild_cache/fast -# Special rule for the target test -test: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..." - /usr/bin/ctest --force-new-ctest-process $(ARGS) -.PHONY : test - -# Special rule for the target test -test/fast: test - -.PHONY : test/fast - # Special rule for the target edit_cache edit_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." @@ -91,14 +80,14 @@ edit_cache/fast: edit_cache # The main all target all: cmake_check_build_system - $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/DENSE/test/her_model_2014/CMakeFiles /home/mcclelnr/DENSE/test/her_model_2014/CMakeFiles/progress.marks - $(MAKE) -f CMakeFiles/Makefile2 all - $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/DENSE/test/her_model_2014/CMakeFiles 0 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/CMakeFiles /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/DENSE/test/her_model_2014/CMakeFiles/progress.marks + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/CMakeFiles 0 .PHONY : all # The main clean target clean: - $(MAKE) -f CMakeFiles/Makefile2 clean + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/clean .PHONY : clean # The main clean target @@ -108,200 +97,723 @@ clean/fast: clean # Prepare targets for installation. preinstall: all - $(MAKE) -f CMakeFiles/Makefile2 preinstall + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/preinstall .PHONY : preinstall # Prepare targets for installation. preinstall/fast: - $(MAKE) -f CMakeFiles/Makefile2 preinstall + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/preinstall .PHONY : preinstall/fast # clear depends depend: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 .PHONY : depend -#============================================================================= -# Target rules for targets named csv_gen +# Convenience name for target. +DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/rule: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/rule +.PHONY : DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/rule -# Build rule for target. -csv_gen: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 csv_gen -.PHONY : csv_gen +# Convenience name for target. +her2014_simulation_lib: DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/rule + +.PHONY : her2014_simulation_lib # fast build rule for target. -csv_gen/fast: - $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/build -.PHONY : csv_gen/fast +her2014_simulation_lib/fast: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build +.PHONY : her2014_simulation_lib/fast -#============================================================================= -# Target rules for targets named csv_gen_run +# Convenience name for target. +DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/rule: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/rule +.PHONY : DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/rule + +# Convenience name for target. +her2014_simulation: DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/rule -# Build rule for target. -csv_gen_run: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 csv_gen_run -.PHONY : csv_gen_run +.PHONY : her2014_simulation # fast build rule for target. -csv_gen_run/fast: - $(MAKE) -f source/CMakeFiles/csv_gen_run.dir/build.make source/CMakeFiles/csv_gen_run.dir/build -.PHONY : csv_gen_run/fast +her2014_simulation/fast: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/build +.PHONY : her2014_simulation/fast -#============================================================================= -# Target rules for targets named simulation_lib +__/__/source/core/build_once.o: __/__/source/core/build_once.cpp.o -# Build rule for target. -simulation_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 simulation_lib -.PHONY : simulation_lib +.PHONY : __/__/source/core/build_once.o -# fast build rule for target. -simulation_lib/fast: - $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/build -.PHONY : simulation_lib/fast +# target to build an object file +__/__/source/core/build_once.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/core/build_once.cpp.o +.PHONY : __/__/source/core/build_once.cpp.o -#============================================================================= -# Target rules for targets named simulation +__/__/source/core/build_once.i: __/__/source/core/build_once.cpp.i -# Build rule for target. -simulation: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 simulation -.PHONY : simulation +.PHONY : __/__/source/core/build_once.i -# fast build rule for target. -simulation/fast: - $(MAKE) -f source/CMakeFiles/simulation.dir/build.make source/CMakeFiles/simulation.dir/build -.PHONY : simulation/fast +# target to preprocess a source file +__/__/source/core/build_once.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/core/build_once.cpp.i +.PHONY : __/__/source/core/build_once.cpp.i -#============================================================================= -# Target rules for targets named her2014_simulation +__/__/source/core/build_once.s: __/__/source/core/build_once.cpp.s -# Build rule for target. -her2014_simulation: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 her2014_simulation -.PHONY : her2014_simulation +.PHONY : __/__/source/core/build_once.s -# fast build rule for target. -her2014_simulation/fast: - $(MAKE) -f test/her_model_2014/CMakeFiles/her2014_simulation.dir/build.make test/her_model_2014/CMakeFiles/her2014_simulation.dir/build -.PHONY : her2014_simulation/fast +# target to generate assembly for a file +__/__/source/core/build_once.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/core/build_once.cpp.s +.PHONY : __/__/source/core/build_once.cpp.s -#============================================================================= -# Target rules for targets named her2014_simulation_lib +__/__/source/deterministic_main.o: __/__/source/deterministic_main.cpp.o -# Build rule for target. -her2014_simulation_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 her2014_simulation_lib -.PHONY : her2014_simulation_lib +.PHONY : __/__/source/deterministic_main.o -# fast build rule for target. -her2014_simulation_lib/fast: - $(MAKE) -f test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build -.PHONY : her2014_simulation_lib/fast +# target to build an object file +__/__/source/deterministic_main.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/__/__/source/deterministic_main.cpp.o +.PHONY : __/__/source/deterministic_main.cpp.o -#============================================================================= -# Target rules for targets named her2014_param_search +__/__/source/deterministic_main.i: __/__/source/deterministic_main.cpp.i -# Build rule for target. -her2014_param_search: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 her2014_param_search -.PHONY : her2014_param_search +.PHONY : __/__/source/deterministic_main.i -# fast build rule for target. -her2014_param_search/fast: - $(MAKE) -f test/her_model_2014/CMakeFiles/her2014_param_search.dir/build.make test/her_model_2014/CMakeFiles/her2014_param_search.dir/build -.PHONY : her2014_param_search/fast +# target to preprocess a source file +__/__/source/deterministic_main.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/__/__/source/deterministic_main.cpp.i +.PHONY : __/__/source/deterministic_main.cpp.i -#============================================================================= -# Target rules for targets named her2014_param_search_lib +__/__/source/deterministic_main.s: __/__/source/deterministic_main.cpp.s -# Build rule for target. -her2014_param_search_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 her2014_param_search_lib -.PHONY : her2014_param_search_lib +.PHONY : __/__/source/deterministic_main.s -# fast build rule for target. -her2014_param_search_lib/fast: - $(MAKE) -f test/her_model_2014/CMakeFiles/her2014_param_search_lib.dir/build.make test/her_model_2014/CMakeFiles/her2014_param_search_lib.dir/build -.PHONY : her2014_param_search_lib/fast +# target to generate assembly for a file +__/__/source/deterministic_main.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation.dir/__/__/source/deterministic_main.cpp.s +.PHONY : __/__/source/deterministic_main.cpp.s -#============================================================================= -# Target rules for targets named turing_simulation_lib +__/__/source/io/arg_parse.o: __/__/source/io/arg_parse.cpp.o -# Build rule for target. -turing_simulation_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 turing_simulation_lib -.PHONY : turing_simulation_lib +.PHONY : __/__/source/io/arg_parse.o -# fast build rule for target. -turing_simulation_lib/fast: - $(MAKE) -f test/Belousov-Zhabotinksy/CMakeFiles/turing_simulation_lib.dir/build.make test/Belousov-Zhabotinksy/CMakeFiles/turing_simulation_lib.dir/build -.PHONY : turing_simulation_lib/fast +# target to build an object file +__/__/source/io/arg_parse.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/arg_parse.cpp.o +.PHONY : __/__/source/io/arg_parse.cpp.o -#============================================================================= -# Target rules for targets named turing_simulation +__/__/source/io/arg_parse.i: __/__/source/io/arg_parse.cpp.i -# Build rule for target. -turing_simulation: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 turing_simulation -.PHONY : turing_simulation +.PHONY : __/__/source/io/arg_parse.i -# fast build rule for target. -turing_simulation/fast: - $(MAKE) -f test/Belousov-Zhabotinksy/CMakeFiles/turing_simulation.dir/build.make test/Belousov-Zhabotinksy/CMakeFiles/turing_simulation.dir/build -.PHONY : turing_simulation/fast +# target to preprocess a source file +__/__/source/io/arg_parse.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/arg_parse.cpp.i +.PHONY : __/__/source/io/arg_parse.cpp.i -#============================================================================= -# Target rules for targets named nan_simulation_lib +__/__/source/io/arg_parse.s: __/__/source/io/arg_parse.cpp.s -# Build rule for target. -nan_simulation_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 nan_simulation_lib -.PHONY : nan_simulation_lib +.PHONY : __/__/source/io/arg_parse.s -# fast build rule for target. -nan_simulation_lib/fast: - $(MAKE) -f test/Nan_Test/CMakeFiles/nan_simulation_lib.dir/build.make test/Nan_Test/CMakeFiles/nan_simulation_lib.dir/build -.PHONY : nan_simulation_lib/fast +# target to generate assembly for a file +__/__/source/io/arg_parse.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/arg_parse.cpp.s +.PHONY : __/__/source/io/arg_parse.cpp.s -#============================================================================= -# Target rules for targets named nan_simulation +__/__/source/io/csvr.o: __/__/source/io/csvr.cpp.o -# Build rule for target. -nan_simulation: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 nan_simulation -.PHONY : nan_simulation +.PHONY : __/__/source/io/csvr.o -# fast build rule for target. -nan_simulation/fast: - $(MAKE) -f test/Nan_Test/CMakeFiles/nan_simulation.dir/build.make test/Nan_Test/CMakeFiles/nan_simulation.dir/build -.PHONY : nan_simulation/fast +# target to build an object file +__/__/source/io/csvr.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr.cpp.o +.PHONY : __/__/source/io/csvr.cpp.o -#============================================================================= -# Target rules for targets named time_test_lib +__/__/source/io/csvr.i: __/__/source/io/csvr.cpp.i -# Build rule for target. -time_test_lib: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 time_test_lib -.PHONY : time_test_lib +.PHONY : __/__/source/io/csvr.i -# fast build rule for target. -time_test_lib/fast: - $(MAKE) -f test/time_test/CMakeFiles/time_test_lib.dir/build.make test/time_test/CMakeFiles/time_test_lib.dir/build -.PHONY : time_test_lib/fast +# target to preprocess a source file +__/__/source/io/csvr.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr.cpp.i +.PHONY : __/__/source/io/csvr.cpp.i -#============================================================================= -# Target rules for targets named time_test +__/__/source/io/csvr.s: __/__/source/io/csvr.cpp.s -# Build rule for target. -time_test: cmake_check_build_system - $(MAKE) -f CMakeFiles/Makefile2 time_test -.PHONY : time_test +.PHONY : __/__/source/io/csvr.s -# fast build rule for target. -time_test/fast: - $(MAKE) -f test/time_test/CMakeFiles/time_test.dir/build.make test/time_test/CMakeFiles/time_test.dir/build -.PHONY : time_test/fast +# target to generate assembly for a file +__/__/source/io/csvr.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr.cpp.s +.PHONY : __/__/source/io/csvr.cpp.s + +__/__/source/io/csvr_sim.o: __/__/source/io/csvr_sim.cpp.o + +.PHONY : __/__/source/io/csvr_sim.o + +# target to build an object file +__/__/source/io/csvr_sim.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr_sim.cpp.o +.PHONY : __/__/source/io/csvr_sim.cpp.o + +__/__/source/io/csvr_sim.i: __/__/source/io/csvr_sim.cpp.i + +.PHONY : __/__/source/io/csvr_sim.i + +# target to preprocess a source file +__/__/source/io/csvr_sim.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr_sim.cpp.i +.PHONY : __/__/source/io/csvr_sim.cpp.i + +__/__/source/io/csvr_sim.s: __/__/source/io/csvr_sim.cpp.s + +.PHONY : __/__/source/io/csvr_sim.s + +# target to generate assembly for a file +__/__/source/io/csvr_sim.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvr_sim.cpp.s +.PHONY : __/__/source/io/csvr_sim.cpp.s + +__/__/source/io/csvw.o: __/__/source/io/csvw.cpp.o + +.PHONY : __/__/source/io/csvw.o + +# target to build an object file +__/__/source/io/csvw.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvw.cpp.o +.PHONY : __/__/source/io/csvw.cpp.o + +__/__/source/io/csvw.i: __/__/source/io/csvw.cpp.i + +.PHONY : __/__/source/io/csvw.i + +# target to preprocess a source file +__/__/source/io/csvw.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvw.cpp.i +.PHONY : __/__/source/io/csvw.cpp.i + +__/__/source/io/csvw.s: __/__/source/io/csvw.cpp.s + +.PHONY : __/__/source/io/csvw.s + +# target to generate assembly for a file +__/__/source/io/csvw.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/csvw.cpp.s +.PHONY : __/__/source/io/csvw.cpp.s + +__/__/source/io/ezxml/ezxml.o: __/__/source/io/ezxml/ezxml.c.o + +.PHONY : __/__/source/io/ezxml/ezxml.o + +# target to build an object file +__/__/source/io/ezxml/ezxml.c.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/ezxml/ezxml.c.o +.PHONY : __/__/source/io/ezxml/ezxml.c.o + +__/__/source/io/ezxml/ezxml.i: __/__/source/io/ezxml/ezxml.c.i + +.PHONY : __/__/source/io/ezxml/ezxml.i + +# target to preprocess a source file +__/__/source/io/ezxml/ezxml.c.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/ezxml/ezxml.c.i +.PHONY : __/__/source/io/ezxml/ezxml.c.i + +__/__/source/io/ezxml/ezxml.s: __/__/source/io/ezxml/ezxml.c.s + +.PHONY : __/__/source/io/ezxml/ezxml.s + +# target to generate assembly for a file +__/__/source/io/ezxml/ezxml.c.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/io/ezxml/ezxml.c.s +.PHONY : __/__/source/io/ezxml/ezxml.c.s + +__/__/source/rejection_based_main.o: __/__/source/rejection_based_main.cpp.o + +.PHONY : __/__/source/rejection_based_main.o + +# target to build an object file +__/__/source/rejection_based_main.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/rejection_based_main.cpp.o +.PHONY : __/__/source/rejection_based_main.cpp.o + +__/__/source/rejection_based_main.i: __/__/source/rejection_based_main.cpp.i + +.PHONY : __/__/source/rejection_based_main.i + +# target to preprocess a source file +__/__/source/rejection_based_main.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/rejection_based_main.cpp.i +.PHONY : __/__/source/rejection_based_main.cpp.i + +__/__/source/rejection_based_main.s: __/__/source/rejection_based_main.cpp.s + +.PHONY : __/__/source/rejection_based_main.s + +# target to generate assembly for a file +__/__/source/rejection_based_main.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/rejection_based_main.cpp.s +.PHONY : __/__/source/rejection_based_main.cpp.s + +__/__/source/search/libsres/ESES.o: __/__/source/search/libsres/ESES.cpp.o + +.PHONY : __/__/source/search/libsres/ESES.o + +# target to build an object file +__/__/source/search/libsres/ESES.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESES.cpp.o +.PHONY : __/__/source/search/libsres/ESES.cpp.o + +__/__/source/search/libsres/ESES.i: __/__/source/search/libsres/ESES.cpp.i + +.PHONY : __/__/source/search/libsres/ESES.i + +# target to preprocess a source file +__/__/source/search/libsres/ESES.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESES.cpp.i +.PHONY : __/__/source/search/libsres/ESES.cpp.i + +__/__/source/search/libsres/ESES.s: __/__/source/search/libsres/ESES.cpp.s + +.PHONY : __/__/source/search/libsres/ESES.s + +# target to generate assembly for a file +__/__/source/search/libsres/ESES.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESES.cpp.s +.PHONY : __/__/source/search/libsres/ESES.cpp.s + +__/__/source/search/libsres/ESSRSort.o: __/__/source/search/libsres/ESSRSort.cpp.o + +.PHONY : __/__/source/search/libsres/ESSRSort.o + +# target to build an object file +__/__/source/search/libsres/ESSRSort.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESSRSort.cpp.o +.PHONY : __/__/source/search/libsres/ESSRSort.cpp.o + +__/__/source/search/libsres/ESSRSort.i: __/__/source/search/libsres/ESSRSort.cpp.i + +.PHONY : __/__/source/search/libsres/ESSRSort.i + +# target to preprocess a source file +__/__/source/search/libsres/ESSRSort.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESSRSort.cpp.i +.PHONY : __/__/source/search/libsres/ESSRSort.cpp.i + +__/__/source/search/libsres/ESSRSort.s: __/__/source/search/libsres/ESSRSort.cpp.s + +.PHONY : __/__/source/search/libsres/ESSRSort.s + +# target to generate assembly for a file +__/__/source/search/libsres/ESSRSort.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/ESSRSort.cpp.s +.PHONY : __/__/source/search/libsres/ESSRSort.cpp.s + +__/__/source/search/libsres/sharefunc.o: __/__/source/search/libsres/sharefunc.cpp.o + +.PHONY : __/__/source/search/libsres/sharefunc.o + +# target to build an object file +__/__/source/search/libsres/sharefunc.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/sharefunc.cpp.o +.PHONY : __/__/source/search/libsres/sharefunc.cpp.o + +__/__/source/search/libsres/sharefunc.i: __/__/source/search/libsres/sharefunc.cpp.i + +.PHONY : __/__/source/search/libsres/sharefunc.i + +# target to preprocess a source file +__/__/source/search/libsres/sharefunc.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/sharefunc.cpp.i +.PHONY : __/__/source/search/libsres/sharefunc.cpp.i + +__/__/source/search/libsres/sharefunc.s: __/__/source/search/libsres/sharefunc.cpp.s + +.PHONY : __/__/source/search/libsres/sharefunc.s + +# target to generate assembly for a file +__/__/source/search/libsres/sharefunc.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/libsres/sharefunc.cpp.s +.PHONY : __/__/source/search/libsres/sharefunc.cpp.s + +__/__/source/search/sres.o: __/__/source/search/sres.cpp.o + +.PHONY : __/__/source/search/sres.o + +# target to build an object file +__/__/source/search/sres.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/sres.cpp.o +.PHONY : __/__/source/search/sres.cpp.o + +__/__/source/search/sres.i: __/__/source/search/sres.cpp.i + +.PHONY : __/__/source/search/sres.i + +# target to preprocess a source file +__/__/source/search/sres.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/sres.cpp.i +.PHONY : __/__/source/search/sres.cpp.i + +__/__/source/search/sres.s: __/__/source/search/sres.cpp.s + +.PHONY : __/__/source/search/sres.s + +# target to generate assembly for a file +__/__/source/search/sres.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/search/sres.cpp.s +.PHONY : __/__/source/search/sres.cpp.s + +__/__/source/sim/base.o: __/__/source/sim/base.cpp.o + +.PHONY : __/__/source/sim/base.o + +# target to build an object file +__/__/source/sim/base.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/base.cpp.o +.PHONY : __/__/source/sim/base.cpp.o + +__/__/source/sim/base.i: __/__/source/sim/base.cpp.i + +.PHONY : __/__/source/sim/base.i + +# target to preprocess a source file +__/__/source/sim/base.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/base.cpp.i +.PHONY : __/__/source/sim/base.cpp.i + +__/__/source/sim/base.s: __/__/source/sim/base.cpp.s + +.PHONY : __/__/source/sim/base.s + +# target to generate assembly for a file +__/__/source/sim/base.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/base.cpp.s +.PHONY : __/__/source/sim/base.cpp.s + +__/__/source/sim/determ/baby_cl.o: __/__/source/sim/determ/baby_cl.cpp.o + +.PHONY : __/__/source/sim/determ/baby_cl.o + +# target to build an object file +__/__/source/sim/determ/baby_cl.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/baby_cl.cpp.o +.PHONY : __/__/source/sim/determ/baby_cl.cpp.o + +__/__/source/sim/determ/baby_cl.i: __/__/source/sim/determ/baby_cl.cpp.i + +.PHONY : __/__/source/sim/determ/baby_cl.i + +# target to preprocess a source file +__/__/source/sim/determ/baby_cl.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/baby_cl.cpp.i +.PHONY : __/__/source/sim/determ/baby_cl.cpp.i + +__/__/source/sim/determ/baby_cl.s: __/__/source/sim/determ/baby_cl.cpp.s + +.PHONY : __/__/source/sim/determ/baby_cl.s + +# target to generate assembly for a file +__/__/source/sim/determ/baby_cl.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/baby_cl.cpp.s +.PHONY : __/__/source/sim/determ/baby_cl.cpp.s + +__/__/source/sim/determ/determ.o: __/__/source/sim/determ/determ.cpp.o + +.PHONY : __/__/source/sim/determ/determ.o + +# target to build an object file +__/__/source/sim/determ/determ.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/determ.cpp.o +.PHONY : __/__/source/sim/determ/determ.cpp.o + +__/__/source/sim/determ/determ.i: __/__/source/sim/determ/determ.cpp.i + +.PHONY : __/__/source/sim/determ/determ.i + +# target to preprocess a source file +__/__/source/sim/determ/determ.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/determ.cpp.i +.PHONY : __/__/source/sim/determ/determ.cpp.i + +__/__/source/sim/determ/determ.s: __/__/source/sim/determ/determ.cpp.s + +.PHONY : __/__/source/sim/determ/determ.s + +# target to generate assembly for a file +__/__/source/sim/determ/determ.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/determ/determ.cpp.s +.PHONY : __/__/source/sim/determ/determ.cpp.s + +__/__/source/sim/stoch/Gillespie_Direct_Simulation.o: __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.o + +# target to build an object file +__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.o +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.o + +__/__/source/sim/stoch/Gillespie_Direct_Simulation.i: __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.i +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.i + +__/__/source/sim/stoch/Gillespie_Direct_Simulation.s: __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.s +.PHONY : __/__/source/sim/stoch/Gillespie_Direct_Simulation.cpp.s + +__/__/source/sim/stoch/anderson_next_reaction_simulation.o: __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.o + +# target to build an object file +__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.o +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.o + +__/__/source/sim/stoch/anderson_next_reaction_simulation.i: __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.i +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.i + +__/__/source/sim/stoch/anderson_next_reaction_simulation.s: __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.s +.PHONY : __/__/source/sim/stoch/anderson_next_reaction_simulation.cpp.s + +__/__/source/sim/stoch/fast_gillespie_direct_simulation.o: __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.o + +# target to build an object file +__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.o +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.o + +__/__/source/sim/stoch/fast_gillespie_direct_simulation.i: __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.i +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.i + +__/__/source/sim/stoch/fast_gillespie_direct_simulation.s: __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.s +.PHONY : __/__/source/sim/stoch/fast_gillespie_direct_simulation.cpp.s + +__/__/source/sim/stoch/next_reaction_simulation.o: __/__/source/sim/stoch/next_reaction_simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.o + +# target to build an object file +__/__/source/sim/stoch/next_reaction_simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/next_reaction_simulation.cpp.o +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.cpp.o + +__/__/source/sim/stoch/next_reaction_simulation.i: __/__/source/sim/stoch/next_reaction_simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/next_reaction_simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/next_reaction_simulation.cpp.i +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.cpp.i + +__/__/source/sim/stoch/next_reaction_simulation.s: __/__/source/sim/stoch/next_reaction_simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/next_reaction_simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/next_reaction_simulation.cpp.s +.PHONY : __/__/source/sim/stoch/next_reaction_simulation.cpp.s + +__/__/source/sim/stoch/rejection_based_simulation.o: __/__/source/sim/stoch/rejection_based_simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.o + +# target to build an object file +__/__/source/sim/stoch/rejection_based_simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/rejection_based_simulation.cpp.o +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.cpp.o + +__/__/source/sim/stoch/rejection_based_simulation.i: __/__/source/sim/stoch/rejection_based_simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/rejection_based_simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/rejection_based_simulation.cpp.i +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.cpp.i + +__/__/source/sim/stoch/rejection_based_simulation.s: __/__/source/sim/stoch/rejection_based_simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/rejection_based_simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/rejection_based_simulation.cpp.s +.PHONY : __/__/source/sim/stoch/rejection_based_simulation.cpp.s + +__/__/source/sim/stoch/sorting_direct_simulation.o: __/__/source/sim/stoch/sorting_direct_simulation.cpp.o + +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.o + +# target to build an object file +__/__/source/sim/stoch/sorting_direct_simulation.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/sorting_direct_simulation.cpp.o +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.cpp.o + +__/__/source/sim/stoch/sorting_direct_simulation.i: __/__/source/sim/stoch/sorting_direct_simulation.cpp.i + +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.i + +# target to preprocess a source file +__/__/source/sim/stoch/sorting_direct_simulation.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/sorting_direct_simulation.cpp.i +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.cpp.i + +__/__/source/sim/stoch/sorting_direct_simulation.s: __/__/source/sim/stoch/sorting_direct_simulation.cpp.s + +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.s + +# target to generate assembly for a file +__/__/source/sim/stoch/sorting_direct_simulation.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/sorting_direct_simulation.cpp.s +.PHONY : __/__/source/sim/stoch/sorting_direct_simulation.cpp.s + +__/__/source/sim/stoch/stoch.o: __/__/source/sim/stoch/stoch.cpp.o + +.PHONY : __/__/source/sim/stoch/stoch.o + +# target to build an object file +__/__/source/sim/stoch/stoch.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/stoch.cpp.o +.PHONY : __/__/source/sim/stoch/stoch.cpp.o + +__/__/source/sim/stoch/stoch.i: __/__/source/sim/stoch/stoch.cpp.i + +.PHONY : __/__/source/sim/stoch/stoch.i + +# target to preprocess a source file +__/__/source/sim/stoch/stoch.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/stoch.cpp.i +.PHONY : __/__/source/sim/stoch/stoch.cpp.i + +__/__/source/sim/stoch/stoch.s: __/__/source/sim/stoch/stoch.cpp.s + +.PHONY : __/__/source/sim/stoch/stoch.s + +# target to generate assembly for a file +__/__/source/sim/stoch/stoch.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/sim/stoch/stoch.cpp.s +.PHONY : __/__/source/sim/stoch/stoch.cpp.s + +__/__/source/utility/color.o: __/__/source/utility/color.cpp.o + +.PHONY : __/__/source/utility/color.o + +# target to build an object file +__/__/source/utility/color.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/color.cpp.o +.PHONY : __/__/source/utility/color.cpp.o + +__/__/source/utility/color.i: __/__/source/utility/color.cpp.i + +.PHONY : __/__/source/utility/color.i + +# target to preprocess a source file +__/__/source/utility/color.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/color.cpp.i +.PHONY : __/__/source/utility/color.cpp.i + +__/__/source/utility/color.s: __/__/source/utility/color.cpp.s + +.PHONY : __/__/source/utility/color.s + +# target to generate assembly for a file +__/__/source/utility/color.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/color.cpp.s +.PHONY : __/__/source/utility/color.cpp.s + +__/__/source/utility/common_utils.o: __/__/source/utility/common_utils.cpp.o + +.PHONY : __/__/source/utility/common_utils.o + +# target to build an object file +__/__/source/utility/common_utils.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/common_utils.cpp.o +.PHONY : __/__/source/utility/common_utils.cpp.o + +__/__/source/utility/common_utils.i: __/__/source/utility/common_utils.cpp.i + +.PHONY : __/__/source/utility/common_utils.i + +# target to preprocess a source file +__/__/source/utility/common_utils.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/common_utils.cpp.i +.PHONY : __/__/source/utility/common_utils.cpp.i + +__/__/source/utility/common_utils.s: __/__/source/utility/common_utils.cpp.s + +.PHONY : __/__/source/utility/common_utils.s + +# target to generate assembly for a file +__/__/source/utility/common_utils.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/common_utils.cpp.s +.PHONY : __/__/source/utility/common_utils.cpp.s + +__/__/source/utility/preprocessor.o: __/__/source/utility/preprocessor.cpp.o + +.PHONY : __/__/source/utility/preprocessor.o + +# target to build an object file +__/__/source/utility/preprocessor.cpp.o: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/preprocessor.cpp.o +.PHONY : __/__/source/utility/preprocessor.cpp.o + +__/__/source/utility/preprocessor.i: __/__/source/utility/preprocessor.cpp.i + +.PHONY : __/__/source/utility/preprocessor.i + +# target to preprocess a source file +__/__/source/utility/preprocessor.cpp.i: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/preprocessor.cpp.i +.PHONY : __/__/source/utility/preprocessor.cpp.i + +__/__/source/utility/preprocessor.s: __/__/source/utility/preprocessor.cpp.s + +.PHONY : __/__/source/utility/preprocessor.s + +# target to generate assembly for a file +__/__/source/utility/preprocessor.cpp.s: + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/build.make DENSE/test/her_model_2014/CMakeFiles/her2014_simulation_lib.dir/__/__/source/utility/preprocessor.cpp.s +.PHONY : __/__/source/utility/preprocessor.cpp.s # Help Target help: @@ -310,22 +822,84 @@ help: @echo "... clean" @echo "... depend" @echo "... rebuild_cache" - @echo "... test" @echo "... edit_cache" - @echo "... csv_gen" - @echo "... csv_gen_run" - @echo "... simulation_lib" - @echo "... simulation" - @echo "... her2014_simulation" @echo "... her2014_simulation_lib" - @echo "... her2014_param_search" - @echo "... her2014_param_search_lib" - @echo "... turing_simulation_lib" - @echo "... turing_simulation" - @echo "... nan_simulation_lib" - @echo "... nan_simulation" - @echo "... time_test_lib" - @echo "... time_test" + @echo "... her2014_simulation" + @echo "... __/__/source/core/build_once.o" + @echo "... __/__/source/core/build_once.i" + @echo "... __/__/source/core/build_once.s" + @echo "... __/__/source/deterministic_main.o" + @echo "... __/__/source/deterministic_main.i" + @echo "... __/__/source/deterministic_main.s" + @echo "... __/__/source/io/arg_parse.o" + @echo "... __/__/source/io/arg_parse.i" + @echo "... __/__/source/io/arg_parse.s" + @echo "... __/__/source/io/csvr.o" + @echo "... __/__/source/io/csvr.i" + @echo "... __/__/source/io/csvr.s" + @echo "... __/__/source/io/csvr_sim.o" + @echo "... __/__/source/io/csvr_sim.i" + @echo "... __/__/source/io/csvr_sim.s" + @echo "... __/__/source/io/csvw.o" + @echo "... __/__/source/io/csvw.i" + @echo "... __/__/source/io/csvw.s" + @echo "... __/__/source/io/ezxml/ezxml.o" + @echo "... __/__/source/io/ezxml/ezxml.i" + @echo "... __/__/source/io/ezxml/ezxml.s" + @echo "... __/__/source/rejection_based_main.o" + @echo "... __/__/source/rejection_based_main.i" + @echo "... __/__/source/rejection_based_main.s" + @echo "... __/__/source/search/libsres/ESES.o" + @echo "... __/__/source/search/libsres/ESES.i" + @echo "... __/__/source/search/libsres/ESES.s" + @echo "... __/__/source/search/libsres/ESSRSort.o" + @echo "... __/__/source/search/libsres/ESSRSort.i" + @echo "... __/__/source/search/libsres/ESSRSort.s" + @echo "... __/__/source/search/libsres/sharefunc.o" + @echo "... __/__/source/search/libsres/sharefunc.i" + @echo "... __/__/source/search/libsres/sharefunc.s" + @echo "... __/__/source/search/sres.o" + @echo "... __/__/source/search/sres.i" + @echo "... __/__/source/search/sres.s" + @echo "... __/__/source/sim/base.o" + @echo "... __/__/source/sim/base.i" + @echo "... __/__/source/sim/base.s" + @echo "... __/__/source/sim/determ/baby_cl.o" + @echo "... __/__/source/sim/determ/baby_cl.i" + @echo "... __/__/source/sim/determ/baby_cl.s" + @echo "... __/__/source/sim/determ/determ.o" + @echo "... __/__/source/sim/determ/determ.i" + @echo "... __/__/source/sim/determ/determ.s" + @echo "... __/__/source/sim/stoch/Gillespie_Direct_Simulation.o" + @echo "... __/__/source/sim/stoch/Gillespie_Direct_Simulation.i" + @echo "... __/__/source/sim/stoch/Gillespie_Direct_Simulation.s" + @echo "... __/__/source/sim/stoch/anderson_next_reaction_simulation.o" + @echo "... __/__/source/sim/stoch/anderson_next_reaction_simulation.i" + @echo "... __/__/source/sim/stoch/anderson_next_reaction_simulation.s" + @echo "... __/__/source/sim/stoch/fast_gillespie_direct_simulation.o" + @echo "... __/__/source/sim/stoch/fast_gillespie_direct_simulation.i" + @echo "... __/__/source/sim/stoch/fast_gillespie_direct_simulation.s" + @echo "... __/__/source/sim/stoch/next_reaction_simulation.o" + @echo "... __/__/source/sim/stoch/next_reaction_simulation.i" + @echo "... __/__/source/sim/stoch/next_reaction_simulation.s" + @echo "... __/__/source/sim/stoch/rejection_based_simulation.o" + @echo "... __/__/source/sim/stoch/rejection_based_simulation.i" + @echo "... __/__/source/sim/stoch/rejection_based_simulation.s" + @echo "... __/__/source/sim/stoch/sorting_direct_simulation.o" + @echo "... __/__/source/sim/stoch/sorting_direct_simulation.i" + @echo "... __/__/source/sim/stoch/sorting_direct_simulation.s" + @echo "... __/__/source/sim/stoch/stoch.o" + @echo "... __/__/source/sim/stoch/stoch.i" + @echo "... __/__/source/sim/stoch/stoch.s" + @echo "... __/__/source/utility/color.o" + @echo "... __/__/source/utility/color.i" + @echo "... __/__/source/utility/color.s" + @echo "... __/__/source/utility/common_utils.o" + @echo "... __/__/source/utility/common_utils.i" + @echo "... __/__/source/utility/common_utils.s" + @echo "... __/__/source/utility/preprocessor.o" + @echo "... __/__/source/utility/preprocessor.i" + @echo "... __/__/source/utility/preprocessor.s" .PHONY : help @@ -337,6 +911,6 @@ help: # No rule that depends on this can have commands that come from listfiles # because they might be regenerated. cmake_check_build_system: - $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 .PHONY : cmake_check_build_system diff --git a/test/her_model_2014/source/CMakeFiles/progress.marks b/test/her_model_2014/source/CMakeFiles/progress.marks index 209e3ef4..573541ac 100644 --- a/test/her_model_2014/source/CMakeFiles/progress.marks +++ b/test/her_model_2014/source/CMakeFiles/progress.marks @@ -1 +1 @@ -20 +0 diff --git a/test/her_model_2014/source/Makefile b/test/her_model_2014/source/Makefile index 6fc51070..8a3f93ad 100644 --- a/test/her_model_2014/source/Makefile +++ b/test/her_model_2014/source/Makefile @@ -48,10 +48,10 @@ RM = /usr/bin/cmake -E remove -f EQUALS = = # The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = /home/mcclelnr/DENSE +CMAKE_SOURCE_DIR = /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks # The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = /home/mcclelnr/DENSE/test/her_model_2014 +CMAKE_BINARY_DIR = /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks #============================================================================= # Targets provided globally by CMake. @@ -67,17 +67,6 @@ rebuild_cache/fast: rebuild_cache .PHONY : rebuild_cache/fast -# Special rule for the target test -test: - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running tests..." - /usr/bin/ctest --force-new-ctest-process $(ARGS) -.PHONY : test - -# Special rule for the target test -test/fast: test - -.PHONY : test/fast - # Special rule for the target edit_cache edit_cache: @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "No interactive CMake dialog available..." @@ -91,14 +80,14 @@ edit_cache/fast: edit_cache # The main all target all: cmake_check_build_system - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/DENSE/test/her_model_2014/CMakeFiles /home/mcclelnr/DENSE/test/her_model_2014/source/CMakeFiles/progress.marks - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/all - $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/DENSE/test/her_model_2014/CMakeFiles 0 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/CMakeFiles /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/DENSE/test/her_model_2014/source/CMakeFiles/progress.marks + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/source/all + $(CMAKE_COMMAND) -E cmake_progress_start /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks/CMakeFiles 0 .PHONY : all # The main clean target clean: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/clean + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/source/clean .PHONY : clean # The main clean target @@ -108,490 +97,19 @@ clean/fast: clean # Prepare targets for installation. preinstall: all - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/preinstall + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/source/preinstall .PHONY : preinstall # Prepare targets for installation. preinstall/fast: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/preinstall + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(MAKE) -f CMakeFiles/Makefile2 DENSE/test/her_model_2014/source/preinstall .PHONY : preinstall/fast # clear depends depend: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1 .PHONY : depend -# Convenience name for target. -source/CMakeFiles/csv_gen.dir/rule: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/CMakeFiles/csv_gen.dir/rule -.PHONY : source/CMakeFiles/csv_gen.dir/rule - -# Convenience name for target. -csv_gen: source/CMakeFiles/csv_gen.dir/rule - -.PHONY : csv_gen - -# fast build rule for target. -csv_gen/fast: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/build -.PHONY : csv_gen/fast - -# Convenience name for target. -source/CMakeFiles/csv_gen_run.dir/rule: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/CMakeFiles/csv_gen_run.dir/rule -.PHONY : source/CMakeFiles/csv_gen_run.dir/rule - -# Convenience name for target. -csv_gen_run: source/CMakeFiles/csv_gen_run.dir/rule - -.PHONY : csv_gen_run - -# fast build rule for target. -csv_gen_run/fast: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen_run.dir/build.make source/CMakeFiles/csv_gen_run.dir/build -.PHONY : csv_gen_run/fast - -# Convenience name for target. -source/CMakeFiles/simulation_lib.dir/rule: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/CMakeFiles/simulation_lib.dir/rule -.PHONY : source/CMakeFiles/simulation_lib.dir/rule - -# Convenience name for target. -simulation_lib: source/CMakeFiles/simulation_lib.dir/rule - -.PHONY : simulation_lib - -# fast build rule for target. -simulation_lib/fast: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/build -.PHONY : simulation_lib/fast - -# Convenience name for target. -source/CMakeFiles/simulation.dir/rule: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f CMakeFiles/Makefile2 source/CMakeFiles/simulation.dir/rule -.PHONY : source/CMakeFiles/simulation.dir/rule - -# Convenience name for target. -simulation: source/CMakeFiles/simulation.dir/rule - -.PHONY : simulation - -# fast build rule for target. -simulation/fast: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation.dir/build.make source/CMakeFiles/simulation.dir/build -.PHONY : simulation/fast - -core/build_once.o: core/build_once.cpp.o - -.PHONY : core/build_once.o - -# target to build an object file -core/build_once.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/core/build_once.cpp.o -.PHONY : core/build_once.cpp.o - -core/build_once.i: core/build_once.cpp.i - -.PHONY : core/build_once.i - -# target to preprocess a source file -core/build_once.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/core/build_once.cpp.i -.PHONY : core/build_once.cpp.i - -core/build_once.s: core/build_once.cpp.s - -.PHONY : core/build_once.s - -# target to generate assembly for a file -core/build_once.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/core/build_once.cpp.s -.PHONY : core/build_once.cpp.s - -csv_gen.o: csv_gen.cpp.o - -.PHONY : csv_gen.o - -# target to build an object file -csv_gen.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/csv_gen.cpp.o -.PHONY : csv_gen.cpp.o - -csv_gen.i: csv_gen.cpp.i - -.PHONY : csv_gen.i - -# target to preprocess a source file -csv_gen.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/csv_gen.cpp.i -.PHONY : csv_gen.cpp.i - -csv_gen.s: csv_gen.cpp.s - -.PHONY : csv_gen.s - -# target to generate assembly for a file -csv_gen.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/csv_gen.cpp.s -.PHONY : csv_gen.cpp.s - -io/arg_parse.o: io/arg_parse.cpp.o - -.PHONY : io/arg_parse.o - -# target to build an object file -io/arg_parse.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/arg_parse.cpp.o -.PHONY : io/arg_parse.cpp.o - -io/arg_parse.i: io/arg_parse.cpp.i - -.PHONY : io/arg_parse.i - -# target to preprocess a source file -io/arg_parse.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/arg_parse.cpp.i -.PHONY : io/arg_parse.cpp.i - -io/arg_parse.s: io/arg_parse.cpp.s - -.PHONY : io/arg_parse.s - -# target to generate assembly for a file -io/arg_parse.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/arg_parse.cpp.s -.PHONY : io/arg_parse.cpp.s - -io/csvr.o: io/csvr.cpp.o - -.PHONY : io/csvr.o - -# target to build an object file -io/csvr.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr.cpp.o -.PHONY : io/csvr.cpp.o - -io/csvr.i: io/csvr.cpp.i - -.PHONY : io/csvr.i - -# target to preprocess a source file -io/csvr.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr.cpp.i -.PHONY : io/csvr.cpp.i - -io/csvr.s: io/csvr.cpp.s - -.PHONY : io/csvr.s - -# target to generate assembly for a file -io/csvr.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr.cpp.s -.PHONY : io/csvr.cpp.s - -io/csvr_sim.o: io/csvr_sim.cpp.o - -.PHONY : io/csvr_sim.o - -# target to build an object file -io/csvr_sim.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr_sim.cpp.o -.PHONY : io/csvr_sim.cpp.o - -io/csvr_sim.i: io/csvr_sim.cpp.i - -.PHONY : io/csvr_sim.i - -# target to preprocess a source file -io/csvr_sim.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr_sim.cpp.i -.PHONY : io/csvr_sim.cpp.i - -io/csvr_sim.s: io/csvr_sim.cpp.s - -.PHONY : io/csvr_sim.s - -# target to generate assembly for a file -io/csvr_sim.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvr_sim.cpp.s -.PHONY : io/csvr_sim.cpp.s - -io/csvw.o: io/csvw.cpp.o - -.PHONY : io/csvw.o - -# target to build an object file -io/csvw.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/io/csvw.cpp.o - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvw.cpp.o -.PHONY : io/csvw.cpp.o - -io/csvw.i: io/csvw.cpp.i - -.PHONY : io/csvw.i - -# target to preprocess a source file -io/csvw.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/io/csvw.cpp.i - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvw.cpp.i -.PHONY : io/csvw.cpp.i - -io/csvw.s: io/csvw.cpp.s - -.PHONY : io/csvw.s - -# target to generate assembly for a file -io/csvw.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/io/csvw.cpp.s - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/csvw.cpp.s -.PHONY : io/csvw.cpp.s - -io/ezxml/ezxml.o: io/ezxml/ezxml.c.o - -.PHONY : io/ezxml/ezxml.o - -# target to build an object file -io/ezxml/ezxml.c.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/ezxml/ezxml.c.o -.PHONY : io/ezxml/ezxml.c.o - -io/ezxml/ezxml.i: io/ezxml/ezxml.c.i - -.PHONY : io/ezxml/ezxml.i - -# target to preprocess a source file -io/ezxml/ezxml.c.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/ezxml/ezxml.c.i -.PHONY : io/ezxml/ezxml.c.i - -io/ezxml/ezxml.s: io/ezxml/ezxml.c.s - -.PHONY : io/ezxml/ezxml.s - -# target to generate assembly for a file -io/ezxml/ezxml.c.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/io/ezxml/ezxml.c.s -.PHONY : io/ezxml/ezxml.c.s - -main.o: main.cpp.o - -.PHONY : main.o - -# target to build an object file -main.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation.dir/build.make source/CMakeFiles/simulation.dir/main.cpp.o -.PHONY : main.cpp.o - -main.i: main.cpp.i - -.PHONY : main.i - -# target to preprocess a source file -main.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation.dir/build.make source/CMakeFiles/simulation.dir/main.cpp.i -.PHONY : main.cpp.i - -main.s: main.cpp.s - -.PHONY : main.s - -# target to generate assembly for a file -main.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation.dir/build.make source/CMakeFiles/simulation.dir/main.cpp.s -.PHONY : main.cpp.s - -sim/base.o: sim/base.cpp.o - -.PHONY : sim/base.o - -# target to build an object file -sim/base.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/base.cpp.o -.PHONY : sim/base.cpp.o - -sim/base.i: sim/base.cpp.i - -.PHONY : sim/base.i - -# target to preprocess a source file -sim/base.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/base.cpp.i -.PHONY : sim/base.cpp.i - -sim/base.s: sim/base.cpp.s - -.PHONY : sim/base.s - -# target to generate assembly for a file -sim/base.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/base.cpp.s -.PHONY : sim/base.cpp.s - -sim/determ/baby_cl.o: sim/determ/baby_cl.cpp.o - -.PHONY : sim/determ/baby_cl.o - -# target to build an object file -sim/determ/baby_cl.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/baby_cl.cpp.o -.PHONY : sim/determ/baby_cl.cpp.o - -sim/determ/baby_cl.i: sim/determ/baby_cl.cpp.i - -.PHONY : sim/determ/baby_cl.i - -# target to preprocess a source file -sim/determ/baby_cl.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/baby_cl.cpp.i -.PHONY : sim/determ/baby_cl.cpp.i - -sim/determ/baby_cl.s: sim/determ/baby_cl.cpp.s - -.PHONY : sim/determ/baby_cl.s - -# target to generate assembly for a file -sim/determ/baby_cl.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/baby_cl.cpp.s -.PHONY : sim/determ/baby_cl.cpp.s - -sim/determ/determ.o: sim/determ/determ.cpp.o - -.PHONY : sim/determ/determ.o - -# target to build an object file -sim/determ/determ.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/determ.cpp.o -.PHONY : sim/determ/determ.cpp.o - -sim/determ/determ.i: sim/determ/determ.cpp.i - -.PHONY : sim/determ/determ.i - -# target to preprocess a source file -sim/determ/determ.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/determ.cpp.i -.PHONY : sim/determ/determ.cpp.i - -sim/determ/determ.s: sim/determ/determ.cpp.s - -.PHONY : sim/determ/determ.s - -# target to generate assembly for a file -sim/determ/determ.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/determ/determ.cpp.s -.PHONY : sim/determ/determ.cpp.s - -sim/stoch/stoch.o: sim/stoch/stoch.cpp.o - -.PHONY : sim/stoch/stoch.o - -# target to build an object file -sim/stoch/stoch.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/stoch/stoch.cpp.o -.PHONY : sim/stoch/stoch.cpp.o - -sim/stoch/stoch.i: sim/stoch/stoch.cpp.i - -.PHONY : sim/stoch/stoch.i - -# target to preprocess a source file -sim/stoch/stoch.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/stoch/stoch.cpp.i -.PHONY : sim/stoch/stoch.cpp.i - -sim/stoch/stoch.s: sim/stoch/stoch.cpp.s - -.PHONY : sim/stoch/stoch.s - -# target to generate assembly for a file -sim/stoch/stoch.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/sim/stoch/stoch.cpp.s -.PHONY : sim/stoch/stoch.cpp.s - -utility/color.o: utility/color.cpp.o - -.PHONY : utility/color.o - -# target to build an object file -utility/color.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/utility/color.cpp.o - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/color.cpp.o -.PHONY : utility/color.cpp.o - -utility/color.i: utility/color.cpp.i - -.PHONY : utility/color.i - -# target to preprocess a source file -utility/color.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/utility/color.cpp.i - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/color.cpp.i -.PHONY : utility/color.cpp.i - -utility/color.s: utility/color.cpp.s - -.PHONY : utility/color.s - -# target to generate assembly for a file -utility/color.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/csv_gen.dir/build.make source/CMakeFiles/csv_gen.dir/utility/color.cpp.s - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/color.cpp.s -.PHONY : utility/color.cpp.s - -utility/common_utils.o: utility/common_utils.cpp.o - -.PHONY : utility/common_utils.o - -# target to build an object file -utility/common_utils.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/common_utils.cpp.o -.PHONY : utility/common_utils.cpp.o - -utility/common_utils.i: utility/common_utils.cpp.i - -.PHONY : utility/common_utils.i - -# target to preprocess a source file -utility/common_utils.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/common_utils.cpp.i -.PHONY : utility/common_utils.cpp.i - -utility/common_utils.s: utility/common_utils.cpp.s - -.PHONY : utility/common_utils.s - -# target to generate assembly for a file -utility/common_utils.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/common_utils.cpp.s -.PHONY : utility/common_utils.cpp.s - -utility/preprocessor.o: utility/preprocessor.cpp.o - -.PHONY : utility/preprocessor.o - -# target to build an object file -utility/preprocessor.cpp.o: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/preprocessor.cpp.o -.PHONY : utility/preprocessor.cpp.o - -utility/preprocessor.i: utility/preprocessor.cpp.i - -.PHONY : utility/preprocessor.i - -# target to preprocess a source file -utility/preprocessor.cpp.i: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/preprocessor.cpp.i -.PHONY : utility/preprocessor.cpp.i - -utility/preprocessor.s: utility/preprocessor.cpp.s - -.PHONY : utility/preprocessor.s - -# target to generate assembly for a file -utility/preprocessor.cpp.s: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(MAKE) -f source/CMakeFiles/simulation_lib.dir/build.make source/CMakeFiles/simulation_lib.dir/utility/preprocessor.cpp.s -.PHONY : utility/preprocessor.cpp.s - # Help Target help: @echo "The following are some of the valid targets for this Makefile:" @@ -599,57 +117,7 @@ help: @echo "... clean" @echo "... depend" @echo "... rebuild_cache" - @echo "... csv_gen" - @echo "... test" - @echo "... csv_gen_run" - @echo "... simulation_lib" - @echo "... simulation" @echo "... edit_cache" - @echo "... core/build_once.o" - @echo "... core/build_once.i" - @echo "... core/build_once.s" - @echo "... csv_gen.o" - @echo "... csv_gen.i" - @echo "... csv_gen.s" - @echo "... io/arg_parse.o" - @echo "... io/arg_parse.i" - @echo "... io/arg_parse.s" - @echo "... io/csvr.o" - @echo "... io/csvr.i" - @echo "... io/csvr.s" - @echo "... io/csvr_sim.o" - @echo "... io/csvr_sim.i" - @echo "... io/csvr_sim.s" - @echo "... io/csvw.o" - @echo "... io/csvw.i" - @echo "... io/csvw.s" - @echo "... io/ezxml/ezxml.o" - @echo "... io/ezxml/ezxml.i" - @echo "... io/ezxml/ezxml.s" - @echo "... main.o" - @echo "... main.i" - @echo "... main.s" - @echo "... sim/base.o" - @echo "... sim/base.i" - @echo "... sim/base.s" - @echo "... sim/determ/baby_cl.o" - @echo "... sim/determ/baby_cl.i" - @echo "... sim/determ/baby_cl.s" - @echo "... sim/determ/determ.o" - @echo "... sim/determ/determ.i" - @echo "... sim/determ/determ.s" - @echo "... sim/stoch/stoch.o" - @echo "... sim/stoch/stoch.i" - @echo "... sim/stoch/stoch.s" - @echo "... utility/color.o" - @echo "... utility/color.i" - @echo "... utility/color.s" - @echo "... utility/common_utils.o" - @echo "... utility/common_utils.i" - @echo "... utility/common_utils.s" - @echo "... utility/preprocessor.o" - @echo "... utility/preprocessor.i" - @echo "... utility/preprocessor.s" .PHONY : help @@ -661,6 +129,6 @@ help: # No rule that depends on this can have commands that come from listfiles # because they might be regenerated. cmake_check_build_system: - cd /home/mcclelnr/DENSE/test/her_model_2014 && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 + cd /home/mcclelnr/BENCHMARK_DENSE/DENSE_Research_Benchmarks && $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0 .PHONY : cmake_check_build_system diff --git a/test/ndiff b/test/ndiff new file mode 160000 index 00000000..a2be3a91 --- /dev/null +++ b/test/ndiff @@ -0,0 +1 @@ +Subproject commit a2be3a91e9f541a7b357f672c21b2e6fa491d794 diff --git a/test/simple_model/CMakeLists.txt b/test/simple_model/CMakeLists.txt new file mode 100644 index 00000000..70c7fe44 --- /dev/null +++ b/test/simple_model/CMakeLists.txt @@ -0,0 +1,56 @@ +include_directories("${CMAKE_CURRENT_SOURCE_DIR}") + +add_subdirectory("${DENSE_SOURCE_DIR}/source" "${CMAKE_CURRENT_BINARY_DIR}/source") + +GILLESPIE_SIMULATION(simple_gillespie ${CMAKE_CURRENT_SOURCE_DIR}) +STOCH_NR_SIMULATION(simple_nr ${CMAKE_CURRENT_SOURCE_DIR}) +REJECTION_BASED_SIMULATION(simple_rej ${CMAKE_CURRENT_SOURCE_DIR}) +LOG_DIRECT_SIMULATION(simple_log ${CMAKE_CURRENT_SOURCE_DIR}) + +set (test_args "-p ${CMAKE_CURRENT_SOURCE_DIR}/param_sets.csv -t 100 -c 100 -w 10 -u 0.01 -d ${CMAKE_CURRENT_SOURCE_DIR}/init_conc.csv -a ${CMAKE_CURRENT_SOURCE_DIR}/analesys.xml") +set (ndiff_cmd "${CMAKE_CURRENT_SOURCE_DIR}/maddiff ") +set (ndiff_args "${CMAKE_CURRENT_BINARY_DIR}/test.out ${CMAKE_CURRENT_SOURCE_DIR}/test.ref ${CMAKE_CURRENT_SOURCE_DIR}/test.cfg") + +set (run_gillespie_cmd ${CMAKE_CURRENT_BINARY_DIR}/simple_gillespie) + +add_test("simple-gillespie-test" + ${CMAKE_COMMAND} + -D test_cmd=${run_gillespie_cmd} + -D test_args:string=${test_args} + -D cmp=${ndiff_cmd} + -D args:string=${ndiff_args} + -P ${CMAKE_SOURCE_DIR}/test/simple_model/run_test.cmake +) + +set (run_nr_cmd ${CMAKE_CURRENT_BINARY_DIR}/simple_nr) + +add_test("simple-nr-test" + ${CMAKE_COMMAND} + -D test_cmd=${run_nr_cmd} + -D test_args:string=${test_args} + -D cmp=${ndiff_cmd} + -D args:string=${ndiff_args} + -P ${CMAKE_SOURCE_DIR}/test/simple_model/run_test.cmake +) + +set (run_rej_cmd ${CMAKE_CURRENT_BINARY_DIR}/simple_rej) + +add_test("simple-rej-test" + ${CMAKE_COMMAND} + -D test_cmd=${run_rej_cmd} + -D test_args:string=${test_args} + -D cmp=${ndiff_cmd} + -D args:string=${ndiff_args} + -P ${CMAKE_SOURCE_DIR}/test/simple_model/run_test.cmake +) + +set (run_log_cmd ${CMAKE_CURRENT_BINARY_DIR}/simple_log) + +add_test("log-direct-test" + ${CMAKE_COMMAND} + -D test_cmd=${run_log_cmd} + -D test_args:string=${test_args} + -D cmp=${ndiff_cmd} + -D args:string=${ndiff_args} + -P ${CMAKE_SOURCE_DIR}/test/simple_model/run_test.cmake +) diff --git a/test/simple_model/analesys.xml b/test/simple_model/analesys.xml new file mode 100644 index 00000000..8b5d5727 --- /dev/null +++ b/test/simple_model/analesys.xml @@ -0,0 +1,10 @@ + + + ASPECIE + 0 + 99 + 0 + 100 + TEST.out + + diff --git a/test/simple_model/init_conc.csv b/test/simple_model/init_conc.csv new file mode 100644 index 00000000..d95c98fc --- /dev/null +++ b/test/simple_model/init_conc.csv @@ -0,0 +1 @@ + ,100,, diff --git a/test/simple_model/model_impl.hpp b/test/simple_model/model_impl.hpp new file mode 100644 index 00000000..0a4709d6 --- /dev/null +++ b/test/simple_model/model_impl.hpp @@ -0,0 +1,46 @@ +// In this header file, define your model! +// This includes functions to describe each reaction. +// Make sure that you've first completed reaction_list.h and specie_list.h +#ifndef MODEL_IMPL_H +#define MODEL_IMPL_H +#include "core/reaction.hpp" +#include "core/specie.hpp" +#include "core/model.hpp" +#include "sim/base.hpp" +//#include "context.hpp" +#include + +/* + +Define all of your reaction rate functions in `model_impl.hpp`. +For example, if you enumerated a reaction `R_ONE`, you should declare a + function like this: + + RATETYPE reaction::active_rate(const Ctxt& c) { return 6.0; } + + +Or, for a more interesting reaction rate, you might do something like: + + + RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(R_TWO) * c.getCon(SPECIE_ONE) * c.neighbors.calculateNeighborAvg(SPECIE_TWO); + } + +Refer to the Context API (Section ) for instructions on how to get delays + and critical values for more complex reaction rate functions. + +*/ + +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(synthesis)/(5.0f+c.getCon(ASPECIE)); +} + +template<> +template +RATETYPE reaction::active_rate(const Ctxt& c) { + return c.getRate(degradation)*c.getCon(ASPECIE); +} + +#endif // MODEL_IMPL_H diff --git a/test/simple_model/param_sets.csv b/test/simple_model/param_sets.csv new file mode 100644 index 00000000..0832aac5 --- /dev/null +++ b/test/simple_model/param_sets.csv @@ -0,0 +1,17 @@ +# CSV Specification,,,, +# Ignored by the file readers are:,,,, +# (1) Empty cells / Blank rows / Whitespace,,,, +# (2) Comment whose rows always begin with a '#',,,, +# For best results delete all comments before loading this file into any Excel-like program.,,,, +# (3) Any cell which does not conform to the scientific notation format 3.14e-41 or simple whole numbers and decimals,,,, +# Often times cells which do not contain numbers are intended to be column headers. These are not parsed by the simulation and can technically be modified by the users as they wish.,,,, +# It is futile to add/remove/modify the column headers with the expectation of changing the program's behavior. Data must be entered in the default order for it to be parsed correctly.,,,, +# None of these comments include commas because it messes with the column widths when loaded into Excel-like programs.,,,, +# For more information and examples see README.md section 2.2.0,,,, +,,,, +"# Rename this file by removing the ""_template"" from the file name (or just change the name entirely) once the data has been entered!",,,, +# This file can contain more than one set (each being on their own line). All sets are initialized and executed in parallel when a file is loaded into the simulation.,,,, +# For more information and examples see README.md section 2.2.1,,,, +,,,, +synthesis, degradation, , , +105000,10,,, diff --git a/test/simple_model/reaction_deltas.hpp b/test/simple_model/reaction_deltas.hpp new file mode 100644 index 00000000..a7e0c94b --- /dev/null +++ b/test/simple_model/reaction_deltas.hpp @@ -0,0 +1,27 @@ +#include "utility/common_utils.hpp" +#include "core/reaction.hpp" + +#include + +/* + +Define each reaction's reactants and products in reaction_deltas.hpp. +Say a reaction enumerated as R_ONE has the following chemical formula: + + 2A + B --> C + +The proper way to define that reaction's state change vector is as follows: + +STATIC_VAR int num_deltas_R_ONE = 3; +STATIC_VAR int deltas_R_ONE[] = {-2, -1, 1}; +STATIC_VAR specie_id delta_ids_R_ONE[] = {A, B, C}; + +*/ + +STATIC_VAR int num_deltas_synthesis = 1; +STATIC_VAR int deltas_synthesis[] = {1}; +STATIC_VAR specie_id delta_ids_synthesis[] = {ASPECIE}; + +STATIC_VAR int num_deltas_degradation = 1; +STATIC_VAR int deltas_degradation[] = {-1}; +STATIC_VAR specie_id delta_ids_degradation[] = {ASPECIE}; \ No newline at end of file diff --git a/test/simple_model/reactions_list.hpp b/test/simple_model/reactions_list.hpp new file mode 100644 index 00000000..c77a3b0f --- /dev/null +++ b/test/simple_model/reactions_list.hpp @@ -0,0 +1,21 @@ +/* +Declare reactions in `reactions_list.hpp`. List the reaction names between the two sets of C++ macros (the lines that begin with `#`) in the same format as below. The following example lists one delay reaction, `alpha_synthesis`, and three normal reactions, `bravo_synthesis`, `alpha_degredation`, and `bravo_degredation`. While this particular reaction naming scheme is not required, it can be helpful. + DELAY_REACTION(alpha_synthesis) + REACTION(bravo_synthesis) + REACTION(alpha_degredation) + REACTION(bravo_degredation) +*/ + +#ifndef DELAY_REACTION +#define DELAY_REACTION REACTION +#define UNDO_DELAY_REACTION_DEF +#endif + +//DEFINE REACTIONS HERE +REACTION(synthesis) +REACTION(degradation) + +#ifdef UNDO_DELAY_REACTION_DEF +#undef DELAY_REACTION +#undef UNDO_DELAY_REACTION_DEF +#endif \ No newline at end of file diff --git a/test/simple_model/run_test.cmake b/test/simple_model/run_test.cmake new file mode 100644 index 00000000..ae4f736a --- /dev/null +++ b/test/simple_model/run_test.cmake @@ -0,0 +1,25 @@ +message(${test_cmd} ${test_args} ) +separate_arguments( test_args ) + +execute_process( + COMMAND ${test_cmd} ${test_args} + OUTPUT_VARIABLE run + RESULT_VARIABLE run_fail +) + +message (${cmp} ${args}) +separate_arguments(args) + +execute_process( + COMMAND ${cmp} ${args} + ERROR_VARIABLE diffout +) + +if(run_fail) + message( SEND_ERROR "error running simulation" ) +endif() + +if(${diffout} MATCHES "diffs have been detected") + message( SEND_ERROR "test.out does not match test.ref!" ) +endif() + diff --git a/test/simple_model/specie_list.hpp b/test/simple_model/specie_list.hpp new file mode 100644 index 00000000..c1df3ef3 --- /dev/null +++ b/test/simple_model/specie_list.hpp @@ -0,0 +1,23 @@ +/* +Declare species in `specie_list.hpp`. List the specie names between the + two sets of C++ macros (the lines that begin with `#`) in the same format + as below. The following example lists two species, `alpha` and `bravo`, + and one critical speice, `charlie`. + SPECIE(alpha) + SPECIE(bravo) + CRITICAL_SPECIE(charlie) +*/ +#ifndef CRITICAL_SPECIE +#define CRITICAL_SPECIE SPECIE +#define UNDO_CRITICAL_SPECIE_DEF +#endif + +//DEFINE SPECIES HERE + +SPECIE(ASPECIE) + + +#ifdef UNDO_CRITICAL_SPECIE_DEF +#undef CRITICAL_SPECIE +#undef UNDO_CRITICAL_SPECIE_DEF +#endif \ No newline at end of file diff --git a/test/simple_model/test.cfg b/test/simple_model/test.cfg new file mode 100644 index 00000000..364e3dd6 --- /dev/null +++ b/test/simple_model/test.cfg @@ -0,0 +1,13 @@ +#rows cols commands +1 * skip +4 * skip +6 * abs=0.5 +8 * skip +10 * abs=0.3 + + + + + + + diff --git a/test/simple_model/test.ref b/test/simple_model/test.ref new file mode 100644 index 00000000..dbf0cbd8 --- /dev/null +++ b/test/simple_model/test.ref @@ -0,0 +1,10 @@ +# Showing cells 0-99 until 100.04 min +ASPECIE +Minimum Concentration: +70 +Mean Concentration: +100 +Maximum Concentration: +133 +Standard Deviation: +7