OpenMP problem
Tim Prince
n8tm@aol.com
Sat Oct 31 18:40:00 GMT 2009
Jerry DeLisle wrote:
> Carlos Alberto Bulant wrote:
>> Hello,
>>
>> I'm using cygwin, gfortran-4 compiler, in NetBeans IDE. My pc has
>> WinXP SP3.
>>
>> I'm trying to introduce parallel processing to my project, i've been
>> reading about OpenMP, so i make this litle code to test it:
>>
>> //-------------------------------------------------------------------------------------------------
>>
>> PROGRAM HELLO
>> !$ USE omp_lib
>>
>> INTEGER n, i
>> PARAMETER (n=505150)
>> REAL X(n)
>>
>>
>> !$ call omp_set_num_threads(2)
>> write(6, "(a, i3)") " OpenMP max threads: ",
>> + OMP_GET_MAX_THREADS()
>>
>> !$OMP PARALLEL
>> write(6, "(2(a,i3))") " OpenMP: N_threads = ",
>> + OMP_GET_NUM_THREADS(), " thread = ", OMP_GET_THREAD_NUM()
>> !$OMP END PARALLEL
>>
>>
>> !$OMP PARALLEL DO
>> !$OMP+ SHARED(X)
>> !$OMP+ PRIVATE(i)
>> DO i = 1, n
>> X(i) = i
>> !$ !write(*, *) " From Thread = ", OMP_GET_THREAD_NUM(),
>> " i= ",i
>> END DO
>> !$OMP END PARALLEL DO
>>
>> END PROGRAM
>> //-------------------------------------------------------------------------------------------------
>>
>>
>> The program runs ok with n<= 505150
>> with 505150 > n >= 505170 The output is from one thread only
>> with n > 505170 i get a runtime error, the cause is stack overflow.
>>
>> i set windows environment variables
>> OMP_STACKSIZE=10000
>> GOMP_STACKSIZE=10000
>>
>> but i get the same behaviour...
>>
>> any ideas???
>
> It could be you are just too big for your machine. Also, when you set
> environment variables, they do not always 'take' to cygwin terminals
> that are already open, so you may want to close and reopen everything
> after setting environment variables.
>
> Although I do build a gfortran binary for Cygwin and I use Cygwin on
> occasion for real work, I am not a big fan of using windows for serious
> work. At the Cygwin web site there are discussions about non-Cygwin
> apps that do things that interfere called BLODA I think. Flip side,
> Cygwin actually works pretty damn good most of the time.
>
> Also, check your question at comp.lang.fortran news list. Those folks
> have a lot of combined experience.
>
> Jerry
I haven't had any real success with gomp on Windows, including cygwin,
even for tests just large enough to show OpenMP performance which run
fine on my laptop under linux, and with ifort on Windows.
It seems to be too heavy a load for gcc developers to handle Windows
along with the more amenable systems. I try nearly every week to make a
new build of gcc/g++/gfortran on cygwin, but the last successful one
(excellent, apart from gomp) was 6 weeks ago. It takes several days to
build and test, compared with a couple hours on linux, and the test
suite is perhaps unacceptably unreliable on Windows.
I kept persevering with cygwin in the so far mistaken idea that the
market might consolidate on a good Windows version. It seemed almost
about to happen with Windows 2000. Now Windows 7 x64 and 2008 R2 x64
are the next candidates, but cygwin is sure not to catch up soon even if
those do come into wide use.
Even the braggarts with axes to grind fall down when asked to
demonstrate their claim that Windows is easier to use than linux. It
still takes weeks for the experts from Microsoft to set up a moderately
large Windows MPI cluster, which can be done in a day by a linux
sysadmin. Then the job submission scripts for Windows contain double
the obscurity of linux equivalents, which are bad enough.
I do expect to be presiding over a 32 core single motherboard Windows
demonstration at SC09, in case you think I'm too prejudiced against
Windows. Don't know if anyone tried cygwin yet on that machine.l
Tim
More information about the Fortran
mailing list