Is it possible to build stan-math tests with microsoft c++ compiler?

Has anyone managed to do it?

It worked at some point but iirc it was too much work to maintain since their template support is terrible

Does it imply that it is impossible now to build the library and the tests using microsoft compilers, without major changes to the sources?

So just adding some defines/ compiler flags would not suffice?

It would take effort—more than we’re willing to expand since there’s an alternative that works fine. It would be cool to get it working but only if somebody was invested in the maintenance since it’s likely an ongoing burden.

How pystan is build using visual studio, if there is no support of msvc compilers? Or you cannot build it with msvc anymore?

@ariddell would know more, but I’m pretty sure Stan and the math library can be built with MSVC of a certain version or higher. I’m not sure about the math tests - not sure why they wouldn’t work but maybe they use additional features?

Glad @seantalts got in here, I completely forgot about Pystan doing that. But do we test the math library against MSVC? It seems really fragile if we don’t test the math lib but do run PyStan with it…

Or rather—Travis doesn’t do this, is Jenkins somehow set up for it?

I believe that I can provide specific tests which fail, but it would not prove that the library cannot be build under Visual studio – maybe i am just doing something wrong. However, why do you think that it should be possible to build the library? And, by building the library, what do you specifically mean? Since the library is header-only and heavily templated, how can you know anything about possibility of building the library if not building some tests?

This is probably why PyStan gets away with it----users may never instantiate the specific signatures that fail.

Yeah, I meant more that PyStan seems to work rather than that a library is built, sorry. I can tell you guys that I don’t see any tests that run with MSVC anywhere (travis doesn’t support these as an option, either) and that brings me to the limits of my knowledge. I’ll wait for Alan to weigh in.

PyStan+msvc works with a subset of functions. The vector and matrix algebra (Eigen) does not work. There is an issue in github for the updated instructions for windows. It is not official yet, because there are still some issues with forcing gcc over msvc.

(Python 3.5+)
The problem as far as I know is that the template behaviour is broken with MSVC 14 (2015) and MSVC 14.1 (2017). It looks like MSVC can deduce variable only once / one step (if that even makes sense to you).
They did change alot of the functions and structure in 14.0 edition. This may or may not be the reason for the failure. It would be great if there was a simple commandline option for this problem.

(Python 3.4 and earlier)
Python used either 2010 or 2008. And I believe it is one of those that did work with Eigen.

See different compiler versions here:

And github issue here:

And compilation error for the MSVC here:

1 Like