FeaturesPluginsDocs & SupportCommunityPartners

NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

OpenMP + fortran

 
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users
View previous topic :: View next topic  
Author Message
Carlos Alberto Bulant
Posted via mailing list.





PostPosted: Mon Oct 26, 2009 4:46 pm    Post subject: OpenMP + fortran Reply with quote

Hellow,

I'm using cygwin, gfortran-4 compiler.

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 causeis stack overflow.

i set a windows environment variable OMP_STACKSIZE = 3072

but i get the same behaviour...

any ideas???


I intent to use openMP in a project with big multidemensional arrays,
but it seams the stack size limitation of the omp threads is going to
impede it...

i don't understand why they need a big stack, are they (the threads)
copiyng the share array into each stack? isn't enough with a pointe to
them?...

carlitos
Back to top
Leonid Lenyashin
Posted via mailing list.





PostPosted: Fri Oct 30, 2009 8:50 am    Post subject: OpenMP + fortran Reply with quote

Carlos,

I think you chose wrong forum to ask this question. Any Fortran or
OpenMP forum will give you better chance for getting the answer.
Another point is that I do not think that:
1) gfortran is any good.
2) GNU is good in OpenMP (they only introduced it in 4.x)
3) cygwin is a making this choice any better.

If you have to stick to Windows, I'd recommend you to try Intel
compilers. They are free for non-commercial use. if you have flexibility
to try Linux or Solaris, I'd suggest to give a try to Sun Studio
(http://developers.sun.com/sunstudio/downloads/). It is free even for
commercial use. It has very good Fortran + optimized libraries
supporting OpenMP. Sun Studio is a leading OpenMP tool supporting 3.0 at
this point and it has set multiple world records in SPEC OMPM2001
benchmark. BTW, Sun Studio includes OpenMP aware debugger and profiler.

Thank you,
Leonid.

Carlos Alberto Bulant wrote:
Quote:
Hellow,

I'm using cygwin, gfortran-4 compiler.

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 causeis stack overflow.

i set a windows environment variable OMP_STACKSIZE = 3072

but i get the same behaviour...

any ideas???


I intent to use openMP in a project with big multidemensional arrays,
but it seams the stack size limitation of the omp threads is going to
impede it...

i don't understand why they need a big stack, are they (the threads)
copiyng the share array into each stack? isn't enough with a pointe to
them?...

carlitos






Back to top
Carlos Alberto Bulant
Posted via mailing list.





PostPosted: Sat Oct 31, 2009 4:26 am    Post subject: OpenMP + fortran Reply with quote

hi,

i found that using -fno-automatic, the code worked just find, i could
make x array grow up to 1.5GB...
(obviously, i don't need the envairoment variables any more...)

something interesting is that compiling the fortran code us a static
library, i don't need to use -fno-automatic.
And i can use the subroutine from C++ linking it with -lgfortran
-lgomp. and it works ok.

Now i will try to introduce my real fortran project with openmp, and
see what happen...

thanks a lot

carlitos

2009/10/30 Leonid Lenyashin <address-removed>:
Quote:
Carlos,

I think you chose wrong forum to ask this question. Any Fortran or OpenMP
forum will give you better chance for getting the answer.
Another point is that I do not think that:
1) gfortran is any good.
2) GNU is good in OpenMP (they only introduced it in 4.x)
3) cygwin is a making this choice any better.

If you have to stick to Windows, I'd recommend you to try Intel compilers.
They are free for non-commercial use. if you have flexibility to try Linux
or Solaris, I'd suggest to give a try to Sun Studio
(http://developers.sun.com/sunstudio/downloads/). It is free even for
commercial use. It has very good Fortran + optimized libraries supporting
OpenMP. Sun Studio is a leading OpenMP tool supporting 3.0 at this point and
it has set multiple world records in SPEC OMPM2001 benchmark. BTW, Sun
Studio includes OpenMP aware debugger and profiler.

Thank you,
Leonid.

Carlos Alberto Bulant wrote:
Quote:

Hellow,

I'm using cygwin, gfortran-4 compiler.

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:


//----------------------------
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> C/C++ Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB