Code reorg in thread_mpi
authorSander Pronk <pronk@cbr.su.se>
Wed, 1 Sep 2010 07:26:12 +0000 (09:26 +0200)
committerMark Abraham <Mark.J.Abraham@gmail.com>
Wed, 1 Sep 2010 08:53:37 +0000 (18:53 +1000)
16 files changed:
cmake/ThreadMPI.cmake
src/gmxlib/thread_mpi/CMakeLists.txt
src/gmxlib/thread_mpi/Makefile.am
src/gmxlib/thread_mpi/alltoall.c [moved from src/gmxlib/thread_mpi/alltoall.h with 96% similarity]
src/gmxlib/thread_mpi/bcast.c [moved from src/gmxlib/thread_mpi/bcast.h with 91% similarity]
src/gmxlib/thread_mpi/collective.c
src/gmxlib/thread_mpi/collective.h [new file with mode: 0644]
src/gmxlib/thread_mpi/gather.c [moved from src/gmxlib/thread_mpi/gather.h with 96% similarity]
src/gmxlib/thread_mpi/impl.h
src/gmxlib/thread_mpi/p2p.c [deleted file]
src/gmxlib/thread_mpi/p2p.h [new file with mode: 0644]
src/gmxlib/thread_mpi/p2p_protocol.c [moved from src/gmxlib/thread_mpi/p2p_protocol.h with 84% similarity]
src/gmxlib/thread_mpi/p2p_send_recv.c [moved from src/gmxlib/thread_mpi/p2p_send_recv.h with 96% similarity]
src/gmxlib/thread_mpi/p2p_wait.c [moved from src/gmxlib/thread_mpi/p2p_wait.h with 97% similarity]
src/gmxlib/thread_mpi/reduce.c [moved from src/gmxlib/thread_mpi/reduce.h with 97% similarity]
src/gmxlib/thread_mpi/scatter.c [moved from src/gmxlib/thread_mpi/scatter.h with 97% similarity]

index b4c111bd24cbd2352f508e70bdacb71ebe676c8a..853372741c14e6128fd8b40ae3685c352b190b9c 100644 (file)
@@ -28,24 +28,38 @@ if (CMAKE_USE_PTHREADS_INIT)
     set(THREAD_PTHREADS 1)
     #add_definitions(-DTHREAD_PTHREADS)
     set(THREAD_MPI_SRC 
-        thread_mpi/barrier.c     thread_mpi/hwinfo.c      thread_mpi/pthreads.c
-        thread_mpi/collective.c  thread_mpi/list.c        thread_mpi/reduce_fast.c
-        thread_mpi/comm.c        thread_mpi/lock.c        thread_mpi/tmpi_init.c
-        thread_mpi/errhandler.c  thread_mpi/once.c        thread_mpi/topology.c
-        thread_mpi/event.c       thread_mpi/p2p.c         thread_mpi/type.c
-        thread_mpi/group.c       thread_mpi/profile.c)
+        thread_mpi/alltoall.c      thread_mpi/p2p_protocol.c
+        thread_mpi/barrier.c       thread_mpi/p2p_send_recv.c
+        thread_mpi/bcast.c         thread_mpi/p2p_wait.c
+        thread_mpi/collective.c    thread_mpi/profile.c
+        thread_mpi/comm.c          thread_mpi/pthreads.c
+        thread_mpi/errhandler.c    thread_mpi/reduce.c
+        thread_mpi/event.c         thread_mpi/reduce_fast.c
+        thread_mpi/gather.c        thread_mpi/scatter.c
+        thread_mpi/group.c         thread_mpi/tmpi_init.c
+        thread_mpi/hwinfo.c        thread_mpi/topology.c
+        thread_mpi/list.c          thread_mpi/type.c
+        thread_mpi/lock.c          
+        thread_mpi/once.c)
     set(THREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
 else (CMAKE_USE_PTHREADS_INIT)
     if (CMAKE_USE_WIN32_THREADS_INIT)
         set(THREAD_WINDOWS 1)
         #add_definitions(-DTHREAD_WINDOWS)
         set(THREAD_MPI_SRC 
-            thread_mpi/barrier.c     thread_mpi/hwinfo.c      
-            thread_mpi/collective.c  thread_mpi/list.c        thread_mpi/reduce_fast.c
-            thread_mpi/comm.c        thread_mpi/lock.c        thread_mpi/tmpi_init.c
-            thread_mpi/errhandler.c  thread_mpi/once.c        thread_mpi/topology.c
-            thread_mpi/event.c       thread_mpi/p2p.c         thread_mpi/type.c
-            thread_mpi/group.c       thread_mpi/profile.c     thread_mpi/winthreads.c)
+            thread_mpi/alltoall.c      thread_mpi/p2p_protocol.c
+            thread_mpi/barrier.c       thread_mpi/p2p_send_recv.c
+            thread_mpi/bcast.c         thread_mpi/p2p_wait.c
+            thread_mpi/collective.c    thread_mpi/profile.c
+            thread_mpi/comm.c          
+            thread_mpi/errhandler.c    thread_mpi/reduce.c
+            thread_mpi/event.c         thread_mpi/reduce_fast.c
+            thread_mpi/gather.c        thread_mpi/scatter.c
+            thread_mpi/group.c         thread_mpi/tmpi_init.c
+            thread_mpi/hwinfo.c        thread_mpi/topology.c
+            thread_mpi/list.c          thread_mpi/type.c
+            thread_mpi/lock.c          thread_mpi/winthreads.c
+            thread_mpi/once.c)
         set(THREAD_LIBRARY )
     endif (CMAKE_USE_WIN32_THREADS_INIT)
 endif (CMAKE_USE_PTHREADS_INIT)
