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

Fortran Preprocessor: #endif creates a blank line

Wentao_Z_
Beginner
1,967 Views

Hi ,

I have a quick question regarding the #ifdef and #endif for preprocessing. I have the following code piece in my fpp file:

#ifdef USE_SIMD
              !DIR$ SIMD
#endif
              do i = is, ie
                dF(i + offset_kj) = dF(i + offset_kj) + value * F(i + offset_ii)
              end do

 

After preprocessing, I got the following code piece in the f90 file:

!DIR$ SIMD

              do i = is, ie
                dF(i + offset_kj) = dF(i + offset_kj) + value * F(i + offset_ii)
              end do

 

There is a blank line between the SIMD directive and the do i loop. I think it is generated by the #endif directive. Is there an easy way to avoid this? I want the SIMD directive to be next to the do i loop.

I would truly appreciate your help!

Best regards,
    Wentao

0 Kudos
1 Solution
Kevin_D_Intel
Employee
1,967 Views

Development indicates there is no way to suppress this blank line with fpp. Sorry.

View solution in original post

0 Kudos
8 Replies
Kevin_D_Intel
Employee
1,967 Views

I have not found a way. fpp seems to be operating consist with cpp in this regard also. I inquired with our Developers whether this is possible and will let you know what they say.

0 Kudos
TimP
Honored Contributor III
1,967 Views

I haven't encountered adverse effects from this.  I make extensive use of fpp insertion of omp simd in view of the need to make it conditional on __MIC__.

0 Kudos
Kevin_D_Intel
Employee
1,968 Views

Development indicates there is no way to suppress this blank line with fpp. Sorry.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,967 Views

Have you tried:

#endif  do i = is, ie

Jim Dempsey

0 Kudos
Wentao_Z_
Beginner
1,967 Views

Tim Prince wrote:

I haven't encountered adverse effects from this.  I make extensive use of fpp insertion of omp simd in view of the need to make it conditional on __MIC__.

Thanks for your reply. If the blank line does not influence how !DIR$ SIMD works, then that's fine.

0 Kudos
Wentao_Z_
Beginner
1,967 Views

jimdempseyatthecove wrote:

Have you tried:

#endif  do i = is, ie

Jim Dempsey

Thanks for your reply. But this does not work since the preprocessing will "eat" the do i loop.

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,967 Views

If you are inclined to use FPP to create a source file that you keep, as opposed to an intermediary file to use as source, then you could easily write a script to remove blank lines following !DEC$ SIMD (and tidy up other things).

Jim Dempsey

0 Kudos
Wentao_Z_
Beginner
1,967 Views

jimdempseyatthecove wrote:

If you are inclined to use FPP to create a source file that you keep, as opposed to an intermediary file to use as source, then you could easily write a script to remove blank lines following !DEC$ SIMD (and tidy up other things).

Jim Dempsey

Thanks for your suggestion:-)

Best,
Wentao

0 Kudos
Reply