openMP support in Windows?

0 views
Skip to first unread message

Joon Ro

unread,
Mar 27, 2013, 1:07:31 AM3/27/13
to anaco...@continuum.io
Hi,

I am trying to compile my cython code with openmp support in Windows 8 with

```python
    extra_compile_args=['-fopenmp'],
    extra_link_args=['-fopenmp'],
```

in my setup.py file, but I've got ``fatal error: omp.h: No such file or directory``. What should I do to make it compile?
I'm using Anaconda 1.4.

Best,
Joon

Ilan Schnell

unread,
Mar 27, 2013, 1:16:03 AM3/27/13
to Joon Ro, anaco...@continuum.io
Hi Joon,
Anaconda comes with MinGW on Windows.  This is set to the default compiler,
in the file C:\Anaconda\Lib\distutils\distutils.cfg
If you google for "mingw openmp", you'll find that this is a common problem people run into, e.g.:
http://stackoverflow.com/questions/8104560/how-to-set-up-openmp

Hope that helps

- Ilan


--
Brought to you by Continuum Analytics Anaconda CE Community Support Group
---
You received this message because you are subscribed to the Google Groups "Anaconda CE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anacondace+...@continuum.io.
To post to this group, send email to anaco...@continuum.io.
Visit this group at http://groups.google.com/a/continuum.io/group/anacondace/?hl=en-US.
 
 

David Hirschfeld

unread,
Mar 27, 2013, 4:11:16 AM3/27/13
to anaco...@continuum.io

AFAIK MinGW doesn’t come with openmp by default so if it’s not included in the Anaconda version you’ll probably have to find the correct installer from the MinGW site and install it.

 

