Oops! I sent the patch to George but didn't send it to everyone
else. Here's a patch showing how I propose to fix this problem:
--- ompi/mca/op/op.h (revision 20777)
+++ ompi/mca/op/op.h (working copy)
@@ -258,14 +258,41 @@
typedef ompi_op_base_handler_fn_1_0_0_t ompi_op_base_handler_fn_t;
+ * Per the thread starting here:
+ * http://www.open-mpi.org/community/lists/users/2009/03/8402.php
+ * We [re-]discovered that AC_C_RESTRICT only checks for "restrict" in
+ * the C compiler. But this header file is included in components.cc
+ * (i.e., ompi_info), so the "restrict" here may be problematic for
+ * the C++ compiler.
+ * Since we *know* that this function is only used in C code in OMPI
+ * (e.g., it's not used in ompi_info or the C++ bindings), just
+ * have an "alternate"
+#if defined(c_plusplus) || defined(__cplusplus)
+#define OMPI_SAFE_RESTRICT restrict
* Typedef for 3-buffer (two input and one output) op functions.
-typedef void (*ompi_op_base_3buff_handler_fn_1_0_0_t)(void *,
- void *,
- void *, int *,
+typedef void (*ompi_op_base_3buff_handler_fn_1_0_0_t)(void
+ int *,
+ * We don't want anyone else using OMPI_SAFE_RESTRICT elsewhere in the
+ * code base; this hack is only because we don't have an
+ * AC_CXX_RESTRICT Autoconf test.
On Mar 14, 2009, at 8:22 AM, Jeff Squyres (jsquyres) wrote:
> Yes, it does.
> It re-looking at this problem, it seemed to me:
> 1. The real fix is to talk to the AC people and get something like
> AC_CXX_RESTRICT. The PGI compiler is one place where "restrict"
> support may be different in the C and C++ compilers. I'm not sure
> what the Right answer is there, but I'll ask them about it.
> 2. In this specific case, the use of "restrict" *does not matter* in
> components.cc. This particular part of the file is not what
> components.cc needs/uses. So it's ok to #define it away to nothing.
> 3. Since this problem now exists in at least *2* compilers that we
> know about (Sun, PGI), it seemed that -- at least while waiting for
> some kind of proper fix from AC -- just #define restrict away for C++
> for this particular case was ok, rather than try to adapt to every
> compiler. Rolf's fix was ok previously because we thought it was
> specific to one compiler. But now the door is open to other
> compilers, so let's use a broad stroke to work around it for all C++
> That's why I coded it up this way.
> On Mar 14, 2009, at 7:39 AM, Terry Dontje wrote:
> > You know this all looks very similar to the reason why rolfv putback
> > r20351 which essentially defined out restrict within
> > opal_config_bottom.h when using Sun Studio.
> > --td
> > Date: Fri, 13 Mar 2009 16:40:49 -0400
> > From: Jeff Squyres <jsquyres_at_[hidden]>
> > Subject: Re: [OMPI users] PGI 8.0-4 doesn't like ompi/mca/op/op.h
> > To: "Open MPI Users" <users_at_[hidden]>
> > Message-ID: <2ACA69AB-5F23-4AE9-8826-77A6348E934A_at_[hidden]>
> > Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
> > On Mar 13, 2009, at 4:37 PM, Mostyn Lewis wrote:
> > > > >From config.log
> > > >
> > > > configure:21522: checking for C/C++ restrict keyword
> > > > configure:21558: pgcc -c -DNDEBUG -fast -Msignextend -tp
> p7-64 >
> > > conftest.c >&5
> > > > configure:21564: $? = 0
> > > > configure:21582: result: restrict
> > > >
> > > > So you only check using pgcc (not pgCC)?
> > > >
> > >
> > The AC_C_RESTRICT test only checks the C compiler, yet. It's an
> > Autoconf-builtin test; we didn't write it.
> > Odd that you get "restrict" and I get "__restrict". Hrm.
> > Well, I suppose that one solution might be to disable those
> > in the op.h header file when they're included in components.cc
> > a source file in the ompi_info executable; it shouldn't need the
> > specific MPI_Op callback prototypes). Fortunately, we have very
> > little
> > C++ code in OMPI, so this isn't a huge issue (C++ is only used for
> > the
> > MPI C++ bindings -- of course -- and in some of the command line
> > executables).
> > Let me see what I can cook up, and then let me see if I can convince
> > George that it's the correct answer. ;-)
> > -- Jeff Squyres Cisco Systems
> > _______________________________________________
> > users mailing list
> > users_at_[hidden]
> > http://www.open-mpi.org/mailman/listinfo.cgi/users
> Jeff Squyres
> Cisco Systems
> users mailing list