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

OpenMP and IPO (repost)

briardew
Beginner
1,812 Views

I get some weird behavior with OpenMP and the IPO flag. Running Mac OS 10.6.8 I can recreate the error with the following program compiled w/ Composer 2011 SP1 11.344 or 11.1 (046).

program omptest
  use omp_lib

  integer, parameter :: nits = 1
  integer, parameter :: ldx  = 10

  integer :: it
  real    :: xxen(ldx,nits), xx(ldx)

  xx = 1.0

#ifdef _OPENMP
!$omp parallel
!$omp single
  print *, 'Using OpenMP with ', omp_get_num_threads(), ' threads.'
!$omp end single
!$omp end parallel

!$omp parallel do
#endif
  do it = 1,nits
    print *, 'it = ',it
    xxen(:,it) = xx
  end do
#ifdef _OPENMP
!$omp end parallel do
#endif

  print *, 'xxen = ',xxen
end program

If I compile with -fast and -openmp, it will print the iteration number N times, where N is the number of threads. If I take out the -ipo option (but keep -O3 -xHost, etc.), then I get the printed line once, as I should. Also, if I compile with -fast and -openmp and nits greater than 1, I get correct behavior. Finally, if xx is a scalar instead of an array, everything works correctly.

Thanks,
Brad

0 Kudos
9 Replies
TimP
Honored Contributor III
1,812 Views
According to your description, it acts as if the omp parallel do do and end do weren't there, when you specify a fixed count of 1.
My impression of -fast was that it was used primarily for benchmarks like Specfp which don't allow a group of options (and would not have a omp parallel loop with fixed count 1).
I'm a little confused by your reference to compiler versions, not understanding if a recent version is among those you mean.
0 Kudos
briardew
Beginner
1,812 Views

I get the same result if I use -ipo instead of -fast. It was my impression that -fast was just an abbreviation for (on Mac OS X) -ipo -O3 -xHost -mdynamic-no-pic -no-prev-div. Interestingly, in 11.1 the man page said it included -xHost and now this is gone in 12.1.

I believe what is happening is that -ipo replaces the loop with

!$omp parallel
        print *, 'it = ',1
        xxen(:,1) = xx
!$omp end parallel

I made a mistake with the compiler versions, the correct ones are 12.1.5.344 build 20120612 and 11.1.046.

Thanks,
Brad

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,812 Views
Brad,

Configure the test program such that it produces the error.
Then delete all the # preprocessor statements.
(IOW do not interceed !$omp parallel do and do it=... with a preprocessor statement.)

Does the IPP error still occur?

Jim Dempsey
0 Kudos
Ron_Green
Moderator
1,812 Views
which Xcode version?

i'll need to test this on our older OS/XC and compilers. The latest compiler on Lion/XC 4.3 does not exhibit the behavior you describe.
0 Kudos
briardew
Beginner
1,812 Views

Jim - the error still occurs with the preprocessor directives removed.

Ronald - I don't use XCode. The version installed on my machine is 3.2.4. NB: I'm not running Lion, still at 10.6.8.

Thanks,
Brad

0 Kudos
Ron_Green
Moderator
1,812 Views
OK, I have been able to confirm this with Lion and Snow Leopard with the 12.1 compilers. I have a few more tests to run to determine why my mountain lion system doesn't see this - could be my configuration or the compiler version I'm using.

as an fyi: even from the command line we use Xcode components. The linker, librarian, and header files are needed by the compiler even if you don't use the IDE.

I should have more information and a bug report ID tomorrow.

ron
0 Kudos
Ron_Green
Moderator
1,812 Views
bug ID DPD200235132

And I have good news and bad news

good news: there is a fix in an upcoming compiler release, coming out in roughly 1 month.

bad news: we'll be dropping support for Snow Leopard when this compiler comes out. Thus, this compiler will require Mountain Lion or Lion and Xcode 4.x. Are you willing to upgrade to get this fixed compiler OR can you just run without -ipo ?

I've asked the developers if we can backport this fix to a 12.1 compiler supported on Snow Leopard. I will let you know the results after their investigation into the risk of backporting the fix.

ron
0 Kudos
briardew
Beginner
1,812 Views

Hi Ron,

Thanks for looking into this bug.

I have to say, I've been disappointed with IPO and Snow Leopard in general. This bug was just a starting point, as I managed to narrow it down to something that was very simple to reproduce.

I have many more problems with IPO, and it is essentially unusable. As far as I know, Intel markets their (very expensive) compiler as supporting Snow Leopard and brags about its performance benefits. These benefits are only possible with features like IPO turned on. We will inevitably upgrade to Mountain Lion over here because we like working code. Still, I feel like the 12.1 compiler, which we purchased because of a bug in an earlier compiler, is a complete lemon.

Brad

0 Kudos
Martyn_C_Intel
Employee
1,812 Views

This issue is fixed from compiler version 13 onwards, and I believe also in the final 12.1 (update 7). Sorry it took so long to post this.

0 Kudos
Reply