On Windows I’d generally recommend using TDM GCC (http://tdm-gcc.tdragon.net/) which has the option to automatically include openmp support and takes away the hassle of trying to manually find/install the correct packages and dependencies from the MinGW site.

 

-Dave

Gazprom Marketing & Trading Limited is a limited company registered in England and Wales with registered number 3768267 and registered office at 20 Triton Street, London NW1 3BF. This message is intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to us, and immediately and permanently delete it. Do not use, copy or disclose the information contained in this message or in any attachment. If the content of this email is personal or unconnected with our business, we accept no liability or responsibility for it.

Joon Ro

unread,
Mar 27, 2013, 1:01:43 PM3/27/13
to anaco...@continuum.io, david.hi...@gazprom-mt.com

On Wednesday, March 27, 2013 3:11:16 AM UTC-5, David Hirschfeld wrote:

On Windows I’d generally recommend using TDM GCC (http://tdm-gcc.tdragon.net/) which has the option to automatically include openmp support and takes away the hassle of trying to manually find/install the correct packages and dependencies from the MinGW site.


Thanks a lot! I have just installed TDM GCC and I was able to compile my cython code with
-fopenmp flag.

-Joon
 

jfc.h...@gmail.com

unread,
Nov 19, 2013, 1:55:47 PM11/19/13
to anac...@continuum.io, anaco...@continuum.io, david.hi...@gazprom-mt.com
I'm sure this is a simple matter, but what does the disutils.cfg file expect as a value so that it will use the TDM GCC compiler?
And after installing TDM GCC, are any other steps required than editing the compiler value in the distutils.cfg file?

Joon Ro

unread,
Nov 19, 2013, 4:33:38 PM11/19/13
to anac...@continuum.io, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com
I actually did not have to change anything. Once I installed TDM GCC, when I compiled my cython moduel, the compiler from TDM GCC was used automatically. I guess it modified the PATH env variable.

-Joon

Jon Herman

unread,
Nov 19, 2013, 5:29:21 PM11/19/13
to Joon Ro, anac...@continuum.io, anaco...@continuum.io, david.hi...@gazprom-mt.com
Hmm, it seems that works for me as well, thanks! I was reluctant to just add it to the path since Anaconda's gcc.bat is already in there. It seems to be running alright for me, but if anyone knows if this could create issues and/or how to do this more correctly, I would very much appreciate to hear about that.

Thanks,

Jon

Majid al-Dosari

unread,
Nov 19, 2013, 5:29:22 PM11/19/13
to Joon Ro, anaconda, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com
just curious...were you compiling on 64bit windows? if so, were you able to successfully compile your c-extension?


--
Anaconda Community Support Group Brought to you by Continuum Analytics
---
You received this message because you are subscribed to the Google Groups "Anaconda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anaconda+u...@continuum.io.
To post to this group, send email to anac...@continuum.io.
Visit this group at http://groups.google.com/a/continuum.io/group/anaconda/.

garyfa...@gmail.com

unread,
Mar 12, 2014, 8:18:25 PM3/12/14
to anac...@continuum.io, Joon Ro, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com, majid.a...@continuum.io
Hello all, 

we are having the same problem and the suggested solution doesn't work for us. We are using Windows 8. 

After installing TDM GCC (version 4.8.1) we get cannot find libgomp.spec then we found somewhere online and downloaded that file. After that we got another error

c:/tdm-gcc-64/bin/../lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lgomp

Having cython with parallelization is crucial for our library found in dipy.org as we deal with very large datasets and we need to exploit all the cores in our system to analyse them. We loved

and suggested Anaconda to our users because it makes installing numpy, scipy and cython easier. But it seems that the Cython installation is not complete without parallelization.

We would appreciate any help and we hope we can work together to solve this important issue.

Best wishes,
Eleftherios and Jesus-Omar
on behalf of the Dipy developers
Message has been deleted

Joon Ro

unread,
Mar 12, 2014, 10:53:59 PM3/12/14
to anac...@continuum.io, Joon Ro, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com, majid.a...@continuum.io


On Wednesday, March 12, 2014 7:18:25 PM UTC-5, Eleftherios Garyfallidis wrote:
Hello all, 

we are having the same problem and the suggested solution doesn't work for us. We are using Windows 8. 

After installing TDM GCC (version 4.8.1) we get cannot find libgomp.spec then we found somewhere online and downloaded that file. After that we got another error


I have `libgomp.spec` in `C:\TDM-GCC-64\lib\gcc\x86_64-w64-mingw32\4.8.1`. Did you check openmp support when you install TDM-GCC? Please see the instructions that I wrote: http://docs-windows.readthedocs.org/en/latest/devel.html#mingw-with-openmp-support.

Please let me know if it does not work.

-Joon

Eleftherios Garyfallidis

unread,
Mar 13, 2014, 11:33:46 AM3/13/14
to anac...@continuum.io, Joon Ro, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com, majid.a...@continuum.io
Hello,

Thank you for your response and for writing the blog. It does work for us now too.  Indeed we didn't see that there was an option for openmp it was a bit misleading to find this because everything look selected but still you had to go in the tree and select openmp. 


It would be amazing if anaconda could install tdm-gcc automatically and/or support openmp from default. Is there a plan for this?

Joon Ro

unread,
Mar 13, 2014, 12:08:44 PM3/13/14
to anac...@continuum.io, Joon Ro, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com, majid.a...@continuum.io

On Thursday, March 13, 2014 10:33:46 AM UTC-5, Eleftherios Garyfallidis wrote:

Thank you for your response and for writing the blog. It does work for us now too.  Indeed we didn't see that there was an option for openmp it was a bit misleading to find this because everything look selected but still you had to go in the tree and select openmp. 


I'm glad that it worked for you. Yes it can be confusing - I should try to add this instruction to Cython documentation.

-Joon

Yuxiang Wang

unread,
Nov 14, 2014, 11:23:55 AM11/14/14
to anac...@continuum.io, joonhy...@gmail.com, anaco...@continuum.io, david.hi...@gazprom-mt.com, jfc.h...@gmail.com, majid.a...@continuum.io
I am wondering why Anaconda does not come with OpenMP included - I know it is not by default in MinGW, but we could

a) Use TDM-GCC
b) (Or better yet) use this one used for numpy/scipy https://github.com/numpy/numpy/wiki/Mingw-static-toolchain

Shawn
Reply all
Reply to author
Forward
0 new messages