index c9d3a7868259cee0f3a6e2af041df925b2473f88..b753b69aeae6e75857c6c95bb023730ad7a8cdbf 100644 (file)
@@ -1,10 +1,16 @@
 
 # Note that not all .c files are compiled directly: some of them 
 # are #included (some multiple times) from other source files.
-set(THREAD_MPI_LIB_SOURCE tmpi_init.c 
-            errhandler.c type.c group.c comm.c topology.c p2p.c collective.c 
-            once.c list.c reduce_fast.c profile.c event.c barrier.c
-            lock.c hwinfo.c)
+set(THREAD_MPI_LIB_SOURCE 
+    alltoall.c      hwinfo.c        reduce.c
+    barrier.c       list.c          reduce_fast.c
+    bcast.c         lock.c          scatter.c
+    collective.c    once.c          tmpi_init.c
+    comm.c          p2p_protocol.c  topology.c
+    errhandler.c    p2p_send_recv.c type.c
+    event.c         p2p_wait.c      
+    gather.c        profile.c
+    group.c         )
 
 
 if (THREAD_PTHREADS)
index 379aa2bcebc3848d3fe842e702222da011a0c406..f3a620361ff99f0ddf4b5645a97a136a005de63d 100644 (file)
@@ -10,17 +10,17 @@ AM_CPPFLAGS= -I$(top_srcdir)/include
 noinst_LTLIBRARIES = libthread_mpi.la
 
 # again, we assume that we're using pthreads if we're using autotools.
-libthread_mpi_la_SOURCES = alltoall.h      lock.c          reduce_fast.c \
-                          barrier.c       scatter.h       bcast.h \
+libthread_mpi_la_SOURCES = alltoall.c      lock.c          reduce_fast.c \
+                          barrier.c       scatter.c       bcast.c \
                           once.c          settings.h      collective.c \
-                          p2p.c           \
-                          comm.c          p2p_protocol.h  tmpi_init.c \
-                          errhandler.c    p2p_send_recv.h tmpi_ops.h \
-                          event.c         p2p_wait.h      topology.c \
-                          gather.h        profile.c       type.c \
+                          p2p.h           collective.h \
+                          comm.c          p2p_protocol.c  tmpi_init.c \
+                          errhandler.c    p2p_send_recv.c tmpi_ops.h \
+                          event.c         p2p_wait.c      topology.c \
+                          gather.c        profile.c       type.c \
                           group.c         profile.h       hwinfo.c \
-                          pthreads.c      impl.h          pthreads.h\
-                          list.c          reduce.h
+                          pthreads.c      impl.h          pthreads.h \
+                          list.c          reduce.c
 
 CLEANFILES     = *.la *~ \\\#*
 
