This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: OpenMP problem


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]