From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7337 invoked by alias); 7 Jul 2011 19:24:19 -0000 Received: (qmail 7310 invoked by uid 22791); 7 Jul 2011 19:24:15 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_CP X-Spam-Check-By: sourceware.org Received: from mail-fx0-f49.google.com (HELO mail-fx0-f49.google.com) (209.85.161.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 07 Jul 2011 19:23:59 +0000 Received: by fxd20 with SMTP id 20so1220441fxd.22 for ; Thu, 07 Jul 2011 12:23:57 -0700 (PDT) Received: by 10.223.14.11 with SMTP id e11mr1707429faa.131.1310066637766; Thu, 07 Jul 2011 12:23:57 -0700 (PDT) Received: from [192.168.10.107] (h-187-67.a189.priv.bahnhof.se [85.24.187.67]) by mx.google.com with ESMTPS id h1sm6889750fag.11.2011.07.07.12.23.56 (version=SSLv3 cipher=OTHER); Thu, 07 Jul 2011 12:23:56 -0700 (PDT) Message-ID: <4E1607CB.9050400@gmail.com> Date: Thu, 07 Jul 2011 19:29:00 -0000 From: Daniel Carrera User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10 MIME-Version: 1.0 To: gfortran , gcc-patches@gcc.gnu.org Subject: [Patch, Fortra] Add STAT_STOPPED_IMAGE to SYC ALL/SYNC IMAGES Content-Type: multipart/mixed; boundary="------------010201060502080509060407" Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00549.txt.bz2 This is a multi-part message in MIME format. --------------010201060502080509060407 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 429 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 * 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. --------------010201060502080509060407 Content-Type: text/x-patch; name="stat-stopped-image.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="stat-stopped-image.diff" Content-length: 2714 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); } } --------------010201060502080509060407--