Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running multiple chains in one Stan program #987

Merged
merged 45 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a6beb44
adds command line options for multiple chain in adapt diag_e
SteveBronder Mar 6, 2021
fe10358
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Mar 6, 2021
9d01a8d
update to parallel nuts adapt sampler
SteveBronder Mar 25, 2021
59baf8b
update
SteveBronder Mar 25, 2021
fbca7ae
update with parallel argument
SteveBronder Mar 30, 2021
fca7202
update to develop
SteveBronder Mar 30, 2021
dfca52f
remove extra output files
SteveBronder Mar 30, 2021
6a1d2cf
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Mar 30, 2021
2088b14
update with dense_e_adapt
SteveBronder Mar 31, 2021
bfc6111
update with parallel and chains/threads args
SteveBronder Apr 13, 2021
c23eb83
Updates to parallel stan branch
SteveBronder May 12, 2021
050e282
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot May 12, 2021
2d3c3be
update to use recent changes from stan branch
SteveBronder Jun 15, 2021
8a1718e
update to develop
SteveBronder Jun 15, 2021
e78f407
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Jun 15, 2021
db7aab3
move chains argument from top level to sample
SteveBronder Jul 7, 2021
d1aaf50
remove pre-built examples
SteveBronder Jul 7, 2021
51789f9
update argument names
SteveBronder Jul 12, 2021
2de737b
update default num threads to 1 and check mismatch of STAN_NUM_THREADS
SteveBronder Jul 12, 2021
e791d64
update to review comments and bump Stan PR version
SteveBronder Jul 20, 2021
6242ee3
move stan version to normal version
SteveBronder Jul 27, 2021
1ba04b8
change back bernoulli example
SteveBronder Jul 27, 2021
425dfa6
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Jul 27, 2021
331e184
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Jul 27, 2021
4ddf7e0
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Jul 29, 2021
d8d625f
includes
SteveBronder Jul 29, 2021
26a4be0
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Aug 9, 2021
1810823
update fstream writer for setting precision
SteveBronder Aug 9, 2021
5863733
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Aug 9, 2021
e6f3452
update fstream get
SteveBronder Aug 9, 2021
f2bebfe
merge to develop
SteveBronder Aug 9, 2021
d4da0ef
update stan
SteveBronder Aug 9, 2021
f8a84bc
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Aug 9, 2021
ab9f185
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Aug 11, 2021
4e76e00
update make to compile stansummary etc when threading is on. Fixes sm…
SteveBronder Aug 12, 2021
c03addb
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Aug 12, 2021
96a7283
use test_model for multi chain test
SteveBronder Aug 12, 2021
b4b9953
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Aug 12, 2021
7facac5
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Aug 16, 2021
e80e5eb
adds id to the output name
SteveBronder Aug 16, 2021
45a3276
Merge remote-tracking branch 'origin/develop' into proto/multi-chain
SteveBronder Aug 24, 2021
2367739
Fix diagonstic file name and add check for diagnostic file name in mu…
SteveBronder Aug 24, 2021
422b26f
[Jenkins] auto-formatting by clang-format version 6.0.0-1ubuntu2~16.0…
stan-buildbot Aug 24, 2021
dc0d85b
update error message for num_chains/num_threads
SteveBronder Aug 24, 2021
bc4bc94
Merge branch 'proto/multi-chain' of github.com:stan-dev/cmdstan into …
SteveBronder Aug 24, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ make/local
src/docs/**/*.pdf

output.csv

output*.csv
*.d
# gdb
.gdb_history
4 changes: 2 additions & 2 deletions make/command
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ ifeq ($(CMDSTAN_SUBMODULES),1)
bin/cmdstan/stansummary.o : src/cmdstan/stansummary_helper.hpp
bin/cmdstan/%.o : src/cmdstan/%.cpp
@mkdir -p $(dir $@)
$(COMPILE.cpp) -fvisibility=hidden $(OUTPUT_OPTION) $<
$(COMPILE.cpp) -fvisibility=hidden $(OUTPUT_OPTION) $(LDLIBS) $<

