From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: fortran@gcc.gnu.org
Subject: RANDOM_INIT() and coarray Fortran
Date: Sat, 3 Apr 2021 10:28:46 -0700 [thread overview]
Message-ID: <20210403172846.GA14134@troutmask.apl.washington.edu> (raw)
What to do about RANDOM_INIT() and coarray Fortran?
The main issue is that if one compiles with -fcoarray=lib
(or the WIP -fcoarray=shared), then RANDOM_INIT() may
require communication between images. Thus, RANDOM_INIT()
cannot live in libgfortran for at least -fcoarray=lib.
Consider the simple code:
subroutine foo
call random_init(.true., .false.)
end subroutine foo
I have updated the patch for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98301
to use a stub routine for -fcoarray=lib and -fcoarray=shared.
Anyone, who knows how to use git, is encouraged to commit the patch.
For -fcoarray=none (default option) and -fcoarray=single, the
patch will cause gfortran to generate
__attribute__((fn spec (". ")))
void foo ()
{
_gfortran_random_init (1, 0, 0);
}
_gfortran_random_init() live in libgfortran and it has been updated
to meet the intended requires of the Fortran standard.
With -fcoarray=lib and -fcoarray=shared, gfortran will now generate
__attribute__((fn spec (". ")))
void foo ()
{
_gfortran_random_init_foobar (1, 0);
}
where _gfortran_random_init_foobar() lives in libgfortran. It prints
an error message that RANDOM_INIT() is not yet supported for coarray
Fortran and exits. Someone, who cares about coarray Fortran, can fix
-fcoarray=lib and -fcoarray=shared by updating trans-decl.c (see the
FIXME for random_init()) to emit
__attribute__((fn spec (". ")))
void foo ()
{
_gfortran_caf_random_init (1, 0);
}
or
__attribute__((fn spec (". ")))
void foo ()
{
_gfortran_cas_random_init (1, 0);
}
--
Steve
next reply other threads:[~2021-04-03 17:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-03 17:28 Steve Kargl [this message]
2021-04-04 3:30 ` Damian Rouson
2021-04-04 5:33 ` Steve Kargl
2021-04-23 16:43 ` [Patch, Fortran] PR98301 " Andre Vehreschild
2021-04-23 17:18 ` Steve Kargl
2021-04-24 10:49 ` [Patch, Fortran, Update] " Andre Vehreschild
2021-04-24 15:44 ` Steve Kargl
2021-04-24 15:56 ` Dr. Andre Vehreschild
2021-04-25 20:03 ` Steve Kargl
2021-04-26 10:36 ` [Patch, Fortran, Update 2] " Andre Vehreschild
2021-05-03 9:21 ` [Ping, Patch, " Andre Vehreschild
2021-05-03 15:20 ` Steve Kargl
2021-05-21 8:09 ` [Ping^2, Patch, Fortran] " Andre Vehreschild
2021-05-21 15:08 ` Steve Kargl
2021-05-22 2:38 ` Jerry D
2021-05-22 11:39 ` Andre Vehreschild
2021-05-22 17:58 ` Martin Liška
2021-05-23 11:59 ` Andre Vehreschild
2021-05-23 12:17 ` Martin Liška
2021-06-05 14:04 ` [Patch, Fortran, backport 2 gcc-11] " Andre Vehreschild
2021-06-05 16:27 ` Steve Kargl
2021-06-06 10:14 ` [COMITTED, Patch, " Andre Vehreschild
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210403172846.GA14134@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).