Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The good thing about standards is that there are so many to choose from. -- Andrew S. Tanenbaum


devel / comp.lang.fortran / Re: Does OpenMP (5.1) Invalidate this code?

SubjectAuthor
* Does OpenMP (5.1) Invalidate this code?Ev. Drikos
`* Re: Does OpenMP (5.1) Invalidate this code?Ev. Drikos
 `* Re: Does OpenMP (5.1) Invalidate this code?gah4
  `- Re: Does OpenMP (5.1) Invalidate this code?Ev. Drikos

1
Does OpenMP (5.1) Invalidate this code?

<t48mgh$1aa5$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2180&group=comp.lang.fortran#2180

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!BLhzRFRQ2Qx8CI6Sga2hhg.user.46.165.242.91.POSTED!not-for-mail
From: drikosev@gmail.com (Ev. Drikos)
Newsgroups: comp.lang.fortran
Subject: Does OpenMP (5.1) Invalidate this code?
Date: Tue, 26 Apr 2022 14:53:53 +0300
Organization: Aioe.org NNTP Server
Message-ID: <t48mgh$1aa5$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="43333"; posting-host="BLhzRFRQ2Qx8CI6Sga2hhg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
X-Mozilla-News-Host: news://news.aioe.org:119
 by: Ev. Drikos - Tue, 26 Apr 2022 11:53 UTC

Hello,

Possibly I miss some details with a new OpenMP-5.1 feature.

An OpenMP End Statement becomes optional if the opening statement
of an OpenMP construct is followed by a block-construct. An example
is given in the second program below which can be found at:
https://www.openmp.org/wp-content/uploads/openmp-examples-5-2.pdf

Does this new feature invalidate my code (the first program below),
or the block I wrote isn't strictly structured, or what I miss here?

Thanks in advance,
Ev. Drikos

----------------------------------------------------
$ cat my-code-4.5.f90 && gfc my-code-4.5.f90
program main
use omp_lib
implicit none
integer,parameter :: NT = 2, chunks=3

!$omp parallel num_threads(NT)
strictly_structured : block
print *, "chunks=", chunks
end block strictly_structured
print *, NT
!$omp end parallel
end
$ ----------------------------------------------------

macbook:examples-5.1 suser$ cat directive_syntax_F_block.2.f90
program main

use omp_lib
implicit none

!$omp parallel num_threads(2)
if( omp_get_thread_num() == 0 ) &
print*, "Loosely structured block -- end required."
block ! BLOCK Fortran 2008
if( omp_get_thread_num() == 0 ) &
print*, " --"
end block
!$omp end parallel

!$omp parallel num_threads(2)
block
if( omp_get_thread_num() == 0 ) &
print*, "Strictly structured block -- end not required."
end block
!!$omp end parallel !is optional for strictly structured block

print*, "Sequential part"

!$omp parallel num_threads(2) !outer parallel
if( omp_get_thread_num() == 0 ) &
print*, "Outer, loosely structured block."
!$omp parallel num_threads(2) !inner parallel
block
if( omp_get_thread_num()==0)&
print*, "Inner, strictly structured block."
end block
!$omp end parallel
!$omp end parallel

! Two end directives are required here.
! A single "!$omp end parallel" terminator will fail.
! 1st end directive is assumed to be for inner parallel construct.
! 2nd end directive applies to outer parallel construct.

end program

macbook:examples-5.1 suser$

Re: Does OpenMP (5.1) Invalidate this code?

<t4fpqa$deu$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2192&group=comp.lang.fortran#2192

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!Mo/tG5qiHYy+tm8GQsWEvg.user.46.165.242.91.POSTED!not-for-mail
From: drikosev@gmail.com (Ev. Drikos)
Newsgroups: comp.lang.fortran
Subject: Re: Does OpenMP (5.1) Invalidate this code?
Date: Fri, 29 Apr 2022 07:33:13 +0300
Organization: Aioe.org NNTP Server
Message-ID: <t4fpqa$deu$1@gioia.aioe.org>
References: <t48mgh$1aa5$1@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="13790"; posting-host="Mo/tG5qiHYy+tm8GQsWEvg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.5.1
Content-Language: en-US
X-Notice: Filtered by postfilter v. 0.9.2
X-Mozilla-News-Host: news://news.aioe.org
 by: Ev. Drikos - Fri, 29 Apr 2022 04:33 UTC

On 26/04/2022 14:53, Ev. Drikos wrote:

> ...
> An OpenMP End Statement becomes optional if the opening statement
> of an OpenMP construct is followed by a block-construct. An example
> is given in the second program ...
>
> Does this new feature invalidate my code (the first program below),
> or the block I wrote isn't strictly structured, or what I miss here?
> ...

Silence! Possibly, I've missed some details but I hope to eventually get
the point, which shall normally be genius. On the hand, if older code is
indeed invalidated, the chances are that such cases would be rare.

Re: Does OpenMP (5.1) Invalidate this code?

<b099d754-911b-4d92-b80d-16c7451d5e7an@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2193&group=comp.lang.fortran#2193

  copy link   Newsgroups: comp.lang.fortran
X-Received: by 2002:ac8:5b51:0:b0:2f3:8654:53b2 with SMTP id n17-20020ac85b51000000b002f3865453b2mr7669636qtw.300.1651208384438;
Thu, 28 Apr 2022 21:59:44 -0700 (PDT)
X-Received: by 2002:a25:d0d4:0:b0:646:f932:5d0f with SMTP id
h203-20020a25d0d4000000b00646f9325d0fmr28978642ybg.456.1651208384249; Thu, 28
Apr 2022 21:59:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!3.eu.feeder.erje.net!feeder.erje.net!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.fortran
Date: Thu, 28 Apr 2022 21:59:44 -0700 (PDT)
In-Reply-To: <t4fpqa$deu$1@gioia.aioe.org>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:a9ed:a01e:b648:8c0;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:a9ed:a01e:b648:8c0
References: <t48mgh$1aa5$1@gioia.aioe.org> <t4fpqa$deu$1@gioia.aioe.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b099d754-911b-4d92-b80d-16c7451d5e7an@googlegroups.com>
Subject: Re: Does OpenMP (5.1) Invalidate this code?
From: gah4@u.washington.edu (gah4)
Injection-Date: Fri, 29 Apr 2022 04:59:44 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 23
 by: gah4 - Fri, 29 Apr 2022 04:59 UTC

On Thursday, April 28, 2022 at 9:33:20 PM UTC-7, Ev. Drikos wrote:

(snip)

> Silence! Possibly, I've missed some details but I hope to eventually get
> the point, which shall normally be genius. On the hand, if older code is
> indeed invalidated, the chances are that such cases would be rare.

OK, note that it says that some are optional.

If an optional OpenMP END closes your block, then the actual
END statement that you supply would be an error. It should
diagnose that error, which would tell you that the block was
already closed.

It looks to me like the "strict" case is when the BLOCK directly
follows the !$ OMP Parallel statement. Since your does, it
looks to me that the block ends at the END BLOCK, and so has
already ended before the !$ OMP END.

In the case of nested blocks, there is an ambiguity with the
optional END. If you put just one, it could be the real one following
the omitted optional, or the actual optional one.

Re: Does OpenMP (5.1) Invalidate this code?

<t4grbp$12k5$1@gioia.aioe.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=2196&group=comp.lang.fortran#2196

  copy link   Newsgroups: comp.lang.fortran
Path: i2pn2.org!i2pn.org!aioe.org!fXTJjcbEBkE/QInCSySNNA.user.46.165.242.91.POSTED!not-for-mail
From: drikosev@gmail.com (Ev. Drikos)
Newsgroups: comp.lang.fortran
Subject: Re: Does OpenMP (5.1) Invalidate this code?
Date: Fri, 29 Apr 2022 17:05:44 +0300
Organization: Aioe.org NNTP Server
Message-ID: <t4grbp$12k5$1@gioia.aioe.org>
References: <t48mgh$1aa5$1@gioia.aioe.org> <t4fpqa$deu$1@gioia.aioe.org>
<b099d754-911b-4d92-b80d-16c7451d5e7an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="35461"; posting-host="fXTJjcbEBkE/QInCSySNNA.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0)
Gecko/20100101 Thunderbird/78.5.1
X-Mozilla-News-Host: news://news.aioe.org
X-Notice: Filtered by postfilter v. 0.9.2
Content-Language: en-US
 by: Ev. Drikos - Fri, 29 Apr 2022 14:05 UTC

On 29/04/2022 07:59, gah4 wrote:
> ...
>
> If an optional OpenMP END closes your block, then the actual
> END statement that you supply would be an error...

This is also what I'd understood, yet it's valid with older compilers,
ie gfortran-4.8.5 (I think OMP-3.0 or so) accepts my example as valid.

> ...
> In the case of nested blocks, there is an ambiguity with the
> optional END. If you put just one, it could be the real one following
> the omitted optional, or the actual optional one.
>

Thank you. I'd not yet reached that point. In this case there might
be another issue with the END directives that contain arguments, ie:

!$OMP END SINGLE [clause...] or
!$OMP END WROKSHARE [NOWAIT]

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor