Skip to content

Commit

Permalink
Merge branch 'develop' into feature/issue-2881-dense-metric-decomposi…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
bbbales2 committed Oct 28, 2020
2 parents 83ef803 + 2d23b06 commit d4dd953
Show file tree
Hide file tree
Showing 664 changed files with 243,141 additions and 241,854 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Describe what you expect the output to be. Knowing the correct behavior is also
Provide any additional information here.

#### Current Version:
v2.23.0
v2.24.0
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ stan.kdev4
.vscode/*

# clangd compiler database
compile_commands.json
compile_commands.json

# gdb
.gdb_history
44 changes: 42 additions & 2 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ def runTests(String testPath, Boolean separateMakeStep=true) {
finally { junit 'test/**/*.xml' }
}

def runTestsWin(String testPath) {
def runTestsWin(String testPath, Boolean separateMakeStep=true) {
withEnv(['PATH+TBB=./lib/stan_math/lib/tbb']) {
bat "runTests.py -j${env.PARALLEL} ${testPath} --make-only"
if (separateMakeStep) {
bat "runTests.py -j${env.PARALLEL} ${testPath} --make-only"
}
try { bat "runTests.py -j${env.PARALLEL} ${testPath}" }
finally { junit 'test/**/*.xml' }
}
Expand Down Expand Up @@ -245,6 +247,44 @@ pipeline {
}
post { always { deleteDir() } }
}
stage('Integration Windows') {
agent { label 'windows' }
when {
expression {
( env.BRANCH_NAME == "develop" ||
env.BRANCH_NAME == "master" ) &&
!skipRemainingStages
}
}
steps {
deleteDirWin()
unstash 'StanSetup'
setupCXX()
bat "mingw32-make -f lib/stan_math/make/standalone math-libs"
setupCXX(false)
runTestsWin("src/test/integration", separateMakeStep=false)
}
post { always { deleteDirWin() } }
}
stage('Math functions expressions test') {
agent any
steps {
unstash 'StanSetup'
setupCXX()
script {
dir("lib/stan_math/") {
withEnv(['PATH+TBB=./lib/tbb']) {
try { sh "./runTests.py -j${env.PARALLEL} test/expressions" }
finally { junit 'test/**/*.xml' }
}
withEnv(['PATH+TBB=./lib/tbb']) {
sh "python ./test/expressions/test_expression_testing_framework.py"
}
}
}
}
post { always { deleteDir() } }
}
}
when {
expression {
Expand Down
8 changes: 8 additions & 0 deletions RELEASE-NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ Note: these are the release notes for the stan-dev/stan repository.
Further changes may arise at the interface level (stan-dev/{rstan,
pystan, cmdstan}) and math library level (stan-dev/math).

v.2.24.0 (28 July 2020)
======================================================================

- `std::chrono` is now used for all timing purposes
- fixed a bug with generated quantities for vectors of length 1
- added `recover_memory` for normal exit of `log_prob_grad`
- replaced the use of `boost::` functions/metaprograms in favor of `std::` where applicable

v.2.23.0 (22 April 2020)
======================================================================

Expand Down
2 changes: 1 addition & 1 deletion lib/stan_math
Submodule stan_math updated 1328 files
19 changes: 13 additions & 6 deletions make/tests
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ else ifeq ($(OS),Linux)
endif

ifneq ($(STANC3),)

# build stanc3 from local installation
bin/stanc$(EXE) : $(call findfiles,$(STANC3)/src/,*.ml*) $(STANC#)
@mkdir -p $(dir $@)
cd $(STANC3) && echo "--- Rebuilding stanc ---\n" && dune build @install
cp $(STANC3)/_build/default/src/stanc/stanc.exe $@

else ifneq ($(STANC3_TEST_BIN_URL),)

# download stanc3 build from specific branch
Expand Down Expand Up @@ -114,7 +114,6 @@ STANC_TESTS := $(patsubst src/%.cpp,%$(EXE),$(STANC_TESTS_HEADERS))
$(STANC_TESTS_O) : test/libstanc.a
$(STANC_TESTS) : LDLIBS += $(LDLIBS_STANC)


############################################################
##
# Target to verify header files within Stan has
Expand Down Expand Up @@ -149,7 +148,12 @@ test-headers: $(HEADER_TESTS)
# compiles
##
.PHONY: %.hpp-test

ifneq ($(OS),Windows_NT)
test/test-models/good/%.hpp-test : O = 0
else
test/test-models/good/%.hpp-test : O = 1
endif
test/test-models/good/%.hpp-test : test/test-models/good/%.hpp test/test-model-main.cpp
$(COMPILE.cpp) -o $(DEV_NULL) -include $^

Expand Down Expand Up @@ -192,8 +196,11 @@ test/integration/mtu/%_2.cpp : src/test/integration/mtu/%.cpp test/integration/m

ifneq ($(OS),Windows_NT)
test/integration/mtu/%.o : CXXFLAGS += -fPIC
endif
test/integration/mtu/%.o : O = 0
else
test/integration/mtu/%.o : O = 1
endif

test/integration/mtu/%.o : %.cpp
$(COMPILE.cpp) -pipe -o $(DEV_NULL) -include $^

Expand Down Expand Up @@ -225,9 +232,9 @@ $(patsubst src/%.stan,%.hpp,$(TEST_MODELS)) : test/test-models/%.hpp : src/test/
# Generate C++ from Stan standalone functions
##
TEST_FUNCTIONS = $(call findfiles,src/test/test-models,*.stanfuncs)
$(patsubst src/%.stanfuncs,%.hpp,$(TEST_FUNCTIONS)) : test/test-models/%.hpp : src/test/test-models/%.stanfuncs test/test-models/stanc2$(EXE)
$(patsubst src/%.stanfuncs,%.hpp,$(TEST_FUNCTIONS)) : test/test-models/%.hpp : src/test/test-models/%.stanfuncs $(TEST_STANC)
@mkdir -p $(dir $@)
$(WINE) test/test-models/stanc2$(EXE) $< --o=$@
$(WINE) $(TEST_STANC) --standalone-functions $< --o=$@

##
# src/test/unit/lang/stanc_helper_test.cpp requires files to be read-only.
Expand Down
2 changes: 1 addition & 1 deletion src/doxygen/doxygen.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "Stan"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 2.23.0
PROJECT_NUMBER = 2.24.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
5 changes: 4 additions & 1 deletion src/stan/io/array_var_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_IO_ARRAY_VAR_CONTEXT_HPP

#include <stan/io/var_context.hpp>
#include <stan/io/validate_dims.hpp>
#include <stan/math.hpp>
#include <stan/math/prim/fun/Eigen.hpp>
#include <map>
Expand Down Expand Up @@ -349,7 +350,9 @@ class array_var_context : public var_context {
*/
void validate_dims(const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) const {}
const std::vector<size_t>& dims_declared) const {
stan::io::validate_dims(*this, stage, name, base_type, dims_declared);
}

/**
* Return a list of the names of the floating point variables in
Expand Down
5 changes: 4 additions & 1 deletion src/stan/io/chained_var_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_IO_CHAINED_VAR_CONTEXT_HPP

#include <stan/io/var_context.hpp>
#include <stan/io/validate_dims.hpp>
#include <string>
#include <vector>

Expand Down Expand Up @@ -72,7 +73,9 @@ class chained_var_context : public var_context {
*/
void validate_dims(const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) const {}
const std::vector<size_t>& dims_declared) const {
stan::io::validate_dims(*this, stage, name, base_type, dims_declared);
}
};
} // namespace io
} // namespace stan
Expand Down
44 changes: 2 additions & 42 deletions src/stan/io/dump.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_IO_DUMP_HPP

