Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
28 Views

OpenMP-Directives

The following OpenMP directives in Intel Visual Fortran worked fine in version 2016 (16.0.4.246) but causes an error in 2017 (17.0.6.270)

                     !$omp parallel do default(none) if (parallel .and. nbsubnet>1) &

The error in version 2017 is:

error #5082: Syntax error, found '.AND.' when expecting one of: :

It would appear that the 2017 version of Intel's Fortran compiler no longer accepts .and. and yet the list of what it expects is empty. I have not tried this in the 2018 version. I believe the logic .and. should be accepted.

Thank you,

Lester

 

0 Kudos
10 Replies
Highlighted
28 Views

Logical .and. should still be working.  I wrote a small program to confirm that to myself.

Now.  I was able to reproduce your problem by leaving in the "<strong>" and "</strong>" markup tags.  

Originally, I'd assumed that they were inserted by this forum tool, but it looks like they are actually in your source code.

Remove them, and try your program again.

                                       --Lorri

0 Kudos
Highlighted
Black Belt
28 Views

The markup tags were probably introduced when lines of code were selected and copied from a "rich text" display such as code sections in this forum, and pasted in a program text editor.

0 Kudos
Highlighted
Beginner
28 Views

My source code does not have html markups. I tried to highlight the problem and the html for bold was not interpreted correctly. 
This is the source code below.

!$omp parallel do default(none) if (parallel .and. nbsubnet>1) &
...

To clarify - the source code compiles properly in version 2016 but not in version 2017. The .and. is considered an error in IVF 2017.
Lorri, did I understand you were able to reproduce this problem in IVF 2017? 
Will this problem be corrected?
Thank you.

0 Kudos
Highlighted
28 Views

Is "parallel" a logical?

If yes...

What happens with if(parallel .and. (nsubnet>1))

Also, is the & the last character on the line?
And, what are the continuation line (If possible, paste the entire directive)

Jim Dempsey

0 Kudos
Highlighted
28 Views

I said I was able to reproduce the problem if the markups were there:

logical parallel
integer nb
!$omp parallel do default(none) if (parallel <strong> .and. </strong> nb > 1)
   do i=1, 10
      print *, "hello!"
   end do
!$omp end parallel do
end
d:\iusers\lwmenard\tests>ifort -Qopenmp -c x.f90 -nologo
x.f90(3): error #5082: Syntax error, found '.AND.' when expecting one of: ( <IDENTIFIER> <CHAR_CON_KIND_PARAM> <CHAR_NAM_KIND_PARAM> <CHARACTER_CONSTANT> <INTEGER_CONSTANT> ...
!$omp parallel do default(none) if (parallel <strong> .and. </strong> nb > 1)
------------------------------------------------------^

Without the markups, this program was OK, even with a 17.0 compiler.

If you're seeing something different, please post more of the program so that it can be reproduced.    Also, which version of 2017 are you using?

              Regards --

                                         --Lorri

 

 

0 Kudos
Highlighted
Beginner
28 Views

Thank you for your comments and suggestions.
1) I reiterate - there is NO bold in the source code. The code works fine for version 15 and 16. It fails for version 17.0.4 and 17.0.6
2) Lorri, the variable "parallel" is logical. I tried if(parallel .and. (nsubnet>1) and it changes nothing. 
3) The rest of the parallel directive contains these types of lines:
             

        !$omp parallel do default(none) if (parallel .and. nbsubnet>0) &
               !$omp shared(vector0, ivector, ...) &
               !$omp shared(vector1, vector2, ...) &
               !$omp shared(vector3, vector4, ...) &
               !$omp private(i,j,l,m) &
               !$omp reduction(+:counter_eval) &
               !$omp schedule(static,chunk_subs)
            do k=0,nbsubnet

 

4) The source code of this module is over 3000 lines long with many parallel directives and use modules. I tried making a toy example to narrow down the problem but I cannot reproduce it in the toy example.
5) Two types parallel directives are giving error messages:

      !$omp parallel do default(none) if (parallel .and. nbsubnet>0) &
      !$omp parallel do default(none) if (parallel) &
Therefore it is not the .and. as I originally thought. But for the second type of statement, it is not consistently giving the error message.

6) I tried changing the variable name parallel to:

  • parallela or parallel1 and it gave some weird message complaining about a misplaced "a" or "1"
  • parrallel (double r's) and it worked fine.

I believe in version 17 that the key word "parallel" is not always being interpreted as a variable but as the parallel directive. As I previously mentioned, unfortunately I cannot reproduce this in a toy example. Also, these error messages are not for all the parallel directives but just some of them. I do not see a pattern which would indicate the source of the problem.

The best solution I think of is to rename the logical variable "parallel" to avoid confusing the compiler. I have not been able to test this project in version 18 yet as I have to upgrade MSVS.

Any other comments are welcome.

0 Kudos
Highlighted
Valued Contributor III
28 Views

is the fixed form or free form? In fixed form the & is not valid code I think

0 Kudos
Highlighted
Beginner
28 Views

The source code is free form. This code compiles correctly with Fortran versions 15,16.

0 Kudos
Highlighted
28 Views

This works:

    program OpenMPContinuation
    use omp_lib
    implicit none

    logical :: parallel = .TRUE.
    logical :: fix_hack
    integer, parameter :: nbsubnet = 100
    real :: vector0(nbsubnet),vector1(nbsubnet),vector2(nbsubnet),vector3(nbsubnet),vector4(nbsubnet)
    
    integer :: ivector, counter_eval, chunk_subs
    integer :: i,j,k,l,m
    ivector = 100
    chunk_subs = 10
    fix_hack = parallel .and. (nbsubnet.gt.0)
!$omp parallel do default(none) if (fix_hack) &
!$             shared(vector0, ivector) &
!$             shared(vector1, vector2) &
!$             shared(vector3, vector4) &
!$             private(i,j,l,m) &
!$             reduction(+:counter_eval) &
!$             schedule(static,chunk_subs)
            do k=0,nbsubnet
                print *,k
    end do
    
    end program OpenMPContinuation

Jim Dempsey

0 Kudos
Highlighted
Beginner
28 Views

Thank you Jim. I'll change the variable name from "parallel" to something else.

0 Kudos