similarity index 96%
rename from src/gmxlib/thread_mpi/alltoall.h
rename to src/gmxlib/thread_mpi/alltoall.c
index 9082d8a45e838e3d02f5db7bd4aabc530ee5d963..6908ac69e27e04f7362884d89c59e47c6a52a83e 100644 (file)
@@ -35,8 +35,28 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is #included from collective.c; it's not really a header file,
-      but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "impl.h"
+#include "collective.h"
+
 
 
 int tMPI_Alltoall(void* sendbuf, int sendcount, tMPI_Datatype sendtype,
similarity index 91%
rename from src/gmxlib/thread_mpi/bcast.h
rename to src/gmxlib/thread_mpi/bcast.c
index c90877f5cbba6409a7210cc153181687de226cb0..2ec09096d57a6225ed099484ab4dc609aa494b57 100644 (file)
@@ -34,10 +34,28 @@ inclusion in the official distribution, but derived work should not
 be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
 
+#include "impl.h"
+#include "collective.h"
 
-/* this file is to be #included from collective.c; it's not really a header 
-   file, but this defines a lot of functions that probably need to be inlined.*/
 
 /* broadcast */
 int tMPI_Bcast(void* buffer, int count, tMPI_Datatype datatype, int root,
index d8881f08193860b472b734d7293f477dd3fa5b8e..1e23599c9e291b6269a159fe14f19a68364894c9 100644 (file)
@@ -55,52 +55,9 @@ files.
 #include <string.h>
 
 #include "impl.h"
+#include "collective.h"
 
 
-/* get a pointer the next coll_env once it's ready */
-static struct coll_env *tMPI_Get_cev(tMPI_Comm comm, int myrank, int *synct);
-
-/* post the availability of data in a cev. 
-    cev         = the collective comm environment
-    myrank      = my rank
-    index       = the buffer index
-    tag         = the tag
-    datatype    = the datatype
-    busize      = the buffer size
-    buf         = the buffer to xfer
-    n_remaining = the number of remaining threads that need to transfer
-    synct       = the multicast sync number 
-    dest        = -1 for all theads, or a specific rank number.
-*/
-static void tMPI_Post_multi(struct coll_env *cev, int myrank, int index, 
-                            int tag, tMPI_Datatype datatype, 
-                            size_t bufsize, void *buf, int n_remaining, 
-                            int synct, int dest);
-
-/* transfer data from cev->met[rank] to recvbuf */
-static void tMPI_Mult_recv(tMPI_Comm comm, struct coll_env *cev, int rank,
-                           int index, int expected_tag, tMPI_Datatype recvtype,
-                           size_t recvsize, void *recvbuf, int *ret);
-
-/* do a root transfer (from root send buffer to root recv buffer) */
-static void tMPI_Coll_root_xfer(tMPI_Comm comm, 
-                                tMPI_Datatype sendtype, tMPI_Datatype recvtype, 
-                                size_t sendsize, size_t recvsize, 
-                                void* sendbuf, void* recvbuf, int *ret);
-
-/* wait for other processes to copy data from my cev */
-static void tMPI_Wait_for_others(struct coll_env *cev, int myrank);
-/* wait for data to become available from a specific rank */
-static void tMPI_Wait_for_data(struct tmpi_thread *cur, struct coll_env *cev, 
-                               int myrank);
-                               /*int rank, int myrank, int synct);*/
-
-/* run a single binary reduce operation on src_a and src_b, producing dest. 
-      dest and src_a may be identical */
-static int tMPI_Reduce_run_op(void *dest, void *src_a, void *src_b,
-                              tMPI_Datatype datatype, int count, tMPI_Op op,
-                              tMPI_Comm comm);
-
 
 
 
@@ -177,7 +134,7 @@ void tMPI_Copy_buffer_list_return(struct copy_buffer_list *cbl,
 
 
 
-static void tMPI_Coll_envt_init(struct coll_env_thread *met, int N)
+void tMPI_Coll_envt_init(struct coll_env_thread *met, int N)
 {
     tMPI_Atomic_set(&(met->current_sync), 0);
     tMPI_Atomic_set(&(met->n_remaining), 0);
@@ -194,7 +151,7 @@ static void tMPI_Coll_envt_init(struct coll_env_thread *met, int N)
 }
 
 
-static void tMPI_Coll_envt_destroy(struct coll_env_thread *met)
+void tMPI_Coll_envt_destroy(struct coll_env_thread *met)
 {
     free( (void*)met->buf );
     free( (void*)met->bufsize );
@@ -266,7 +223,7 @@ void tMPI_Coll_sync_destroy(struct coll_sync *csync)
 
 
 /* get a pointer the next coll_env once it's ready. */
-static struct coll_env *tMPI_Get_cev(tMPI_Comm comm, int myrank, int *counter)
+struct coll_env *tMPI_Get_cev(tMPI_Comm comm, int myrank, int *counter)
 {
     struct coll_sync *csync=&(comm->csync[myrank]);
     struct coll_env *cev;
@@ -305,9 +262,9 @@ static struct coll_env *tMPI_Get_cev(tMPI_Comm comm, int myrank, int *counter)
 
 
 
-static void tMPI_Mult_recv(tMPI_Comm comm, struct coll_env *cev, int rank,
-                           int index, int expected_tag, tMPI_Datatype recvtype, 
-                           size_t recvsize, void *recvbuf, int *ret)
+void tMPI_Mult_recv(tMPI_Comm comm, struct coll_env *cev, int rank,
+                    int index, int expected_tag, tMPI_Datatype recvtype, 
+                    size_t recvsize, void *recvbuf, int *ret)
 {
     size_t sendsize=cev->met[rank].bufsize[index];
 
@@ -410,10 +367,10 @@ static void tMPI_Mult_recv(tMPI_Comm comm, struct coll_env *cev, int rank,
     }
 }
 
-static void tMPI_Coll_root_xfer(tMPI_Comm comm, tMPI_Datatype sendtype, 
-                                tMPI_Datatype recvtype, 
-                                size_t sendsize, size_t recvsize, 
-                                void* sendbuf, void* recvbuf, int *ret)
+void tMPI_Coll_root_xfer(tMPI_Comm comm, tMPI_Datatype sendtype, 
+                         tMPI_Datatype recvtype, 
+                         size_t sendsize, size_t recvsize, 
+                         void* sendbuf, void* recvbuf, int *ret)
 {
     /* do root transfer */
     if (recvsize < sendsize)
@@ -435,9 +392,9 @@ static void tMPI_Coll_root_xfer(tMPI_Comm comm, tMPI_Datatype sendtype,
     memcpy(recvbuf, sendbuf, sendsize);
 }
 
-static void tMPI_Post_multi(struct coll_env *cev, int myrank, int index, 
-                            int tag, tMPI_Datatype datatype, size_t bufsize, 
-                            void *buf, int n_remaining, int synct, int dest)
+void tMPI_Post_multi(struct coll_env *cev, int myrank, int index, 
+                     int tag, tMPI_Datatype datatype, size_t bufsize, 
+                     void *buf, int n_remaining, int synct, int dest)
 {
     int i;
 #ifdef USE_COLLECTIVE_COPY_BUFFER
@@ -502,7 +459,7 @@ static void tMPI_Post_multi(struct coll_env *cev, int myrank, int index,
 }
 
 
-static void tMPI_Wait_for_others(struct coll_env *cev, int myrank)
+void tMPI_Wait_for_others(struct coll_env *cev, int myrank)
 {
 #if defined(TMPI_PROFILE) 
     struct tmpi_thread *cur=tMPI_Get_current();
@@ -546,9 +503,8 @@ static void tMPI_Wait_for_others(struct coll_env *cev, int myrank)
 #endif
 }
 
-static void tMPI_Wait_for_data(struct tmpi_thread *cur, struct coll_env *cev, 
-                               int myrank)
-                               /*int rank, int myrank, int synct)*/
+void tMPI_Wait_for_data(struct tmpi_thread *cur, struct coll_env *cev, 
+                        int myrank)
 {
 #if defined(TMPI_PROFILE) 
     tMPI_Profile_wait_start(cur);
@@ -602,12 +558,3 @@ int tMPI_Barrier(tMPI_Comm comm)
 
 
 
-/* The actual collective functions are #included, so that the static
-   functions above are available to them and can get inlined if the
-   compiler deems it appropriate. */
-#include "bcast.h"
-#include "scatter.h"
-#include "gather.h"
-#include "alltoall.h"
-#include "reduce.h"
-
diff --git a/src/gmxlib/thread_mpi/collective.h b/src/gmxlib/thread_mpi/collective.h
new file mode 100644 (file)
index 0000000..337cdaf
--- /dev/null
@@ -0,0 +1,78 @@
+/*
+This source code file is part of thread_mpi.  
+Written by Sander Pronk, Erik Lindahl, and possibly others. 
+
+Copyright (c) 2009, Sander Pronk, Erik Lindahl.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1) Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2) Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3) Neither the name of the copyright holders nor the
+   names of its contributors may be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+If you want to redistribute modifications, please consider that
+scientific software is very special. Version control is crucial -
+bugs must be traceable. We will be happy to consider code for
+inclusion in the official distribution, but derived work should not
+be called official thread_mpi. Details are found in the README & COPYING
+files.
+*/
+
+
+/* get a pointer the next coll_env once it's ready */
+struct coll_env *tMPI_Get_cev(tMPI_Comm comm, int myrank, int *synct);
+
+/* post the availability of data in a cev. 
+   cev         = the collective comm environment
+   myrank      = my rank
+   index       = the buffer index
+   tag         = the tag
+   datatype    = the datatype
+   busize      = the buffer size
+   buf         = the buffer to xfer
+   n_remaining = the number of remaining threads that need to transfer
+   synct       = the multicast sync number 
+   dest        = -1 for all theads, or a specific rank number.
+   */
+void tMPI_Post_multi(struct coll_env *cev, int myrank, int index, 
+                     int tag, tMPI_Datatype datatype, 
+                     size_t bufsize, void *buf, int n_remaining, 
+                     int synct, int dest);
+
+/* transfer data from cev->met[rank] to recvbuf */
+void tMPI_Mult_recv(tMPI_Comm comm, struct coll_env *cev, int rank,
+                    int index, int expected_tag, tMPI_Datatype recvtype,
+                    size_t recvsize, void *recvbuf, int *ret);
+
+/* do a root transfer (from root send buffer to root recv buffer) */
+void tMPI_Coll_root_xfer(tMPI_Comm comm, 
+                         tMPI_Datatype sendtype, tMPI_Datatype recvtype, 
+                         size_t sendsize, size_t recvsize, 
+                         void* sendbuf, void* recvbuf, int *ret);
+
+/* wait for other processes to copy data from my cev */
+void tMPI_Wait_for_others(struct coll_env *cev, int myrank);
+/* wait for data to become available from a specific rank */
+void tMPI_Wait_for_data(struct tmpi_thread *cur, struct coll_env *cev, 
+                        int myrank);
+/*int rank, int myrank, int synct);*/
+
+
+
similarity index 96%
rename from src/gmxlib/thread_mpi/gather.h
rename to src/gmxlib/thread_mpi/gather.c
index 99576271ee0da7516f2e998b75e3c02912514612..b049d224aad8e8c7bd391f7d62d519a26998b091 100644 (file)
@@ -35,10 +35,27 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
-/* this file is #included from collective.c; it's not really a header file,
-     but this defines a lot of functions that probably need to be inlined.*/
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
 
+#include "impl.h"
+#include "collective.h"
 
 
 int tMPI_Gather(void* sendbuf, int sendcount, tMPI_Datatype sendtype,
index e5f9e43b593085cabff467a3b102c90822867216..867719704f46c574986d14fd9993af2cbe4b5015 100644 (file)
@@ -746,22 +746,6 @@ tMPI_Group tMPI_Group_alloc(void);
 void tMPI_Cart_destroy(struct cart_topol *top);
 
 
-#ifdef USE_COLLECTIVE_COPY_BUFFER
-/* initialize a copy_buffer_list */
-void tMPI_Copy_buffer_list_init(struct copy_buffer_list *cbl, int Nbufs, 
-                                size_t size);
-/* initialize a copy_buffer_list */
-void tMPI_Copy_buffer_list_destroy(struct copy_buffer_list *cbl);
-/* get a copy buffer from a list */
-struct copy_buffer *tMPI_Copy_buffer_list_get(struct copy_buffer_list *cbl);
-/* return a copy buffer to a list */
-void tMPI_Copy_buffer_list_return(struct copy_buffer_list *cbl, 
-                                  struct copy_buffer *cb);
-/* initialize a copy buffer */
-void tMPI_Copy_buffer_init(struct copy_buffer *cb, size_t size);
-void tMPI_Copy_buffer_destroy(struct copy_buffer *cb);
-#endif
-
 
 
 
@@ -797,8 +781,9 @@ void tMPI_Req_list_destroy(struct req_list *rl);
 
 
 
+/* collective data structure ops */
+
 
-/* multicast functions */
 /* initialize a coll env structure */
 void tMPI_Coll_env_init(struct coll_env *mev, int N);
 /* destroy a coll env structure */
@@ -809,6 +794,22 @@ void tMPI_Coll_sync_init(struct coll_sync *msc, int N);
 /* destroy a coll sync structure */
 void tMPI_Coll_sync_destroy(struct coll_sync *msc);
 
+#ifdef USE_COLLECTIVE_COPY_BUFFER
+/* initialize a copy_buffer_list */
+void tMPI_Copy_buffer_list_init(struct copy_buffer_list *cbl, int Nbufs,
+                                size_t size);
+/* initialize a copy_buffer_list */
+void tMPI_Copy_buffer_list_destroy(struct copy_buffer_list *cbl);
+/* get a copy buffer from a list */
+struct copy_buffer *tMPI_Copy_buffer_list_get(struct copy_buffer_list *cbl);
+/* return a copy buffer to a list */
+void tMPI_Copy_buffer_list_return(struct copy_buffer_list *cbl,
+                                  struct copy_buffer *cb);
+/* initialize a copy buffer */
+void tMPI_Copy_buffer_init(struct copy_buffer *cb, size_t size);
+void tMPI_Copy_buffer_destroy(struct copy_buffer *cb);
+#endif
+
 
 
 
diff --git a/src/gmxlib/thread_mpi/p2p.c b/src/gmxlib/thread_mpi/p2p.c
deleted file mode 100644 (file)
index c283514..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-This source code file is part of thread_mpi.  
-Written by Sander Pronk, Erik Lindahl, and possibly others. 
-
-Copyright (c) 2009, Sander Pronk, Erik Lindahl.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1) Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-2) Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-3) Neither the name of the copyright holders nor the
-   names of its contributors may be used to endorse or promote products
-   derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-If you want to redistribute modifications, please consider that
-scientific software is very special. Version control is crucial -
-bugs must be traceable. We will be happy to consider code for
-inclusion in the official distribution, but derived work should not
-be called official thread_mpi. Details are found in the README & COPYING
-files.
-*/
-
-#ifdef HAVE_TMPI_CONFIG_H
-#include "tmpi_config.h"
-#endif
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string.h>
-
-
-#include "impl.h"
-
-
-
-/* free envelopes: */
-static struct envelope *tMPI_Free_env_list_fetch_recv(struct free_envelope_list 
-                                                      *evl);
-
-/* return an envelope to the free envelopes list */
-static void tMPI_Free_env_list_return_recv(struct free_envelope_list *evl,
-                                           struct envelope *rev);
-
-
-
-/* send envelopes: */
-/* get a new envelope from the send list's free envelope list */
-static struct envelope*
-tMPI_Send_env_list_fetch_new(struct send_envelope_list *evl);
-
-/* return a send envelope to the send list's free envelope list, 
-    (to be used by the sending thread, who owns the send_envelope_list) */
-static void tMPI_Send_env_list_return(struct envelope *ev);
-#ifdef USE_SEND_RECV_COPY_BUFFER
-/* return a send envelope to the sender's send list. 
-    (to be used by the receiving thread). */
-static void tMPI_Send_env_list_rts(struct envelope *sev);
-#endif
-
-/* remove a send envelope from the old list. Does not lock */
-static void tMPI_Send_env_list_remove_old(struct envelope *sev);
-
-
-
-/* remove a send envelope from its head_old list. Does not lock */
-static void tMPI_Send_env_list_remove_old(struct envelope *sev);
-
-/* add a send envelope to the new envelopes queue in a list */
-static void tMPI_Send_env_list_add_new(struct tmpi_thread *cur, 
-                                       struct send_envelope_list *evl,
-                                       struct envelope *sev);
-/* move a send envelope to the old envelopes queue in a list. 
-   Assumes that this is safe to do without interference
-   from other threads, i.e. the list it's in must have been
-   detached. */
-static void tMPI_Send_env_list_move_to_old(struct envelope *sev);
-
-
-/* receive envelopes: */
-/* add a receive envelope to a list */
-static void tMPI_Recv_env_list_add(struct recv_envelope_list *evl,
-                                   struct envelope *ev);
-/* remove a receive envelope from its list */
-static void tMPI_Recv_env_list_remove(struct envelope *ev);
-
-
-
-
-/* request list: */
-/* get a request from the thread's pre-allocated request list */
-static struct tmpi_req_ *tMPI_Get_req(struct req_list *rl);
-/* return a request to the thread's pre-allocated request list */
-static void tMPI_Return_req(struct req_list *rl, struct tmpi_req_ *req);
-
-/* initialize a request with sensible values */
-static void tMPI_Req_init(struct tmpi_req_ *rq, struct envelope *ev);
-
-/* wait for incoming connections (and the completion of outgoing connections
-   if spin locks are disabled), and handle them. */
-static void tMPI_Wait_process_incoming(struct tmpi_thread *th);
-
-/* do the actual point-to-point transfer */
-static void tMPI_Xfer(struct tmpi_thread *cur, struct envelope *sev, 
-                      struct envelope *rev);
-
-
-/* check for the completion of a single request */
-static tmpi_bool tMPI_Test_single(struct tmpi_thread *cur, 
-                                  struct tmpi_req_ *rq);
-/* check and wait for the completion of a single request */
-static void tMPI_Wait_single(struct tmpi_thread *cur, struct tmpi_req_ *rq);
-
-/* check for the completion of a NULL-delimited doubly linked list of 
-   requests */
-static tmpi_bool tMPI_Test_multi(struct tmpi_thread *cur, struct tmpi_req_ *rqs,
-                                 tmpi_bool *any_done);
-
-
-
-#include "p2p_protocol.h"
-#include "p2p_send_recv.h"
-#include "p2p_wait.h"
-
diff --git a/src/gmxlib/thread_mpi/p2p.h b/src/gmxlib/thread_mpi/p2p.h
new file mode 100644 (file)
index 0000000..d14585c
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+This source code file is part of thread_mpi.  
+Written by Sander Pronk, Erik Lindahl, and possibly others. 
+
+Copyright (c) 2009, Sander Pronk, Erik Lindahl.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+1) Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2) Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3) Neither the name of the copyright holders nor the
+   names of its contributors may be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+If you want to redistribute modifications, please consider that
+scientific software is very special. Version control is crucial -
+bugs must be traceable. We will be happy to consider code for
+inclusion in the official distribution, but derived work should not
+be called official thread_mpi. Details are found in the README & COPYING
+files.
+*/
+
+
+/* request list: */
+/* get a request from the thread's pre-allocated request list */
+struct tmpi_req_ *tMPI_Get_req(struct req_list *rl);
+/* return a request to the thread's pre-allocated request list */
+void tMPI_Return_req(struct req_list *rl, struct tmpi_req_ *req);
+
+/* initialize a request with sensible values */
+void tMPI_Req_init(struct tmpi_req_ *rq, struct envelope *ev);
+
+/* wait for incoming connections (and the completion of outgoing connections
+   if spin locks are disabled), and handle them. */
+void tMPI_Wait_process_incoming(struct tmpi_thread *th);
+
+
+
+
+
+/* check for the completion of a single request */
+tmpi_bool tMPI_Test_single(struct tmpi_thread *cur, 
+                           struct tmpi_req_ *rq);
+/* check and wait for the completion of a single request */
+void tMPI_Wait_single(struct tmpi_thread *cur, struct tmpi_req_ *rq);
+
+/* check for the completion of a NULL-delimited doubly linked list of 
+   requests */
+tmpi_bool tMPI_Test_multi(struct tmpi_thread *cur, struct tmpi_req_ *rqs,
+                          tmpi_bool *any_done);
+
+
+
+/* set a request status */
+void tMPI_Set_status(struct tmpi_req_ *req, tMPI_Status *st);
+
+
+/* post a send envelope */
+struct envelope *tMPI_Post_send(struct tmpi_thread *cur,
+                                tMPI_Comm comm,
+                                struct tmpi_thread *dest,
+                                void *send_buf, int send_count,
+                                tMPI_Datatype datatype, int tag,
+                                tmpi_bool nonblock);
+
+/* post and match a receive envelope */
+struct envelope* tMPI_Post_match_recv(struct tmpi_thread *cur,
+                                      tMPI_Comm comm,
+                                      struct tmpi_thread *src,
+                                      void *recv_buf, int recv_count,
+                                      tMPI_Datatype datatype,
+                                      int tag, tmpi_bool nonblock);
+
+
similarity index 84%
rename from src/gmxlib/thread_mpi/p2p_protocol.h
rename to src/gmxlib/thread_mpi/p2p_protocol.c
index 733ef9e7be04772a02d38d8489758fd1a08d81bd..33b5440ac996e2693f9aa1f14ba8bc22149b9125 100644 (file)
@@ -35,12 +35,93 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is included from p2p.c; it's not really a header file,
-   but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+
+#include "impl.h"
+#include "p2p.h"
+
+/* free envelopes: */
+/* free envelopes: */
+static struct envelope *tMPI_Free_env_list_fetch_recv(struct free_envelope_list
+                                                      *evl);
+
+/* return an envelope to the free envelopes list */
+static void tMPI_Free_env_list_return_recv(struct free_envelope_list *evl,
+                                           struct envelope *rev);
+
+
+
+/* send envelope lists: */
+/* send envelopes: */
+/* get a new envelope from the send list's free envelope list */
+static struct envelope* tMPI_Send_env_list_fetch_new(struct
+                                              send_envelope_list *evl);
+
+/* return a send envelope to the send list's free envelope list, 
+   (to be used by the sending thread, who owns the send_envelope_list) */
+static void tMPI_Send_env_list_return(struct envelope *ev);
+#ifdef USE_SEND_RECV_COPY_BUFFER
+/* return a send envelope to the sender's send list. 
+   (to be used by the receiving thread). */
+static void tMPI_Send_env_list_rts(struct envelope *sev);
+#endif
+
+
+
+
+/* send envelopes: */
+/* remove a send envelope from its head_old list. Does not lock */
+static void tMPI_Send_env_list_remove_old(struct envelope *sev); 
+
+/* add a send envelope to the new envelopes queue in a list */
+static void tMPI_Send_env_list_add_new(struct tmpi_thread *cur, 
+                                       struct send_envelope_list *evl,
+                                       struct envelope *sev);
+/* move a send envelope to the old envelopes queue in a list. 
+   Assumes that this is safe to do without interference
+   from other threads, i.e. the list it's in must have been
+   detached. */
+static void tMPI_Send_env_list_move_to_old(struct envelope *sev); 
+
+
 
-/* Point-to-point communication protocol functions */
 
+/* receive envelopes: */
+/* add a receive envelope to a list */
+static void tMPI_Recv_env_list_add(struct recv_envelope_list *evl,
+                                   struct envelope *ev);
+/* remove a receive envelope from its list */
+static void tMPI_Recv_env_list_remove(struct envelope *ev);
 
+
+
+
+/* do the actual point-to-point transfer */
+static void tMPI_Xfer(struct tmpi_thread *cur, struct envelope *sev,  
+                      struct envelope *rev);
+
+
+
+
+/* Point-to-point communication protocol functions */
 void tMPI_Free_env_list_init(struct free_envelope_list *evl, int N)
 {
     int i;
@@ -168,8 +249,8 @@ void tMPI_Send_env_list_destroy(struct send_envelope_list *evl)
 }
 
 
-static struct envelope* 
-tMPI_Send_env_list_fetch_new(struct send_envelope_list *evl)
+static struct envelope* tMPI_Send_env_list_fetch_new(struct 
+                                                     send_envelope_list *evl)
 {
     struct envelope *ret;
 
@@ -434,7 +515,7 @@ void tMPI_Req_list_destroy(struct req_list *rl)
 
 
 
-static struct tmpi_req_ *tMPI_Get_req(struct req_list *rl)
+struct tmpi_req_ *tMPI_Get_req(struct req_list *rl)
 {
     struct tmpi_req_ *req=rl->head;
     
@@ -452,7 +533,7 @@ static struct tmpi_req_ *tMPI_Get_req(struct req_list *rl)
     return req;
 }
 
-static void tMPI_Return_req(struct req_list *rl, struct tmpi_req_ *req)
+void tMPI_Return_req(struct req_list *rl, struct tmpi_req_ *req)
 {
     req->next=rl->head;
     req->prev=NULL;
@@ -461,7 +542,7 @@ static void tMPI_Return_req(struct req_list *rl, struct tmpi_req_ *req)
 
 
 
-static void tMPI_Req_init(struct tmpi_req_ *rq, struct envelope *ev)
+void tMPI_Req_init(struct tmpi_req_ *rq, struct envelope *ev)
 {
     rq->ev=ev;
     rq->finished=FALSE;
@@ -485,7 +566,7 @@ static void tMPI_Req_init(struct tmpi_req_ *rq, struct envelope *ev)
 
 
 
-static void tMPI_Set_req(struct envelope *ev, struct tmpi_req_ *req)
+void tMPI_Set_req(struct envelope *ev, struct tmpi_req_ *req)
 {
     req->source = ev->src;
     req->comm = ev->comm;
@@ -507,7 +588,7 @@ static void tMPI_Set_req(struct envelope *ev, struct tmpi_req_ *req)
     }
 }
 
-static void tMPI_Set_status(struct tmpi_req_ *req, tMPI_Status *st)
+void tMPI_Set_status(struct tmpi_req_ *req, tMPI_Status *st)
 {
     if (st)
     {
@@ -520,8 +601,8 @@ static void tMPI_Set_status(struct tmpi_req_ *req, tMPI_Status *st)
 }
 
 
-static tmpi_bool tMPI_Envelope_matches(const struct envelope *sev,
-                                       const struct envelope *rev)
+tmpi_bool tMPI_Envelope_matches(const struct envelope *sev,
+                                const struct envelope *rev)
 {
 #ifdef TMPI_DEBUG
     printf("%5d: tMPI_Envelope_matches (%d->%d)==(%d->%d),  tag=(%d==%d),       \n       datatype=(%ld==%ld), comm=(%ld,%ld),\n              finished=(%d==%d)\n",
@@ -557,9 +638,8 @@ static tmpi_bool tMPI_Envelope_matches(const struct envelope *sev,
 
 
 
-static struct envelope* 
-tMPI_Send_env_list_search_old(struct send_envelope_list *evl,
-                              struct envelope *rev)
+struct envelope* tMPI_Send_env_list_search_old(struct send_envelope_list *evl,
+                                               struct envelope *rev)
 {
     struct envelope *sev;
 
@@ -578,9 +658,8 @@ tMPI_Send_env_list_search_old(struct send_envelope_list *evl,
 }
 
 
-static struct envelope* 
-tMPI_Recv_env_list_search_new(struct recv_envelope_list *evl,
-                              struct envelope *sev)
+struct envelope* tMPI_Recv_env_list_search_new(struct recv_envelope_list *evl,
+                                               struct envelope *sev)
 {
     struct envelope *rev;
 
@@ -598,7 +677,7 @@ tMPI_Recv_env_list_search_new(struct recv_envelope_list *evl,
 
 
 #ifdef USE_SEND_RECV_COPY_BUFFER
-static void tMPI_Send_copy_buffer(struct envelope *sev, struct tmpi_req_ *req)
+void tMPI_Send_copy_buffer(struct envelope *sev, struct tmpi_req_ *req)
 {
     /* Fill copy buffer, after having anounced its possible use */
 
@@ -652,10 +731,13 @@ static void tMPI_Send_copy_buffer(struct envelope *sev, struct tmpi_req_ *req)
 #endif
 
 
-static struct envelope* tMPI_Prep_send_envelope(struct send_envelope_list *evl, 
-                        tMPI_Comm comm, struct tmpi_thread *src, 
-                        struct tmpi_thread *dest, void *buf, int count, 
-                        tMPI_Datatype datatype, int tag, tmpi_bool nonblock)
+struct envelope* tMPI_Prep_send_envelope(struct send_envelope_list *evl, 
+                                         tMPI_Comm comm, 
+                                         struct tmpi_thread *src, 
+                                         struct tmpi_thread *dest, 
+                                         void *buf, int count, 
+                                         tMPI_Datatype datatype, 
+                                         int tag, tmpi_bool nonblock)
 {
     /* get an envelope from the send-envelope stack */
     struct envelope *ev=tMPI_Send_env_list_fetch_new( evl );
@@ -694,10 +776,13 @@ static struct envelope* tMPI_Prep_send_envelope(struct send_envelope_list *evl,
     return ev;
 }
 
-static struct envelope* tMPI_Prep_recv_envelope(struct tmpi_thread *cur, 
-                        tMPI_Comm comm, struct tmpi_thread *src, 
-                        struct tmpi_thread *dest, void *buf, int count, 
-                        tMPI_Datatype datatype, int tag, tmpi_bool nonblock)
+struct envelope* tMPI_Prep_recv_envelope(struct tmpi_thread *cur, 
+                                         tMPI_Comm comm, 
+                                         struct tmpi_thread *src, 
+                                         struct tmpi_thread *dest, 
+                                         void *buf, int count, 
+                                         tMPI_Datatype datatype, int tag, 
+                                         tmpi_bool nonblock)
 {
     /* get an envelope from the stack */
     struct envelope *ev=tMPI_Free_env_list_fetch_recv( &(cur->envelopes) );
@@ -842,12 +927,12 @@ static void tMPI_Xfer(struct tmpi_thread *cur, struct envelope *sev,
 
 
 
-static struct envelope* tMPI_Post_match_recv(struct tmpi_thread *cur,
-                                             tMPI_Comm comm, 
-                                             struct tmpi_thread *src, 
-                                             void *recv_buf, int recv_count, 
-                                             tMPI_Datatype datatype, 
-                                             int tag, tmpi_bool nonblock)
+struct envelope* tMPI_Post_match_recv(struct tmpi_thread *cur,
+                                      tMPI_Comm comm, 
+                                      struct tmpi_thread *src, 
+                                      void *recv_buf, int recv_count, 
+                                      tMPI_Datatype datatype, 
+                                      int tag, tmpi_bool nonblock)
 {
     struct tmpi_thread *dest=cur;
     struct envelope *rev;
@@ -911,12 +996,12 @@ static struct envelope* tMPI_Post_match_recv(struct tmpi_thread *cur,
 
 
 
-static struct envelope *tMPI_Post_send(struct tmpi_thread *cur,
-                                       tMPI_Comm comm, 
-                                       struct tmpi_thread *dest, 
-                                       void *send_buf, int send_count,
-                                       tMPI_Datatype datatype, int tag, 
-                                       tmpi_bool nonblock)
+struct envelope *tMPI_Post_send(struct tmpi_thread *cur,
+                                tMPI_Comm comm, 
+                                struct tmpi_thread *dest, 
+                                void *send_buf, int send_count,
+                                tMPI_Datatype datatype, int tag, 
+                                tmpi_bool nonblock)
 {
     struct tmpi_thread *src=cur;
     struct envelope *sev;
@@ -943,7 +1028,7 @@ static struct envelope *tMPI_Post_send(struct tmpi_thread *cur,
 
 
 
-static void tMPI_Wait_process_incoming(struct tmpi_thread *cur)
+void tMPI_Wait_process_incoming(struct tmpi_thread *cur)
 {
     int i;
     int check_id;
@@ -1031,7 +1116,7 @@ static void tMPI_Wait_process_incoming(struct tmpi_thread *cur)
     tMPI_Event_process( &(cur->p2p_event), n_handled);
 }
 
-static tmpi_bool tMPI_Test_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
+tmpi_bool tMPI_Test_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
 {
     struct envelope *ev=rq->ev;
 
@@ -1071,7 +1156,7 @@ static tmpi_bool tMPI_Test_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
     return rq->finished;
 }
 
-static void tMPI_Wait_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
+void tMPI_Wait_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
 {
     do
     {
@@ -1081,7 +1166,7 @@ static void tMPI_Wait_single(struct tmpi_thread *cur, struct tmpi_req_ *rq)
     } while(TRUE);
 }
 
-static tmpi_bool tMPI_Test_multi(struct tmpi_thread *cur, struct tmpi_req_ *rqs,
+tmpi_bool tMPI_Test_multi(struct tmpi_thread *cur, struct tmpi_req_ *rqs,
                                  tmpi_bool *any_done)
 {
     tmpi_bool all_done=TRUE;
similarity index 96%
rename from src/gmxlib/thread_mpi/p2p_send_recv.h
rename to src/gmxlib/thread_mpi/p2p_send_recv.c
index 4261498005051a217ae8d2638b01d95bb1af7112..4b0c340aabf45b1b8777559201e0cbfd96a1c9b5 100644 (file)
@@ -35,8 +35,28 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is included from p2p.c; it's not really a header file,
-   but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+
+#include "impl.h"
+#include "p2p.h"
 
 
 /* point-to-point communication exported functions */
similarity index 97%
rename from src/gmxlib/thread_mpi/p2p_wait.h
rename to src/gmxlib/thread_mpi/p2p_wait.c
index 743030833e5acc580711c652ba5be1f7d2a4346d..1e97b0e935966dfb447a0d04190785c99ef6936f 100644 (file)
@@ -35,9 +35,28 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is #included from p2p.c;it's not really a header file,
-   but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
 
+#include "impl.h"
+#include "p2p.h"
 
 
 int tMPI_Wait(tMPI_Request *request, tMPI_Status *status)
similarity index 97%
rename from src/gmxlib/thread_mpi/reduce.h
rename to src/gmxlib/thread_mpi/reduce.c
index 36a12236e0ead69bdca14ef649827b4120a7eb26..4892ce4e1aa7ef4cfbc4d2da2bad0d01543520b0 100644 (file)
@@ -35,8 +35,28 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is #included from collective.c; it's not really a header file,
-   but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "impl.h"
+#include "collective.h"
+
 
 
 /* run a single binary reduce operation on src_a and src_b, producing dest. 
similarity index 97%
rename from src/gmxlib/thread_mpi/scatter.h
rename to src/gmxlib/thread_mpi/scatter.c
index 394b2f5a203ae8ee069a12208b1c1dabffb1cad2..b0dacf1d42d213ea6060a87c667a6e248c91c0b7 100644 (file)
@@ -35,8 +35,28 @@ be called official thread_mpi. Details are found in the README & COPYING
 files.
 */
 
-/* this file is #included from collective.c; it's not really a header file,
-   but this defines a lot of functions that probably need to be inlined.*/
+#ifdef HAVE_TMPI_CONFIG_H
+#include "tmpi_config.h"
+#endif
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include <errno.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#include "impl.h"
+#include "collective.h"
+
 
 
 int tMPI_Scatter(void* sendbuf, int sendcount, tMPI_Datatype sendtype,