#include <stan/io/validate_zero_buf.hpp>
#include <stan/io/validate_dims.hpp>
#include <stan/io/var_context.hpp>
#include <stan/math/prim.hpp>
#include <boost/lexical_cast.hpp>
Expand Down Expand Up @@ -773,48 +774,7 @@ class dump : public stan::io::var_context {
void validate_dims(const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) const {
bool is_int_type = base_type == "int";
if (is_int_type) {
if (!contains_i(name)) {
std::stringstream msg;
msg << (contains_r(name) ? "int variable contained non-int values"
: "variable does not exist")
<< "; processing stage=" << stage << "; variable name=" << name
<< "; base type=" << base_type;
throw std::runtime_error(msg.str());
}
} else {
if (!contains_r(name)) {
std::stringstream msg;
msg << "variable does not exist"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; base type=" << base_type;
throw std::runtime_error(msg.str());
}
}
std::vector<size_t> dims = dims_r(name);
if (dims.size() != dims_declared.size()) {
std::stringstream msg;
msg << "mismatch in number dimensions declared and found in context"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; dims declared=";
dims_msg(msg, dims_declared);
msg << "; dims found=";
dims_msg(msg, dims);
throw std::runtime_error(msg.str());
}
for (size_t i = 0; i < dims.size(); ++i) {
if (dims_declared[i] != dims[i]) {
std::stringstream msg;
msg << "mismatch in dimension declared and found in context"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; position=" << i << "; dims declared=";
dims_msg(msg, dims_declared);
msg << "; dims found=";
dims_msg(msg, dims);
throw std::runtime_error(msg.str());
}
}
stan::io::validate_dims(*this, stage, name, base_type, dims_declared);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/stan/io/empty_var_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_IO_EMPTY_VAR_CONTEXT_HPP

#include <stan/io/var_context.hpp>
#include <stan/io/validate_dims.hpp>
#include <string>
#include <vector>

Expand Down Expand Up @@ -91,7 +92,9 @@ class empty_var_context : public var_context {
*/
void validate_dims(const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) const {}
const std::vector<size_t>& dims_declared) const {
stan::io::validate_dims(*this, stage, name, base_type, dims_declared);
}

/**
* Fill a list of the names of the floating point variables in
Expand Down
5 changes: 4 additions & 1 deletion src/stan/io/random_var_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define STAN_IO_RANDOM_VAR_CONTEXT_HPP

#include <stan/io/var_context.hpp>
#include <stan/io/validate_dims.hpp>
#include <boost/random/uniform_real_distribution.hpp>
#include <algorithm>
#include <limits>
Expand Down Expand Up @@ -191,7 +192,9 @@ class random_var_context : public var_context {
*/
void validate_dims(const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) const {}
const std::vector<size_t>& dims_declared) const {
stan::io::validate_dims(*this, stage, name, base_type, dims_declared);
}

/**
* Return the random initialization on the unconstrained scale.
Expand Down
72 changes: 72 additions & 0 deletions src/stan/io/validate_dims.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#ifndef STAN_IO_VALIDATE_DIMS_HPP
#define STAN_IO_VALIDATE_DIMS_HPP

#include <stan/io/var_context.hpp>
#include <string>
#include <vector>

namespace stan {
namespace io {

/**
* Check variable dimensions against variable declaration.
*
* @param context The var context to check.
* @param stage stan program processing stage
* @param name variable name
* @param base_type declared stan variable type
* @param dims variable dimensions
* @throw std::runtime_error if mismatch between declared
* dimensions and dimensions found in context.
*/
inline void validate_dims(const stan::io::var_context& context,
const std::string& stage, const std::string& name,
const std::string& base_type,
const std::vector<size_t>& dims_declared) {
bool is_int_type = base_type == "int";
if (is_int_type) {
if (!context.contains_i(name)) {
std::stringstream msg;
msg << (context.contains_r(name) ? "int variable contained non-int values"
: "variable does not exist")
<< "; processing stage=" << stage << "; variable name=" << name
<< "; base type=" << base_type;
throw std::runtime_error(msg.str());
}
} else {
if (!context.contains_r(name)) {
std::stringstream msg;
msg << "variable does not exist"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; base type=" << base_type;
throw std::runtime_error(msg.str());
}
}
std::vector<size_t> dims = context.dims_r(name);
if (dims.size() != dims_declared.size()) {
std::stringstream msg;
msg << "mismatch in number dimensions declared and found in context"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; dims declared=";
context.dims_msg(msg, dims_declared);
msg << "; dims found=";
context.dims_msg(msg, dims);
throw std::runtime_error(msg.str());
}
for (size_t i = 0; i < dims.size(); ++i) {
if (dims_declared[i] != dims[i]) {
std::stringstream msg;
msg << "mismatch in dimension declared and found in context"
<< "; processing stage=" << stage << "; variable name=" << name
<< "; position=" << i << "; dims declared=";
context.dims_msg(msg, dims_declared);
msg << "; dims found=";
context.dims_msg(msg, dims);
throw std::runtime_error(msg.str());
}
}
}

} // namespace io
} // namespace stan
#endif
Loading

0 comments on commit d4dd953

Please sign in to comment.