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

parallel lint for ifort omp* checking

mirko_vukovic
Beginner
929 Views
Hello,

The ifort documentation (for linux) mentions the use of `parallel lint' to verify OpenMP code.

Is parallel lint an intel product (or part of one)? I could not find anything on the web site.

Thanks,

Mirko

0 Kudos
5 Replies
pbkenned1
Employee
929 Views
The parallel lint you're referring to is part of the compiler. It performs a static global analysis of your OpenMP program. Compiling with -openmp -diag-enable sc-parallel3 will produce verbose diagnostics.

Patrick Kennedy
Intel Developer Support
0 Kudos
mirko_vukovic
Beginner
929 Views
ah! (or duh!)

thank you,

Mirko
0 Kudos
mirko_vukovic
Beginner
929 Views
Well, I spoke too soon (maybe time for another `duh').

I tried the ifort -openmp -diag-enable sc-parallel3 -c test.f90 command on the following code (an example from the Parallel Lint section):

[bash]parameter (N = 10)
integer i
integer, dimension(N) :: factorial

factorial(1) = 1

!$OMP PARALLEL DO
do i = 2, N
factorial(i) = i * factorial(i-1)
end do

print *, factorial
end
[/bash]
I don't get an error report. What else needs to be done?

Thanks,

Mirko




0 Kudos
TimP
Honored Contributor III
929 Views
Interesting. If I set -parallel -par-report2 it reports "existence of parallel dependence," so the analysis capability is there somewhere.
When I run this, there's no evidence of use of a second thread, possibly because the loop is so short.
0 Kudos
pbkenned1
Employee
929 Views
This may not be documented, butlint requires interprocedural (whole program) analysis to work, and you don't get that if compiing with -c. Just remove the -c:

> ifort -openmp -diag-enable sc-parallel3 test.f90 test.f90(8): warning #12246: flow data dependence from (file:test.f90 line:8) to (file:test.f90 line:8), due to "FACTORIAL" may lead to incorrect program execution in parallel mode

Another quirk is that '-diag-enable sc-parallel3' just does lint, and no executable is produced. So remove those flags to make an executable:

> ifort -openmp test.f90 && ./a.out

1 2 6 24 120 720

0 0 0 0

Clearly the compiler was onto something, as the last four outputs are not the factorials of {7,8,9,10}. You'll get the correct answer with one thread:

> export OMP_NUM_THREADS=1

> ./a.out

1 2 6 24 120 720

5040 40320 362880 3628800

>


Patrick Kennedy
Intel Developer Support

0 Kudos
Reply