-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Visual C++ 14.0 breaks on vector addition #434
Comments
I'd use g++, as suggested by @bob-carpenter on the original issue, but that's unsupported by Python so it may or may not work. I understand if this is not a priority issue, though. |
@belteshassar, do you know how to instantiate the compiler with all the options from the command line? If so, mind posting here? |
@syclik Not sure what you mean. Cython handles everything with the compiler. Anyway, I decided to run pystan on Windows Subsystem for Linux, which works great.. I've managed to compile and run medium sized models with no issues. Also, python multiprocessing works fine on WSL so I can use the full power of my machine. |
@belteshassar, sorry -- missed the comment. I don't know what Cython does to call the MSVC compiler. If you can extract that info, I can try to run that command on a Windows box and see if I can make progress. I don't know enough about Cython to figure that out easily. |
Hi, due to current compiler situation with python3, pystan does not work on windows with python 3.5/3.6. Currently, I have no idea how to fix this. There are some notes on accumulator. Errors are probably there due to some bug in MSVC. Errors are:
https://github.com/stan-dev/math/blob/develop/stan/math/prim/mat/fun/accumulator.hpp The reason for the accumulator error is probably on these lines with
or
|
I think this is because Eigen compatibility with MSVC. I replaced |
Hi, I did some testing with MSVC 14 (2015) / 14.1 (2017). I could not get this working yet. This is a compiler bug, but I tried to surpass that. It looks like precompiler on MSVC can not deduce the correct type from functions and custom types. Does it only check one step backwards? The real reason is probably something more complicated. On Eigen site there is an article: It says in the page that
This could or could not be the one of the many problems that MSVC has with our templated functions. With the following code I tested some combinations and here are the results. MSVC 14.1 (2017)
I created a
Here are some common errors.
1. Original (3 errors)
1.1
extracted:
1.2.
extracted:
1.3
extracted:
2 Multinormal
3. Normal
3.1
Extracted
|
@ahartikainen I couldn't follow the last comment. What is the table supposed to be and what are teh numbered parts after it? Before we throw a lot of resources down this rabbit hole, is there a reason we need to compile with MSVC? |
I also believe Eigen itself is having problems with MSVC compatibility. |
@ariddell As far as you know, should PyStan work on Windows with Python3? I think @ahartikainen is having an issue here where he is not able to get it to work and I can't tell if it's because he's using a non-standard installation? |
PyStan works fine on Windows with Python 3.5 and higher. We have CI testing (appveyor) of all commits. |
I can't imagine why something would work in cmdstan on Windows but not on PyStan on Windows. If this is the case it's a bug against PyStan. One way to debug this would be to create a PR with a test which should fail because of the bug and have appveyor test it. I find this easier than installing windows in a VM. |
@bob-carpenter, the table shows if I can compile C++ code generated with The numbered parts after the table shows the common error messages for codes seen on the table. I have copied "only relevant" information. I know it's not a good idea to cut the log and if it's needed I can copy the full log here. On Windows, currently Pystan is only supported Python 3.5>. Python 3.5 & 3.6 can only use MSVC 14 / 14.1 to compile C/C++. Due to UCRT copyright problem ( https://mingwpy.github.io/issues.html#the-vs-14-2015-runtime ) we don't have any open source compiler (mingw) to compile external modules. PyStan itself work fine on Windows, only that some vector and matrix calculations do not compile. One can use arrays. @seantalts I have installed PyStan on conda environment with pip / conda. I'm not sure how much we should put the effort on this problem, because it is due to MSVC bug (in 14>). |
Thanks---just what I was asking.
Sounds like more motivation to produce a standalone Stan server based on a more robust C++ toolkit (like the Rtools distribution of g++ for Windows). But even that C++ toolkit is terrible compared to running on Mac OS or Linux---it's prone to blow out memory during linking, crash during compilation with segfaults on any but a single optimization level, etc. It's been no end of hassle getting things to work in that environment. Yet I think most of our users are on Windows.
|
From https://github.com/belteshassar on stan-dev/stan#2110:
Summary:
Vector addition gives a compiler error in Microsoft Visual C++ 14.0. This does not reproduce when using g++ on Ubuntu on Windows.
Description:
I use pystan with Python 3.5. I have managed to compile and run a variety of models both on Windows using Visual C++ 14.0 and on the new Windows subsystem for Linux (WSL). When building a more complex model with vector parameters I managed to get a compiler error in Visual C++
I narrowed the issue down to vector addition. I can reproduce the issue using a vector addition in either of the transformed data, transformed parameters, or model blocks.
I don't know if this can be reproduced on older versions of Python using older compilers. I use Visual C++ 14.0 since it's the recommended compiler for building Python extensions for Python 3.5 on Windows.
Reproducible Steps:
Here is a simplified model that can reproduce the issue:
Current Output:
Additional Information:
OS: Windows 10 Pro 64-bit Build 14393.447
Visual C++ 14.0
Python 3.5.2
pystan 2.12.0.0
Current Version:
v2.12.0
The text was updated successfully, but these errors were encountered: