Skip to content

Commit

Permalink
deploy: c8d0fac
Browse files Browse the repository at this point in the history
  • Loading branch information
andrjohns committed Dec 24, 2023
1 parent 7fdc21f commit f4fc20a
Show file tree
Hide file tree
Showing 20 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/macosx/big-sur-x86_64/contrib/4.3/PACKAGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Imports: Rcpp, RcppParallel, posterior, methods, stats, callr
LinkingTo: Rcpp, RcppEigen, BH, RcppParallel, rapidjsonr
Suggests: testthat (>= 3.0.0)
License: MIT + file LICENSE
MD5sum: 5d9486d8fd6f18fb573545173ba3de81
MD5sum: 342b18e9b4fc195abb634ec4f35d00b2
Binary file modified bin/macosx/big-sur-x86_64/contrib/4.3/PACKAGES.gz
Binary file not shown.
Binary file modified bin/macosx/big-sur-x86_64/contrib/4.3/PACKAGES.rds
Binary file not shown.
Binary file modified bin/macosx/big-sur-x86_64/contrib/4.3/StanEstimators_0.0.0.9000.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion bin/macosx/contrib/4.2/PACKAGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ Imports: Rcpp, RcppParallel, posterior, methods, stats, callr
LinkingTo: Rcpp, RcppEigen, BH, RcppParallel, rapidjsonr
Suggests: testthat (>= 3.0.0)
License: MIT + file LICENSE
MD5sum: d45d17d45bbd9e9e6198d4f9defcff82
MD5sum: d790b92733f6c37d7a2ad9896c2550ca
Binary file modified bin/macosx/contrib/4.2/PACKAGES.gz
Binary file not shown.
Binary file modified bin/macosx/contrib/4.2/PACKAGES.rds
Binary file not shown.
Binary file modified bin/macosx/contrib/4.2/StanEstimators_0.0.0.9000.tgz
Binary file not shown.
Binary file modified bin/windows/contrib/4.2/StanEstimators_0.0.0.9000.zip
Binary file not shown.
Binary file modified bin/windows/contrib/4.3/StanEstimators_0.0.0.9000.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16 changes: 16 additions & 0 deletions inst/include/cmdstan/command.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ stan::math::mpi_cluster &get_mpi_cluster() {
#endif

int command(int argc, const char *argv[]) {
Rcpp::Rcout << "a" << std::endl;
stan::callbacks::stream_writer info(Rcpp::Rcout);
stan::callbacks::stream_writer err(Rcpp::Rcerr);
stan::callbacks::stream_logger logger(Rcpp::Rcout, Rcpp::Rcout, Rcpp::Rcout,
Expand Down Expand Up @@ -153,15 +154,18 @@ int command(int argc, const char *argv[]) {
throw std::invalid_argument(thread_msg.str());
}
}
Rcpp::Rcout << "b" << std::endl;
stan::math::init_threadpool_tbb(num_threads);

unsigned int num_chains = get_num_chains(parser);
check_file_config(parser);
Rcpp::Rcout << "c" << std::endl;

parser.print(info);
write_parallel_info(info);
write_opencl_device(info);
info();
Rcpp::Rcout << "d" << std::endl;

// General config for all methods
unsigned int id = get_arg_val<int_argument>(parser, "id");
Expand All @@ -171,17 +175,21 @@ int command(int argc, const char *argv[]) {
//////////////////////////////////////////////////
// Initialize Model //
//////////////////////////////////////////////////
Rcpp::Rcout << "e" << std::endl;
arg_seed *random_arg
= dynamic_cast<arg_seed *>(parser.arg("random")->arg("seed"));
unsigned int random_seed = random_arg->random_value();

std::string filename = get_arg_val<string_argument>(parser, "data", "file");

Rcpp::Rcout << "f" << std::endl;
std::shared_ptr<stan::io::var_context> var_context
= get_var_context(filename);

Rcpp::Rcout << "g" << std::endl;
stan::model::model_base &model
= new_model(*var_context, random_seed, &Rcpp::Rcout);
Rcpp::Rcout << "h" << std::endl;

// Setup callbacks
stan::callbacks::interrupt interrupt;
Expand All @@ -196,9 +204,11 @@ int command(int argc, const char *argv[]) {
std::vector<stan::callbacks::json_writer<std::ofstream>>
diagnostic_json_writers;

Rcpp::Rcout << "i" << std::endl;
init_callbacks(parser, sample_writers, diagnostic_csv_writers,
diagnostic_json_writers);

Rcpp::Rcout << "j" << std::endl;
// Setup initial parameter values - arg "init"
// arg is either filename or init radius value
std::string init = get_arg_val<string_argument>(parser, "init");
Expand All @@ -209,10 +219,13 @@ int command(int argc, const char *argv[]) {
} catch (const std::logic_error &e) {
}

Rcpp::Rcout << "k" << std::endl;
std::vector<std::shared_ptr<stan::io::var_context>> init_contexts
= get_vec_var_context(init, num_chains, id);
Rcpp::Rcout << "l" << std::endl;
std::vector<std::string> model_compile_info = model.model_compile_info();

Rcpp::Rcout << "m" << std::endl;
for (int i = 0; i < num_chains; ++i) {
write_stan(sample_writers[i]);
write_model(sample_writers[i], model.model_name());
Expand All @@ -225,6 +238,7 @@ int command(int argc, const char *argv[]) {
write_model(diagnostic_csv_writers[i], model.model_name());
parser.print(diagnostic_csv_writers[i]);
}
Rcpp::Rcout << "n" << std::endl;

//////////////////////////////////////////////////
// Invoke Services //
Expand Down Expand Up @@ -460,12 +474,14 @@ int command(int argc, const char *argv[]) {
tol_rel_grad, tol_param, num_iterations, save_iterations,
refresh, interrupt, logger, init_writers[0], sample_writers[0]);
} else {
Rcpp::Rcout << "o" << std::endl;
return_code
= stan::services::optimize::lbfgs<stan::model::model_base, false>(
model, *(init_contexts[0]), random_seed, id, init_radius,
history_size, init_alpha, tol_obj, tol_rel_obj, tol_grad,
tol_rel_grad, tol_param, num_iterations, save_iterations,
refresh, interrupt, logger, init_writers[0], sample_writers[0]);
Rcpp::Rcout << "p" << std::endl;
}
}
// ---- optimize end ---- //
Expand Down
2 changes: 1 addition & 1 deletion src/contrib/PACKAGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Imports: Rcpp, RcppParallel, posterior, methods, stats, callr
LinkingTo: Rcpp, RcppEigen, BH, RcppParallel, rapidjsonr
Suggests: testthat (>= 3.0.0)
License: MIT + file LICENSE
MD5sum: 385130d622cb683f1671c30609a033d4
MD5sum: b8a31eb7c908680881bfbd01ea3c1f21
NeedsCompilation: yes
Binary file modified src/contrib/PACKAGES.gz
Binary file not shown.
Binary file modified src/contrib/PACKAGES.rds
Binary file not shown.
Binary file modified src/contrib/StanEstimators_0.0.0.9000.tar.gz
Binary file not shown.

0 comments on commit f4fc20a

Please sign in to comment.