Skip to content

Add process id to generated filenames #328

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

Merged
merged 3 commits into from
Oct 29, 2020
Merged

Add process id to generated filenames #328

merged 3 commits into from
Oct 29, 2020

Conversation

rok-cesnovar
Copy link
Member

Summary

Fixes #326

We could also use this just for output csv files where this is important.

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):
Rok Češnovar, Uni. of Ljubljana

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@rok-cesnovar
Copy link
Member Author

rok-cesnovar commented Oct 28, 2020

This fixes both the example from @bnicenboim as well as

library(cmdstanr)

file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.stan")
data_file <- file.path(cmdstan_path(), "examples", "bernoulli", "bernoulli.data.json")
model <- cmdstan_model(file)

out_parallel <-   parallel::mclapply(1:5, FUN = function(S) {
  out <- model$sample(data = data_file,
                      chains = 1L,
                      parallel_chains = 1L,
                      seed = S,
                      thin = 1L,
                      )
  list(output_files = out$output_files())
})

print(out_parallel)

@codecov-io
Copy link

Codecov Report

Merging #328 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #328   +/-   ##
=======================================
  Coverage   89.24%   89.24%           
=======================================
  Files          12       12           
  Lines        2538     2538           
=======================================
  Hits         2265     2265           
  Misses        273      273           
Impacted Files Coverage Δ
R/utils.R 72.06% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea13eba...b5b7460. Read the comment docs.

@jgabry
Copy link
Member

jgabry commented Oct 29, 2020

Looks good, will merge now!

@jgabry jgabry merged commit 005516f into master Oct 29, 2020
@jgabry jgabry deleted the fix_random_names branch October 29, 2020 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

strange behavior when cmdstanr is parallelized
3 participants