.PRECIOUS: bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE)
bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE) : CPPFLAGS_MPI =
bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE) : LDFLAGS_MPI =
bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE) : LDFLAGS_MPI =
bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE) : LDLIBS_MPI =
bin/print$(EXE) bin/stansummary$(EXE) bin/diagnose$(EXE) : bin/%$(EXE) : bin/cmdstan/%.o
@mkdir -p $(dir $@)
Expand Down
4 changes: 2 additions & 2 deletions make/tests
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ test-headers: $(HEADER_TESTS)
TEST_MODELS := $(wildcard src/test/test-models/*.stan)

.PHONY: test-models-hpp
test-models-hpp:
$(MAKE) $(patsubst %.stan,%$(EXE),$(TEST_MODELS))
test-models-hpp:
$(MAKE) $(patsubst %.stan,%$(EXE),$(TEST_MODELS))

##
# Tests that depend on compiled models
Expand Down
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ build-mpi: $(MPI_TARGETS)

ifeq ($(CMDSTAN_SUBMODULES),1)
.PHONY: build
build: bin/stanc$(EXE) bin/stansummary$(EXE) bin/print$(EXE) bin/diagnose$(EXE) $(LIBSUNDIALS) $(MPI_TARGETS) $(TBB_TARGETS) $(CMDSTAN_MAIN_O) $(PRECOMPILED_MODEL_HEADER)
build: bin/stanc$(EXE) $(LIBSUNDIALS) $(MPI_TARGETS) $(TBB_TARGETS) $(CMDSTAN_MAIN_O) $(PRECOMPILED_MODEL_HEADER) bin/stansummary$(EXE) bin/print$(EXE) bin/diagnose$(EXE)
@echo ''
ifeq ($(OS),Windows_NT)
@echo 'NOTE: Please add $(TBB_BIN_ABSOLUTE_PATH) to your PATH variable.'
Expand Down Expand Up @@ -338,3 +338,6 @@ compile_info:
##
.PHONY: print-%
print-% : ; @echo $* = $($*)

.PHONY: clean-build
clean-build: clean-all build
4 changes: 2 additions & 2 deletions src/cmdstan/arguments/arg_id.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class arg_id : public int_argument {
_name = "id";
_description = "Unique process identifier";
_validity = "id >= 0";
_default = "0";
_default_value = 0;
_default = "1";
_default_value = 1;
_constrained = true;
_good_value = 2.0;
_bad_value = -1.0;
Expand Down
22 changes: 22 additions & 0 deletions src/cmdstan/arguments/arg_num_chains.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#ifndef CMDSTAN_ARGUMENTS_ARG_NUM_CHAINS_HPP
#define CMDSTAN_ARGUMENTS_ARG_NUM_CHAINS_HPP

#include <cmdstan/arguments/singleton_argument.hpp>

namespace cmdstan {

class arg_num_chains : public int_argument {
public:
arg_num_chains() : int_argument() {
_name = "num_chains";
_description = std::string("Number of chains");
_default = "1";
_default_value = 1;
_value = _default_value;
}

bool is_valid(int value) { return value > 0; }
};

} // namespace cmdstan
#endif
25 changes: 25 additions & 0 deletions src/cmdstan/arguments/arg_num_threads.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef CMDSTAN_ARGUMENTS_ARG_NUM_THREADS_HPP
#define CMDSTAN_ARGUMENTS_ARG_NUM_THREADS_HPP

#include <cmdstan/arguments/singleton_argument.hpp>

namespace cmdstan {

class arg_num_threads : public int_argument {
public:
arg_num_threads() : int_argument() {
_name = "num_threads";
_description = std::string("Number of threads available to the program.");
_default = "1";
_default_value = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we encode here a minimal and maximal value of 1 whenever STAN_THREADS is absent (I am not familiar with the argument processing stuff too much; so this is a naive q)? Whenever STAN_THREADS is defined, then there is no upper limit. I recall that others were not happy with using -1 for "use all cores". Instead "0" was preferred, but we probably keep that consistent.

_value = _default_value;
}
#ifdef STAN_THREADS
bool is_valid(int value) { return value > -2 && value != 0; }
#else
bool is_valid(int value) { return value == 1; }
#endif
};

} // namespace cmdstan
#endif
2 changes: 2 additions & 0 deletions src/cmdstan/arguments/arg_sample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CMDSTAN_ARGUMENTS_ARG_SAMPLE_HPP

#include <cmdstan/arguments/arg_adapt.hpp>
#include <cmdstan/arguments/arg_num_chains.hpp>
#include <cmdstan/arguments/arg_num_samples.hpp>
#include <cmdstan/arguments/arg_num_warmup.hpp>
#include <cmdstan/arguments/arg_sample_algo.hpp>
Expand All @@ -23,6 +24,7 @@ class arg_sample : public categorical_argument {
_subarguments.push_back(new arg_thin());
_subarguments.push_back(new arg_adapt());
_subarguments.push_back(new arg_sample_algo());
_subarguments.push_back(new arg_num_chains());
}
};

Expand Down
Loading