stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 269 forks source link

2 rstan-based R packages failing CRAN tests: install error on matrix_vector_product #1122

Closed ConnorDonegan closed 7 months ago

ConnorDonegan commented 7 months ago

Summary:

Two R packages that use Rstan now have installation errors on CRAN's additional tests:

https://cloud.r-project.org/web/checks/check_results_geostan.html

https://cran.r-project.org/web/checks/check_results_multinma.html

In both cases, installation is terminating on a matrix-vector product, for both its happening on Linux builds. These were both recently archived on CRAN for having errors on these install checks, and were returned to CRAN after https://github.com/stan-dev/rstan/issues/1111 was fixed - thank you for that!

Description:

Here's the output just before the install terminates:

geostan: /home/hornik/tmp/R.check/r-release-gcc/Work/build/Packages/RcppEigen/include/Eigen/src/Core/products/SelfadjointMatrixVector.h:41:6: note: by argument 4 of type ‘const double*’ to ‘static void Eigen::internal::selfadjoint_matrix_vector_product<Scalar, Index, StorageOrder, UpLo, ConjugateLhs, ConjugateRhs, Version>::run(Index, const Scalar*, Index, const Scalar*, Scalar*, Scalar) [with Scalar = double; Index = long int; int StorageOrder = 0; int UpLo = 1; bool ConjugateLhs = false; bool ConjugateRhs = false; int Version = 0]’ declared here 41 | void selfadjoint_matrix_vector_product<Scalar,Index,StorageOrder,UpLo,ConjugateLhs,ConjugateRhs,Version>::run( | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[1]: *** [/home/hornik/tmp/R.check/r-release-gcc/Work/build/etc/Makeconf:196: stanExports_foundation.o] Terminated

multinma: /home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/RcppEigen/include/Eigen/src/Core/products/TriangularMatrixVector.h:105:24**: note: by argument 5 of type ‘const double*’ to ‘static void Eigen::internal::triangular_matrix_vector_product<Index, Mode, LhsScalar, ConjLhs, RhsScalar, ConjRhs, 1, Version>::run(Index, Index, const LhsScalar*, Index, const RhsScalar*, Index, ResScalar*, Index, const ResScalar&) [with Index = long int; int Mode = 6; LhsScalar = double; bool ConjLhs = false; RhsScalar = double; bool ConjRhs = false; int Version = 0]’ declared here 105 | EIGEN_DONT_INLINE void triangular_matrix_vector_product<Index,Mode,LhsScalar,ConjLhs,RhsScalar,ConjRhs,RowMajor,Version> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[1]: *** [/home/hornik/tmp/R.check/r-patched-gcc/Work/build/etc/Makeconf:200: stanExports_survival_mspline.o] Terminated

Sorry this is all I know; I would be happy to do more to investigate or whatever, but have limited ability wrt rstan. Since they pass all the other normal tests, it seems its an issue for Stan rather than the R packages.

bob-carpenter commented 7 months ago

Although it's not on CRAN, you might want to check out cmdstanr. It's not as hard to install because it doesn't have binary compatibility requirements between Stan and R.

ConnorDonegan commented 7 months ago

Yeah, I see that may be the best option, understanding that support for downstream R packages can only go so far.

Does this look like an issue for these two R packages that probably won't be a concern for other (more central) purposes? It would help me to know if that's the case, since I expect I'll get a two-week warning from CRAN soon and then be taken down.

bob-carpenter commented 7 months ago

I didn't realize those were your packages. I'm afraid there's not an easy way to build a package on top of cmdstanr if that's the goal. @bgoodri is the one to talk to about RStan internals and development plan.

I'm also pinging @SteveBronder, who's our C++ expert in the matrix lib---he might be able to diagnose what's going on at the C++ level.

SteveBronder commented 7 months ago

I'll try to install these locally, but I'm having a hard time seeing where the error is in the log files for both packages. It looks like they are all warnings? Is there a warning limit for CRAN checks? It looks like they have -Wall on which should be off and -Wno-ignored-attributes

This warning I think is a compiler or boost bug

BH/include/boost/math/quadrature/detail/exp_sinh_detail.hpp:478:7: warning: non-standard suffix on floating constant [-Wpedantic]
  478 |       { 2.239451308457907276646263599248028318747e-2543Q, 4.087883914826209167187520163938786544603e-936Q, 7.764136408896555253208502557716060646316e-345Q, 2.569416154701911093162209102345213640613e-127Q, 2.705458070464053854934121429341356913371e-47Q, 7.491188348021113917760090371440516887521e-18Q, 5.198294603582515693057809058359470253018e-07Q, 0.005389922804577577496651910020276229582764Q, 0.1920600417448513371971708155403009636026Q, 1.140219687292143805081229623729334820659Q, 7.806184141505854070922571674663437423603Q, 497.9910059199034049204308876883447088185Q, 27016042.73379639480428530637021605662451Q, 172966369043668599418.5877957471751383371Q, 1.061675373362961296862509492541522509127e+55Q, 3.811736521949348274993846910907815663725e+149Q, 4.031589783270233530756613072386084762687e+406Q, 1.857591496578858801010210685679553673527e+1105Q, },
      |       ^

Q in those boost headers is a macro so it should be fine. I'll try to dig into why that is not working well

ConnorDonegan commented 7 months ago

The log for multinma is super long, but geostan terminates a lot more quickly:

https://www.r-project.org/nosvn/R.check/r-release-linux-x86_64/geostan-00install.html

Thanks for looking into this

bgoodri commented 7 months ago

This might be an issue (although it is more likely with Eigen than with Stan), but there is no actual compiler error on CRAN for geostan and multinma. It just says "terminated" on a triangular matrix vector product without giving any hint as to the reason. Both geostan and multinma install for me on Linux with r-devel, so until we get some actionable information, I am not going to worry about it.

ConnorDonegan commented 7 months ago

Is there a warning limit for CRAN checks? It looks like they have -Wall on which should be off and -Wno-ignored-attributes

Alright, that might be what the issue is. I doubt I'll get them to turn those off but will send in a message and see what happens. Thanks

bgoodri commented 7 months ago

CRAN isn't going to change their policy on warnings.

On Thu, Apr 11, 2024 at 9:49 AM Connor Donegan @.***> wrote:

Is there a warning limit for CRAN checks? It looks like they have -Wall on which should be off and -Wno-ignored-attributes

Alright, that might be what the issue is. I doubt I'll get them to turn those off but will send in a message and see what happens. Thanks

— Reply to this email directly, view it on GitHub https://github.com/stan-dev/rstan/issues/1122#issuecomment-2049738926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ2XKRAYITBY7HVXFOJ4JTY42IIFAVCNFSM6AAAAABF5N56XKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANBZG4ZTQOJSGY . You are receiving this because you were mentioned.Message ID: @.***>