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

Expand the use of CMDSTAN variable #643

Merged
merged 2 commits into from
Apr 12, 2022
Merged

Conversation

rok-cesnovar
Copy link
Member

Submission Checklist

  • Run unit tests
  • Declare copyright holder and agree to license (see below)

Summary

Fixes #638

Expands the use of the CMDSTAN environment variable so that if a valid CmdStan installation is not found in the CMDSTAN path, it is used as the top level installation folder (cmdstan installations are a level below).

To test run:

Sys.setenv("CMDSTAN" = "/top/level/folder/of/cmdstan/installs")

library(cmdstanr)

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

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 Apr 9, 2022

@bwiernik when you have a moment, can I ask you to confirm this does what you proposed in #638.

No rush, whenever you get to it. Thanks!

remotes::install_github("stan-dev/cmdstanr@cmdstan-variable-refactor")
Sys.setenv("CMDSTAN" = "/top/level/folder/of/cmdstan/installs")

library(cmdstanr)

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2022

Codecov Report

Merging #643 (394f77f) into master (b62ad1f) will decrease coverage by 1.46%.
The diff coverage is 30.76%.

❗ Current head 394f77f differs from pull request most recent head a3d1d22. Consider uploading reports for the commit a3d1d22 to get more accurate results

@@            Coverage Diff             @@
##           master     #643      +/-   ##
==========================================
- Coverage   92.63%   91.16%   -1.47%     
==========================================
  Files          12       12              
  Lines        3406     3417      +11     
==========================================
- Hits         3155     3115      -40     
- Misses        251      302      +51     
Impacted Files Coverage Δ
R/zzz.R 64.15% <20.00%> (-10.85%) ⬇️
R/path.R 79.03% <66.66%> (-0.97%) ⬇️
R/install.R 58.35% <0.00%> (-8.52%) ⬇️
R/utils.R 89.63% <0.00%> (-1.04%) ⬇️
R/csv.R 97.78% <0.00%> (-0.89%) ⬇️
R/model.R 91.33% <0.00%> (-0.76%) ⬇️
R/run.R 95.23% <0.00%> (-0.50%) ⬇️

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 b62ad1f...a3d1d22. Read the comment docs.

@bwiernik
Copy link

I tried it out. It seems to be working, but there is still an unnecessary warning when the environment variable is set to a higher-level directory:

> Sys.setenv("CMDSTAN" = "~/cmdstanr")
> library(cmdstanr)
CmdStan path set to: /Users/brenton/cmdstanr/cmdstan-2.29.2
This is cmdstanr version 0.5.1
- CmdStanR documentation and vignettes: mc-stan.org/cmdstanr
- CmdStan path: /Users/brenton/cmdstanr/cmdstan-2.29.2
- CmdStan version: 2.29.2
Warning message:
Can't find CmdStan makefile to detect version number. Path may not point to valid installation. 

@rok-cesnovar
Copy link
Member Author

Ah, that was sloppy testing on my end. Thanks @bwiernik for testing! I think this should now be fixed.

In case that no installation is found but the env. variable is set, it will display a warning:

No CmdStan installation found in the path specified by the environment variable 'CMDSTAN'.

Copy link
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

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

Looks good!

@jgabry jgabry merged commit 6eee408 into master Apr 12, 2022
@jgabry jgabry deleted the cmdstan-variable-refactor branch April 12, 2022 18:56
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.

Set CMDSTAN environment variable to gloabl .cmdstanr directory rather than version
4 participants