Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

TYPE variables in parallel constructs

TYPE variables in parallel constructs

TYPE variables in parallel constructs

Hi again

Things are progressing nicely with my software and I am very grateful for the quick answers I can get here saving a lot of time searching documentation. I managed to get parallel processing working but (maybe stupidly) I have the error code as part of a TYPE structure and I need to detect the error code separately in each thread. I tried to enter the error code as private in the do parallel but that gave an error message using GNU Fortran 4.8 (on Windows). Is that something which will be fixed in later versions of the compiler or something I have to change? The compilation error is

!$OMP parallel do private(gx%bmperr,neweq)
Error: Syntax error in OpenMP variable list at (1)

gx%bmperr is an integer variable in the gx structure. It works if I remove the gx%bmperr variable (and if I have no runtime errors). neweq is a pointer to another TYPE structure.

Incidentally, if I terminate the do parallel with an !$OMP end parallel I also get a compilation error but the compilation works without any particular OMP directive at the end of the loop. Reading the documentation I thought one should have en end parallel.


RE: TYPE variables in parallel constructs

What is the file extension?

RE: TYPE variables in parallel constructs

I use F90 for all my source code. Will the compiler really be sensitive to that?

But I will rethink the whole error handling concept now when I have most parts of the software working, And I have quite some code to clean up as I dod not know initially that one could copy a complete record.

RE: TYPE variables in parallel constructs

If it is gfortran, yes: .f or .for for f77, .f90 for everything else.

RE: TYPE variables in parallel constructs

@Bosse7 : making gx%bmperr private is no sense in OpenMP : what about the other data within gx ? gx is a whole. It must be either private or public.

Fran├žois Jacq

RE: TYPE variables in parallel constructs

Aha, thanks. gx is a record which just contains the error code. No problem to make the whole record private.

When I started developing the code (which is now some 30000 lines) I was new to Fortran08 (although not to Fortran77 and object oriented programming) so I put the error code inside a TYPE declaration record which I thought might be useful also for other global things. Each thread may have its own copy of this record and I hope that will not slow down anything. My tests so far shows that running on a PC with 4 CPU I gain a factor of 3 in speed which I think is satisfactory. But I must test that errors are handeled gracfully, in most cases an error deep down in the code can be handelled some higher level in the code and should not force the whole simulation to crash.

Best wishes


RE: TYPE variables in parallel constructs

It works perfect with the gx structure as private variable in the parallel do. I noticed that I had to initiallize its values for each thread which is quite obvious (if one thinks a little). Thanks again.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close