Power Programming Languages

Power Programming Languages

IBM Power, including the AIX, IBM i, and Linux operating systems, support a wide range of programming languages, catering to both traditional enterprise applications and modern development needs.


#Power

 View Only

How to tell IBM XL Fortran NOT to ignore the !IBM* directives when using -qsmp=omp?

By Archive User posted Wed September 12, 2018 04:29 PM

  

Originally posted by: BasilTK


Applicable XL Fortran versions:
  • XL Fortran for AIX, V15.1.3 and previous releases 
  • XL Fortran for Linux, V15.1.3 and previous releases 
 
Problem:
The XL Fortran compilers ignore source code !IBM* comment directives when -qsmp=omp is specified at compile time. 
 
Example:
In this testcase mytest.f90, suppose you want to instruct the compiler to suppress vectorization in this particular loop with !IBM* NOVECTOR:
  • !IBM* NOVECTOR 
  •  DO i = 1,n 
  •  a(i) = 1.0 / a(i) 
  •  END DO  
If you specify -qsmp=omp at compile time, all the !IBM* comment directives seem to be ignored. That is, they are not passed on to secondary optimization stages.
So, how can you tell the compiler NOT to ignore the !IBM* comment directives such as !IBM* NOVECTOR in the above case?
 
Explanation:
When you specify the -qsmp=omp option, the compiler recognizes only the $OMP trigger constant and ignores all trigger constants (like !IBM*) that you have specified up to that point. As a result, if you compile mytest.f90 using the following command: 
  • xlf90_r -qsource -qlist -qreport -O3 -qhot -qsmp=omp mytest.f90 
only the $OMP directive is defined and recognized. Therefore, the !IBM* comment directives are treated as comments and not as compiler directives.
 
Solution:
In order for this kind of !IBM* comment directive to be recognized by the compiler, and thus disable the use of vector for this loop as intended, you need to specify the -qdirective option AFTER the -qsmp option.  
  • xlf90_r -qsource -qlist -qreport  -O3 -qhot -qsmp=omp -qdirective='IBM*' mytest.f90
 
Reference:
 
The compiler behavior has changed since XL Fortran for Linux, V15.1.4. That is, the -qsmp=omp option is changed to imply -qdirective=SMP\$:\$OMP:IBMP, which turns on the trigger constants SMP$, $OMP, and IBMP, in addition to the default trigger constant IBM*.
 
 
 
 

#IBM-XL-C,-C++,-and-Fortran-Compilers-for-POWER-servers-blog
#C/C++andFortran
0 comments
1 view

Permalink