OpenMP works great under MacOSX Intel but not all under Windows (MinGW)

78 views
Skip to first unread message

Al Greynolds

unread,
Jul 8, 2007, 11:33:17 AM7/8/07
to GNU Fortran
I have a MacBooK Pro setup to dual boot MacOSX and WindowsXP Pro.
The OpenMP parallel portions of my Gfortran 4.3 compiled application
run great under MacOSX, i.e. nearly twice as fast on the dual core
Intel processor. However, when I compile and run it under Windows XP
using the latest July 6 Windows gfortran binary, task manager shows
only 50% CPU useage and the execution is actualy 50% slower than a G95
(experimental 4.1 MinGW) version that does not support OpenMP.

Is OpenMP expected to work with the Gfortran under Windows?

Al

Al Greynolds

unread,
Jul 9, 2007, 4:47:09 PM7/9/07
to GNU Fortran
After a little digging, I noticed that last year a special Windows
binary of gfortran with OpenMP support was available. Does a more
recent one need to be built? If so, why isn't there just one
regularly updated binary (like the other platforms) that has OpenMP
support included?

Al

FX Coudert

unread,
Jul 11, 2007, 4:19:35 AM7/11/07
to GNU Fortran
> After a little digging, I noticed that last year a special Windows
> binary of gfortran with OpenMP support was available. Does a more
> recent one need to be built? If so, why isn't there just one
> regularly updated binary (like the other platforms) that has OpenMP
> support included?

The first time I released OpenMP-enabled binaries, I added the -openmp
suffix to the name and posted an announcement on comp.lang.fortran.
Since then, all the Windows binaries posted have OpenMP support.

I'll be digging into your problem when I get some time.

Thanks for the bug-report,
FX

Tobias Burnus

unread,
Jul 11, 2007, 4:22:13 AM7/11/07
to GNU Fortran
I forwarded your question to fortran<at>gcc.gnu.org and the answer I
got is as follows:

Brian Dessent <brian>at<dessent>dot<net> writes:
| It depends on whether you're talking about MinGW or Cygwin. For
MinGW
| then you'll need to first install the pthreads-win32 library before
| building gfortran/gcc, and possibly forcing the --enable-
threads=posix
| option since the MinGW default is --enable-threads=win32. Since
Cygwin
| provides the pthreads API you don't need an external library there
and
| it should work OOTB.

It seems thus as if one needs a special GCC/gfortran build for OpenMP.

> and the execution is actualy 50% slower than a G95
> (experimental 4.1 MinGW) version that does not support OpenMP.

This is with or without -fopenmp? Is there a difference in speed
between the two? Based on Brian's answer, I would expect that the -
fopenmp version is slightly slower and uses only one CPU.

Tobias

FX Coudert

unread,
Jul 11, 2007, 6:09:51 AM7/11/07
to gnu-f...@googlegroups.com
> It seems thus as if one needs a special GCC/gfortran build for OpenMP.

Yes, but this is exactly the procedure I follow to create the Windows
binaries, so they should really have OpenMP enabled. The fact that
they compile with -fopenmp and then sucessfully run (even with
extremely poor performance) indicates that the build procedure is
apparently OK.

As I said, I'll try to experiment some more. In the meantime, Al, if
you could get a short self-contained code that exhibits the behaviour
you see, it would help me get there faster.

Thanks,
FX

Al Greynolds

unread,
Jul 15, 2007, 10:59:51 AM7/15/07
to GNU Fortran
I thought maybe the OpenMP environment defaults were not being setup
properly under MInGW, so I explicity issued a:

set omp_num_threads=2

I now get a different behavior. A Win32 exception occurs when the
second thread starts while the master continues on. When I get time,
I'll investigate further.

I should say that this OpenMP application runs as expected on other
platforms: MacOSX-PPC (XLF), MacOSX-x86 (Gfortran, and IVF), and
Windows (IVF). However for MaOSX-x86 Gfortran, I had to cut back
from -O3 to -O1 and not use -ftree-vectorize to get the application to
run properly. Could there be a conflict between the GCC vectorizer
and OpenMP?

Al

Al Greynolds

unread,
Jul 15, 2007, 1:04:07 PM7/15/07
to GNU Fortran
I finally got it working under MinGW if I don't mix -mfpmath=sse with -
fopenmp (even though this combination works on MacOSX-x86).

Al

.


Reply all
Reply to author
Forward
0 new messages