2

From this link it is stated that MSVC is preferred for Windows 64-bits. However, for the free VC++ 2010 Express Edition, or the Windows SDK, it seems that openmp is not supported. Does that mean, there is no clean way to do parallel computing using Cython in Windows?

Feeling so desperate. I guess I can buy the retail version - if that is the only solution.

Yuxiang Wang
  • 8,095
  • 13
  • 64
  • 95
  • 1
    Download and install the express edition of MSVC2012 or MSVC2013. They both support OpenMP. – Z boson May 30 '14 at 07:50
  • @Zboson thanks, but doesn't cython require to use the same runtime version that python was compiled? Could you show me how to let cython use VS2013 as compiler? – Yuxiang Wang May 30 '14 at 14:18

1 Answers1

2

EDIT: The old version of this answer is primarily applicable to Python 2 and early versions of Python 3 since they rely on really old versions of MSVC. If at all possible, the solution now is to use a newer version of Python with its corresponding version of MSVC.

Mixing C runtimes can cause unpredictable crashes. If, for example, one C runtime allocates a pointer and the other C runtime attempts to free it, it'll crash. Generally it's painful but possible to get this kind of thing working right, but if you're able to use a new enough version of Python, mixing compilers isn't necessary at all since newer MSVC versions can do what you need.


Although the Cython documentation discourages it, the latest versions of MinGW-w64 should work. The warnings about incompatible runtimes should be resolved after MinGW 4.7, but still, be careful.

You can use MinGW-w64 with OpenMP (See this question about how to get binaries), so, in theory, it should be possible to configure Cython to use it.

The MinGW builds project is a good way to get the compilers installed.

You will probably also need to configure distutils to use MinGW, as described in this answer.

IanH
  • 10,250
  • 1
  • 28
  • 32
  • Thanks lanH. I do have TDM GCC installed, however the undefined reference to '___imp__....' error keeps popping out, which may be due to the libpython33.a file. Then I find it hard to progress because there's no python33.dll on my Python folder... – Yuxiang Wang May 30 '14 at 01:44
  • You could try these [installers](http://www.lfd.uci.edu/~gohlke/pythonlibs/#libpython), I currently use the Anaconda distribution though, since it comes with Cython already set up to use MinGW. That could be a safer bet. – IanH May 30 '14 at 02:47
  • thanks a lot! I didn't notice those nice installers:) I'll try it. By the way, does Anaconda comes with Python 3 in 64 bits, that's set up with mingw-w64? I somehow remember reading elsewhere that the anaconda bundled gcc does not include openmp. – Yuxiang Wang May 30 '14 at 03:05
  • 1
    You can get a Python 3 installation running. Anaconda does support Python 3. They describe how to set it up in this [post](http://continuum.io/blog/anaconda-python-3). I think you're right about OpenMP. There appears to have been some discussion on that already [here](https://groups.google.com/a/continuum.io/forum/#!msg/anaconda/c-4u6C29hYM/pjLf5AGuONoJ). It looks like the solution was to use Anaconda with a separate MinGW-w64 installation. – IanH May 30 '14 at 04:11