-
-
Notifications
You must be signed in to change notification settings - Fork 65
Bugfix clearing stdout stderr on finish & cleanup #522
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
Changes from all commits
79ac83a
8548a04
455128f
fa95946
12f6632
53d78ee
9983acf
94d81d4
283c04e
1a406ab
24568a3
5152770
e44a0d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -457,18 +457,7 @@ compile <- function(quiet = TRUE, | |
} | ||
} | ||
|
||
stancflags_val <- "" | ||
if (!is.null(include_paths)) { | ||
checkmate::assert_directory_exists(include_paths, access = "r") | ||
include_paths <- absolute_path(include_paths) | ||
include_paths <- paste0(include_paths, collapse = ",") | ||
if (cmdstan_version() >= "2.24") { | ||
include_paths_flag <- " --include-paths=" | ||
} else { | ||
include_paths_flag <- " --include_paths=" | ||
} | ||
stancflags_val <- paste0(stancflags_val, include_paths_flag, include_paths, " ") | ||
} | ||
stancflags_val <- include_paths_stanc3_args(include_paths) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code is repeated in check_syntax, so I added a utility function with a test. |
||
|
||
if (pedantic) { | ||
stanc_options[["warn-pedantic"]] <- TRUE | ||
|
@@ -491,7 +480,7 @@ compile <- function(quiet = TRUE, | |
stanc_built_options <- c(stanc_built_options, paste0("--", option_name, "=", "'", stanc_options[[i]], "'")) | ||
} | ||
} | ||
stancflags_val <- paste0("STANCFLAGS += ", stancflags_val, paste0(stanc_built_options, collapse = " ")) | ||
stancflags_val <- paste0("STANCFLAGS += ", stancflags_val, paste0(" ", stanc_built_options, collapse = " ")) | ||
run_log <- processx::run( | ||
command = make_cmd(), | ||
args = c(tmp_exe, | ||
|
@@ -612,18 +601,7 @@ check_syntax <- function(pedantic = FALSE, | |
stanc_options[["warn-pedantic"]] <- TRUE | ||
} | ||
|
||
stancflags_val <- NULL | ||
if (!is.null(include_paths)) { | ||
checkmate::assert_directory_exists(include_paths, access = "r") | ||
include_paths <- absolute_path(include_paths) | ||
include_paths <- paste0(include_paths, collapse = ",") | ||
if (cmdstan_version() >= "2.24") { | ||
include_paths_flag <- " --include-paths=" | ||
} else { | ||
include_paths_flag <- " --include_paths=" | ||
} | ||
stancflags_val <- trimws(paste0(include_paths_flag, include_paths, " ")) | ||
} | ||
stancflags_val <- include_paths_stanc3_args(include_paths) | ||
|
||
if (is.null(stanc_options[["name"]])) { | ||
stanc_options[["name"]] <- paste0(self$model_name(), "_model") | ||
|
@@ -1394,3 +1372,19 @@ cpp_options_to_compile_flags <- function(cpp_options) { | |
} | ||
cpp_built_options | ||
} | ||
|
||
include_paths_stanc3_args <- function(include_paths = NULL) { | ||
stancflags <- NULL | ||
if (!is.null(include_paths)) { | ||
checkmate::assert_directory_exists(include_paths, access = "r") | ||
include_paths <- absolute_path(include_paths) | ||
include_paths <- paste0(include_paths, collapse = ",") | ||
if (cmdstan_version() >= "2.24") { | ||
include_paths_flag <- "--include-paths=" | ||
} else { | ||
include_paths_flag <- "--include_paths=" | ||
} | ||
stancflags <- paste0(stancflags, include_paths_flag, include_paths) | ||
} | ||
stancflags | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,9 +60,7 @@ is_rosetta2 <- function() { | |
|
||
# Returns the type of make command to use to compile depending on the OS | ||
make_cmd <- function() { | ||
# CmdStan 2.21 introduced TBB that requires mingw32-make on Windows | ||
ver <- .cmdstanr$VERSION | ||
if (os_is_windows() && (is.null(ver) || ver >= "2.21")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This check for versions is not needed. CmdStan 2.20 and earlier will still work with mingw32-make (its just that 2.21 and on requires mingw32-make). The toolchain installation for Windows is made in such a way that users will always have mingw32-make (3.x or 4.x). Not to mention I doubt anyone uses CmdStan 2.20 with CmdStanR :) |
||
if (os_is_windows()) { | ||
"mingw32-make.exe" | ||
} else { | ||
"make" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has not been needed for some time, we just haven't cleaned it up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, always nice to delete a bunch of code!