OpenMP / Examples

LaTeX Examples Document Source

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Continuation markers in Fortran example

levlafayette opened this issue · comments

You may wish to look at the continuation markers in the following:

https://github.com/OpenMP/Examples/blob/v4.0.2/sources/Example_icv.1f.f

This will not always compile; for example I have tested it with numerous versions of gcc (from 4.4.6 to 4.9.3), portland (12.10 to 15.7), and intel compilers (14.0). The following snippet is an example

gfortran -fopenmp icvb.f90 -o icvbf
icvb.f90:23.67:
       print *, "Inner: max_act_lev=", omp_get_max_active_levels(),
                                                                   1
Error: Expected expression in PRINT statement at (1)
icvb.f90:24.6:
     &           ", num_thds=", omp_get_num_threads(),
      1

I think you need to put the continuation markers at the end of the line, not at the beginning of a new line.

Hope this helps,

Lev

@levlafayette, hi!

I think that example is correct. It is to be treated as fixed-form, so the continuation line should be in column 6. Looking at the example, the continuation character, '&', is indeed in column 6. I tried compiling with PGI and it compiled fine using -Mpreprocess -mp but using pgfortran with a .f extension and not the .f90 extension.

Cheers!

Yes, I noticed that as well (after the fact). But the other examples in the book use free form (two, if I recall correctly). Whilst I know it know that OpenMP with F77-style syntax is used....

The OpenMP directives were designed to support both fixed form and free form. The examples include both types of source forms intentionally. There is a tag (@@type) in the beginning of each example source to indicate the intended form.

On 1/3/16, 10:25 PM, "Lev Lafayette" <notifications@github.commailto:notifications@github.com> wrote:

Yes, I noticed that as well (after the fact). But the other examples in the book use free form (two, if I recall correctly). Whilst I know it know that OpenMP with F77-style syntax is used....


Reply to this email directly or view it on GitHubhttps://github.com//issues/16#issuecomment-168594005.

Right you are. Feel free to close this issue.

Actually, it is still an issue, albeit a formatting one. Whilst the github source files specify the flavour of Fortran being used, the examples in the PDF book "OpenMP Application Programming Interface Examples Version 4.0.2 – March 2015" do not.

So perhaps a wee note at the start of the book or similar would be helpful. Just a thought.

OK, we'll make a note. A possible solution is to include a remark for those examples that use the fixed form (hopefully only a small set) in next release of the document.

The issue has been addressed in the new 4.5 document with the introduction of .f for fixed form and .f90 for free form. So the issue is closed.