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

Can't compile models on a M3 Macbook Pro #177

Closed
sbfnk opened this issue Dec 10, 2024 · 1 comment · Fixed by #178
Closed

Can't compile models on a M3 Macbook Pro #177

sbfnk opened this issue Dec 10, 2024 · 1 comment · Fixed by #178
Labels
bug Something isn't working

Comments

@sbfnk
Copy link
Contributor

sbfnk commented Dec 10, 2024

This is on an M3 Mac

To Reproduce

library("primarycensored")
pcd_model <- pcd_cmdstan_model()
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:858:47: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
#>   858 |         std::vector<int>{dist_id, primary_id, stan::math::size(params),
#>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:944:18: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_cdf<int, std::vector<double>, int, std::vector<double>, nullptr>' requested here
#>   944 |                  primarycensored_cdf(d, dist_id, params, pwindow,
#>       |                  ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:1028:21: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_lcdf<int, std::vector<double>, int, std::vector<double>, nullptr>' requested here
#>  1028 |     log_cdf_upper = primarycensored_lcdf(d_upper, dist_id, params, pwindow,
#>       |                     ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:2813:15: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_lpmf<false, int, std::vector<double>, int, std::vector<double>, nullptr>' requested here
#>  2813 |               primarycensored_lpmf<false>(
#>       |               ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:3257:12: note: in instantiation of function template specialization 'pcens_model_model_namespace::pcens_model_model::log_prob_impl<false, false, Eigen::Matrix<double, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>' requested here
#>  3257 |     return log_prob_impl<propto__, jacobian__>(params_r, params_i, pstream);
#>       |            ^
#> /Users/eidesfun/.cmdstan/cmdstan-2.35.0/stan/src/stan/model/model_base_crtp.hpp:93:50: note: in instantiation of function template specialization 'pcens_model_model_namespace::pcens_model_model::log_prob<false, false, double>' requested here
#>    93 |     return static_cas
#> t<const M*>(this)->template log_prob<false, false, double>(
#>       |                                                  ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:2407:3: note: in instantiation of member function 'stan::model::model_base_crtp<pcens_model_model_namespace::pcens_model_model>::log_prob' requested here
#>  2407 |   ~pcens_model_model() {}
#>       |   ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:858:47: note: insert an explicit cast to silence this issue
#>   858 |         std::vector<int>{dist_id, primary_id, stan::math::size(params),
#>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
#>       |                                               static_cast<int>(       )
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:859:11: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
#>   859 |           stan::math::size(primary_params)}, "assigning variable ids");
#>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:859:11: note: insert an explicit cast to silence this issue
#>   859 |           stan::math::size(primary_params)}, "assigning variable ids");
#>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#>       |           static_cast<int>(               )
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:858:47: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
#>   858 |         std::vector<int>{dist_id, primary_id, stan::math::size(params),
#>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:944:18: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_cdf<int, std::vector<stan::math::var_value<double>>, int, std::vector<stan::math::var_value<double>>, nullptr>' requested here
#>   944 |                  primarycensored_cdf(d, dist_id, params, pwindow,
#>       |                  ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:1028:21: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_lcdf<int, std::vector<stan::math::var_value<double>>, int, std::vector<stan::math::var_value<double>>, nullptr>' requested here
#>  1028 |     log_cdf_upper = primarycensored_lcdf(d_upper, dist_id, params, pwindow,
#>       |                     ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:2928:15: note: in instantiation of function template specialization 'pcens_model_model_namespace::primarycensored_lpmf<false, int, std::vector<stan::math::var_value<double>>, int, std::vector<stan::math::var_value<double>>, nullptr>' requested here
#>  2928 |               primarycensored_lpmf<false>(
#>       |               ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:3257:12: note: in instantiation of function template specialization 'pcens_model_model_namespace::pcens_model_model::log_prob_impl<false, false, Eigen::Matrix<stan::math::var_value<double>, -1, 1>, Eigen::Matrix<int, -1, 1>, nullptr, nullptr, nullptr>'
#>  requested here
#>  3257 |     return log_prob_impl<propto__, jacobian__>(params_r, par
#> ams_i, pstream);
#>       |            ^
#> /Users/eidesfun/.cmdstan/cmdstan-2.35.0/stan/src/stan/model/model_base_crtp.hpp:98:50: note: in instantiation of function template specialization 'pcens_model_model_namespace::pcens_model_model::log_prob<false, false, stan::math::var_value<double>>' requested here
#>    98 |     return static_cast<const M*>(this)->template log_prob<false, false>(theta,
#>       |                                                  ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:2407:3: note: in instantiation of member function 'stan::model::model_base_crtp<pcens_model_model_namespace::pcens_model_model>::log_prob' requested here
#>  2407 |   ~pcens_model_model() {}
#>       |   ^
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:858:47: note: insert an explicit cast to silence this issue
#>   858 |         std::vector<int>{dist_id, primary_id, stan::math::size(params),
#>       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~
#>       |                                               static_cast<int>(       )
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:859:11: error: non-constant-expression cannot be narrowed from type 'size_t' (aka 'unsigned long') to 'int' in initializer list [-Wc++11-narrowing]
#>   859 |           stan::math::size(primary_params)}, "assigning variable ids");
#>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#> /var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.hpp:859:11: note: insert an explicit cast to silence this issue
#>   859 |           stan::math::size(primary_params)}, "assigning variable ids");
#>       |           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#>       |           static_cast<int>(               )
#> 4 errors generated.
#> make: *** [/var/folders/n9/h_419gjj2mg3d208nplgvbg40000gp/T/RtmpBrnglH/model-11fed4638ba62.o] Error 1
#> Error: An error occured during compilation! See the message above for more information.

Created on 2024-12-10 with reprex v2.1.1

@seabbs
Copy link
Contributor

seabbs commented Dec 10, 2024

I'm a bit confused about this one given all the CI passes? Happy to merge in the PR though as it also works on all the CI

@seabbs seabbs changed the title Can't compile models Can't compile models on a M3 Macbook Pro Dec 11, 2024
@seabbs seabbs added the bug Something isn't working label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants