mpi-forum / mpi-forum-historic

Migration of old MPI Forum Trac Tickets to GitHub. New issues belong on mpi-forum/mpi-issues.
http://www.mpi-forum.org
2 stars 3 forks source link

Correcting examples in context chapter #331

Open mpiforumbot opened 8 years ago

mpiforumbot commented 8 years ago

Originally by gropp on 2012-03-07 09:33:05 -0600


I ran the code checker over the current version of the MPI-3 standard. Attached are my recommended fixes for the context chapter. This should be considered a chapter committee issue, and is added as a ticket only to capture the issue.

Bill

ndex: chap-context/context.tex
===================================================================
--- chap-context/context.tex    (revision 1116)
+++ chap-context/context.tex    (working copy)
@@ -1310,6 +1310,7 @@
 This example illustrates the use of a collective communication.
 \subsection{(Approximate) Current Practice \#3}
 \label{context-ex3}
+% WDG - fixed misspellings of recvbuf and recvbuf2 (had two ``f''s)
 %%HEADER
 %%LANG: C
 %%SKIPELIPSIS
@@ -1334,12 +1335,12 @@
     {
       /* compute on slave */
       ...
-      MPI_Reduce(send_buf,recv_buff,count, MPI_INT, MPI_SUM, 1, commslave);
+      MPI_Reduce(send_buf,recv_buf,count, MPI_INT, MPI_SUM, 1, commslave);
       ...
       MPI_Comm_free(&commslave);
     }
     /* zero falls through immediately to this reduce, others do later... */
-    MPI_Reduce(send_buf2, recv_buff2, count2,
+    MPI_Reduce(send_buf2, recv_buf2, count2,
                MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);

     MPI_Group_free(&MPI_GROUP_WORLD);
@@ -1368,6 +1369,7 @@
 The following example is meant to illustrate ``safety'' between
 point-to-point and collective communication.  \MPI/ guarantees that a single
 communicator can do safe point-to-point and collective communication.
+% WDG - fixed , that should be a ; in for statement before SOME_COUNT
 %%HEADER
 %%LANG: C
 %%SKIPELIPSIS
@@ -1401,7 +1403,7 @@
                            the_comm, request);
          MPI_Isend(buff2, count, MPI_DOUBLE, (me+1)%4, TAG_ARBITRARY,
                            the_comm, request+1);
-         for(i = 0; i < SOME_COUNT, i++)
+         for(i = 0; i < SOME_COUNT; i++)
            MPI_Reduce(..., the_comm);
          MPI_Waitall(2, request, status);

@@ -1497,6 +1499,8 @@

 \noindent User communication clean-up code:
 %% FIXME - pass addresses of handles (for consistency with the other examples)
+%% WDG - Fixed incorrect handles passed to Wait (needed address to match 
+%% other uses)
 %%HEADER
 %%LANG: C
 %%DECL: typedef struct { MPI_Comm comm; MPI_Request isend_handle, irecv_handle;} user_lib_t;
@@ -1506,8 +1510,8 @@
    void user_end_op(user_lib_t *handle)
    {
      MPI_Status status;
-     MPI_Wait(handle -> isend_handle, &status);
-     MPI_Wait(handle -> irecv_handle, &status);
+     MPI_Wait(& handle -> isend_handle, &status);
+     MPI_Wait(& handle -> irecv_handle, &status);
    }
 \end{verbatim}

@@ -3072,8 +3076,7 @@
       /* other stuff, whatever else we want */
    } gop_stuff_type;

-   Efficient_Collective_Op (comm, ...)
-   MPI_Comm comm;
+   Efficient_Collective_Op (MPI_Comm comm, ...)
    {
      gop_stuff_type *gop_stuff;
      MPI_Group       group;
@@ -3122,11 +3125,8 @@

    /* The following routine is called by MPI when a group is freed */

-   gop_stuff_destructor (comm, keyval, gop_stuff, extra)
-   MPI_Comm comm;
-   int keyval;
-   gop_stuff_type *gop_stuff;
-   void *extra;
+   gop_stuff_destructor (MPI_Comm comm, int keyval, gop_stuff_type *gop_stuff, 
+                         void *extra)
    {
      if (keyval != gop_key) { /* abort -- programming error */ }

@@ -3140,11 +3140,8 @@
    }

    /* The following routine is called by MPI when a group is copied */
-   gop_stuff_copier (comm, keyval, extra, gop_stuff_in, gop_stuff_out, flag)
-   MPI_Comm comm;
-   int keyval;
-   gop_stuff_type *gop_stuff_in, *gop_stuff_out;
-   void *extra;
+   gop_stuff_copier (MPI_Comm comm, int keyval, void *extra, 
+    gop_stuff_type *gop_stuff_in, gop_stuff_type *gop_stuff_out, int flag)
    {
      if (keyval != gop_key) { /* abort -- programming error */ }
mpiforumbot commented 8 years ago

Originally by RolfRabenseifner on 2012-07-14 07:12:19 -0500


Review: All is implemented in the approved svn. Ticket can be closed with TEXT COMMITTED.