From: Daniel Carrera <dcarrera@gmail.com>
To: gfortran <fortran@gcc.gnu.org>, gcc-patches@gcc.gnu.org
Subject: [Patch, Fortra] Add STAT_STOPPED_IMAGE to SYC ALL/SYNC IMAGES
Date: Thu, 07 Jul 2011 19:29:00 -0000 [thread overview]
Message-ID: <4E1607CB.9050400@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 429 bytes --]
Hello,
I'd like to submit the attached patch. This patch was just discussed in
the gfortran list. It fixes a couple of TODO items in the MPI library.
It is a simple patch.
libgfortran/ChangeLog
2011-07-07 Daniel Carrera <dcarrera@gmail.com>
* mpi.c (_gfortran_caf_sync_all): Add STAT_STOPPED_IMAGE as a
possible status value.
(_gfortran_caf_sync_images): Ditto.
Cheers,
Daniel.
--
I'm not overweight, I'm undertall.
[-- Attachment #2: stat-stopped-image.diff --]
[-- Type: text/x-patch, Size: 2714 bytes --]
Index: libgfortran/caf/mpi.c
===================================================================
--- libgfortran/caf/mpi.c (revision 175973)
+++ libgfortran/caf/mpi.c (working copy)
@@ -179,35 +179,44 @@ _gfortran_caf_deregister (void **token _
void
_gfortran_caf_sync_all (int *stat, char *errmsg, int errmsg_len)
{
- /* TODO: Is ierr correct? When should STAT_STOPPED_IMAGE be used? */
- int ierr = MPI_Barrier (MPI_COMM_WORLD);
+ int ierr;
+
+ if (unlikely(caf_is_finalized))
+ ierr = STAT_STOPPED_IMAGE;
+ else
+ ierr = MPI_Barrier (MPI_COMM_WORLD);
if (stat)
*stat = ierr;
- if (ierr)
+ if (ierr)
{
- const char msg[] = "SYNC ALL failed";
+ char msg[30];
+ int len;
+
+ if (caf_is_finalized)
+ len = snprintf (msg, 30, "ERROR: Image %d is stopped", caf_this_image);
+ else
+ len = snprintf (msg, 30, "SYNC ALL failed");
+
if (errmsg_len > 0)
{
- int len = ((int) sizeof (msg) > errmsg_len) ? errmsg_len
- : (int) sizeof (msg);
+ len = (len > errmsg_len) ? errmsg_len : len;
memcpy (errmsg, msg, len);
if (errmsg_len > len)
memset (&errmsg[len], ' ', errmsg_len-len);
}
else
{
- fprintf (stderr, "SYNC ALL failed\n");
+ fprintf (stderr, "%s\n", msg);
error_stop (ierr);
}
}
}
-
/* SYNC IMAGES. Note: SYNC IMAGES(*) is passed as count == -1 while
SYNC IMAGES([]) has count == 0. Note further that SYNC IMAGES(*)
- is not equivalent to SYNC ALL. */
+ is not equivalent to SYNC ALL. */
void
_gfortran_caf_sync_images (int count, int images[], int *stat, char *errmsg,
int errmsg_len)
@@ -243,25 +252,34 @@ _gfortran_caf_sync_images (int count, in
}
/* Handle SYNC IMAGES(*). */
- /* TODO: Is ierr correct? When should STAT_STOPPED_IMAGE be used? */
- ierr = MPI_Barrier (MPI_COMM_WORLD);
+ if (unlikely(caf_is_finalized))
+ ierr = STAT_STOPPED_IMAGE;
+ else
+ ierr = MPI_Barrier (MPI_COMM_WORLD);
+
if (stat)
*stat = ierr;
- if (ierr)
+ if (ierr)
{
- const char msg[] = "SYNC IMAGES failed";
+ char msg[30];
+ int len;
+
+ if (caf_is_finalized)
+ len = snprintf (msg, 30, "ERROR: Image %d is stopped", caf_this_image);
+ else
+ len = snprintf (msg, 30, "SYNC IMAGES failed");
+
if (errmsg_len > 0)
{
- int len = ((int) sizeof (msg) > errmsg_len) ? errmsg_len
- : (int) sizeof (msg);
+ len = (len > errmsg_len) ? errmsg_len : len;
memcpy (errmsg, msg, len);
if (errmsg_len > len)
memset (&errmsg[len], ' ', errmsg_len-len);
}
else
{
- fprintf (stderr, "SYNC IMAGES failed\n");
+ fprintf (stderr, "%s\n", msg);
error_stop (ierr);
}
}
next reply other threads:[~2011-07-07 19:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-07 19:29 Daniel Carrera [this message]
2011-07-09 12:03 ` Tobias Burnus
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=4E1607CB.9050400@gmail.com \
--to=dcarrera@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@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).