fresh clone of cmdstan, stan, stan_math confirms this:
make stan/src/test/test-models/good/function-signatures/math/matrix/gp_regression_test
fails:
In file included from src/cmdstan/main.cpp:1:
In file included from stan/src/stan/model/model_header.hpp:4:
In file included from stan/lib/stan_math/stan/math.hpp:4:
In file included from stan/lib/stan_math/stan/math/rev/mat.hpp:12:
In file included from stan/lib/stan_math/stan/math/prim/mat.hpp:132:
/Users/mitzi/tmp/cmdstan/stan/lib/stan_math/stan/math/prim/mat/fun/gp_matern52_cov.hpp:203:37: error: invalid operands to binary expression ('typename
apply_scalar_unary<sqrt_fun, double>::return_t' (aka 'double') and 'const std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >')
T_l neg_root_5_inv_l = -sqrt(5.0) / length_scale;
~~~~~~~~~~ ^ ~~~~~~~~~~~~
/Users/mitzi/tmp/cmdstan/stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:119:12: note: candidate function not viable: no known conversion from 'const
std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >' to 'const stan::math::var' for 2nd argument
inline var operator/(double a, const var& b) {
^
/Users/mitzi/tmp/cmdstan/stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:87:12: note: candidate function not viable: no known conversion from 'const
std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >' to 'const stan::math::var' for 2nd argument
inline var operator/(const var& a, const var& b) {
^
/Users/mitzi/tmp/cmdstan/stan/lib/stan_math/stan/math/rev/core/operator_division.hpp:102:12: note: candidate function not viable: no known conversion from 'const
std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >' to 'double' for 2nd argument
inline var operator/(const var& a, double b) {
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:669:1: note: candidate template ignored: could not match
'complex<type-parameter-0-0>' against 'double'
operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:714:1: note: candidate template ignored: could not match
'complex<type-parameter-0-0>' against 'double'
operator/(const complex<_Tp>& __x, const _Tp& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/complex:722:1: note: candidate template ignored: could not match
'complex' against 'vector'
operator/(const _Tp& __x, const complex<_Tp>& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/valarray:3773:1: note: candidate template ignored: substitution failure
[with _Expr1 = double, _Expr2 = std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >]: type 'double' cannot be used prior to '::' because it has
no members
operator/(const _Expr1& __x, const _Expr2& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/valarray:3788:1: note: candidate template ignored: substitution failure
[with _Expr = double]: type 'double' cannot be used prior to '::' because it has no members
operator/(const _Expr& __x, const typename _Expr::value_type& __y)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/valarray:3804:1: note: candidate template ignored: requirement
'__is_val_expr<vector<var, allocator<var> > >::value' was not satisfied [with _Expr = std::__1::vector<stan::math::var, std::__1::allocator<stan::math::var> >]
operator/(const typename _Expr::value_type& __x, const _Expr& __y)
^
8 errors generated.
make: *** [stan/src/test/test-models/good/function-signatures/math/matrix/gp_regression_test] Error 1
Ok, I’ve done a fresh clone of develop versions of cmdstan, stan and stan/math.
I’m getting other errors: Some with template deduction and others where I re-used a function name as a variable name.
First, when I have these issues, this shouldn’t even compile at the Stan/math level. Is there perhaps a compiler flag I can add or something to cause this bug?
I’m still not able to re-create this error. I’m using Linux, and I’m thinking it’s a result of the OS and its respective compiler. Looks like it’s happening on Apple. Is there an Apple server I can SSH to so I can debug this?
Can you write out exactly what you’re doing? What git hashes are you using for each repo / submodule? And what Stan program? I can try to recreate it.
It won’t necessarily cause a compiler error in math if you don’t instantiate it. That’s why we ask for the instantiations in the math library even when it looks like it should work when inspecting the code. (non-compilable code is valid in templated code if it’s never instantiated)
and then I’m running the command: make stan/src/test/test-models/good/function-signatures/math/matrix/gp_regression_test which should fail in compilation, but for me it passes.
Thanks. Using those git hashes, I was able to recreate it. What branch are you working on for the Math library? Maybe I can throw together a unit test that breaks.
I’m working off of my fork, on branch feature/issue-2736-add-gp-kernels-to-language, if you can’t push I can give you permission or copy paste a test case from here.
You’re welcome. By the way, I didn’t check all the instantiations… just the first one that triggered an error. It looked like there were going to be more.
The easiest thing to do, I think, is to update the Stan language so these additional instantiations are never generated. Then fix the Math library, then go back to the full ARD. But… there are other ways to do this too.
If you want to know how I tracked this down, let me know and I’ll walk you through how I navigated through this.
Yeah, that would be helpful. I’m still not getting the same compilation errors, and they still seem different from Mitzi’s. Could be something silly I’m doing?
I’m flexible, so if you have a few minutes at any time just let me know