Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28457 Discussions

How to express a long directive for openMP in Fortran?

Anonymous21
Beginner
3,812 Views

How do you know how to express the continuous red line with the previous line as follows?

!$OMP PARALLEL DEFAULT(PRIVATE),SHARED(i, j,k,ucn,q,dc,de,dz)

!$OMP& SHARED(qq,qw
) ---> Question??
:
:
!$OMP END PARALLEL


If adding the + or &, the complier make the error message.


adi.f90(10): error #5082: Syntax error, found '&' when expecting one of:

0 Kudos
1 Solution
Steven_L_Intel1
Employee
3,812 Views
Ricardo is close. OpenMP directives may be continued and the syntax for doing so is similar to that for Fortran free-form source. The directive to be continued shall have an & as the last non-whitespace character. The continued directive may (but does not require) have an & after the !$OMP introducer. Note that the ! is required - Ricardo left it out, probably accidentally.

So what you want is this:

[plain]!$OMP PARALLEL DEFAULT(PRIVATE),SHARED(i, j,k,ucn,q,dc,de,dz), &
!$OMP& SHARED(qq,qw) [/plain]
The comma between clauses is optional, but I think for style you should be consistent as to whether you use it or not.

View solution in original post

10 Replies
rreis
New Contributor I
3,812 Views

Reading from here: https://computing.llnl.gov/tutorials/openMP/#Directives

I would suppose, if this is freeform fortran that

$OMP BLABLA &
$OMP BLABLA2

would be the right way...

(infering from "All Fortran free form rules for line length, white space, continuation and comment columns apply for the entire directive line")
Steven_L_Intel1
Employee
3,813 Views
Ricardo is close. OpenMP directives may be continued and the syntax for doing so is similar to that for Fortran free-form source. The directive to be continued shall have an & as the last non-whitespace character. The continued directive may (but does not require) have an & after the !$OMP introducer. Note that the ! is required - Ricardo left it out, probably accidentally.

So what you want is this:

[plain]!$OMP PARALLEL DEFAULT(PRIVATE),SHARED(i, j,k,ucn,q,dc,de,dz), &
!$OMP& SHARED(qq,qw) [/plain]
The comma between clauses is optional, but I think for style you should be consistent as to whether you use it or not.
rreis
New Contributor I
3,812 Views
Note that the ! is required - Ricardo left it out, probably accidentally.

yep, thanks for the correction! :)
0 Kudos
Anonymous21
Beginner
3,812 Views
Thanks for Ricardo and Steve's help.


Quoting - hydrol88

How do you know how to express the continuous red line with the previous line as follows?

!$OMP PARALLEL DEFAULT(PRIVATE),SHARED(i, j,k,ucn,q,dc,de,dz)

!$OMP& SHARED(qq,qw
) ---> Question??
:
:
!$OMP END PARALLEL


If adding the + or &, the complier make the error message.


adi.f90(10): error #5082: Syntax error, found '&' when expecting one of:


0 Kudos
lessonfree
Beginner
3,812 Views

How many lines you can create in such manner? Is it any kind of limitations?

0 Kudos
TimP
Honored Contributor III
3,812 Views
Quoting - lessonfree

How many lines you can create in such manner? Is it any kind of limitations?

I've never seen a limitation reached, even with the use of default(none) in large parallel regions, requiring over 100 variables in the shared and private lists.
0 Kudos
lessonfree
Beginner
3,812 Views
Quoting - tim18
I've never seen a limitation reached, even with the use of default(none) in large parallel regions, requiring over 100 variables in the shared and private lists.

0 Kudos
lessonfree
Beginner
3,812 Views
Quoting - lessonfree
Is it described in documentation somewhere?

0 Kudos
TimP
Honored Contributor III
3,812 Views
Quoting - lessonfree

That would be the OpenMP specification, which you could re-examine at will.
0 Kudos
Steven_L_Intel1
Employee
3,812 Views
I don't know for sure, but I'd expect that the Fortran 90 standard minimum of 39 free-form continuation lines to be relevant. The Intel compilers allow 511 continuations.
0 Kudos
Reply