renamed GMX_THREADS to GMX_THREAD_MPI
[alexxy/gromacs.git] / include / domdec_network.h
1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
2  *
3  * 
4  * This file is part of Gromacs        Copyright (c) 1991-2008
5  * David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * To help us fund GROMACS development, we humbly ask that you cite
13  * the research papers on the package. Check out http://www.gromacs.org
14  * 
15  * And Hey:
16  * Gnomes, ROck Monsters And Chili Sauce
17  */
18
19 #ifndef _domdec_network_h
20 #define _domdec_network_h
21
22 #include "typedefs.h"
23
24 #ifdef GMX_LIB_MPI
25 #include <mpi.h>
26 #endif
27 #ifdef GMX_THREAD_MPI
28 #include "tmpi.h"
29 #endif
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 enum {
36     dddirForward,dddirBackward
37 };
38
39 /* Move integers in the comm. region one cell along the domain decomposition
40  * in the dimension indexed by ddimind
41  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
42  */
43 void
44 dd_sendrecv_int(const gmx_domdec_t *dd,
45                 int ddimind,int direction,
46                 int *buf_s,int n_s,
47                 int *buf_r,int n_r);
48
49 /* Move reals in the comm. region one cell along the domain decomposition
50  * in the dimension indexed by ddimind
51  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
52  */
53 void
54 dd_sendrecv_real(const gmx_domdec_t *dd,
55                  int ddimind,int direction,
56                  real *buf_s,int n_s,
57                  real *buf_r,int n_r);
58
59 /* Move revc's in the comm. region one cell along the domain decomposition
60  * in dimension indexed by ddimind
61  * forward (direction=dddirFoward) or backward (direction=dddirBackward).
62  */
63 void
64 dd_sendrecv_rvec(const gmx_domdec_t *dd,
65                  int ddimind,int direction,
66                  rvec *buf_s,int n_s,
67                  rvec *buf_r,int n_r);
68
69
70 /* Move revc's in the comm. region one cell along the domain decomposition
71  * in dimension indexed by ddimind
72  * simultaneously in the forward and backward directions.
73  */
74 void
75 dd_sendrecv2_rvec(const gmx_domdec_t *dd,
76                   int ddimind,
77                   rvec *buf_s_fw,int n_s_fw,
78                   rvec *buf_r_fw,int n_r_fw,
79                   rvec *buf_s_bw,int n_s_bw,
80                   rvec *buf_r_bw,int n_r_bw);
81
82
83 /* The functions below perform the same operations as the MPI functions
84  * with the same name appendices, but over the domain decomposition
85  * nodes only.
86  * The DD master node is the master for these operations.
87  */
88
89 void
90 dd_bcast(gmx_domdec_t *dd,int nbytes,void *data);
91
92 /* Copies src to dest on the master node and then broadcasts */
93 void
94 dd_bcastc(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
95
96 void
97 dd_scatter(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
98
99 void
100 dd_gather(gmx_domdec_t *dd,int nbytes,void *src,void *dest);
101
102 /* If rcount==0, rbuf is allowed to be NULL */
103 void
104 dd_scatterv(gmx_domdec_t *dd,
105             int *scounts,int *disps,void *sbuf,
106             int rcount,void *rbuf);
107
108 /* If scount==0, sbuf is allowed to be NULL */
109 void
110 dd_gatherv(gmx_domdec_t *dd,
111            int scount,void *sbuf,
112            int *rcounts,int *disps,void *rbuf);
113
114 #ifdef __cplusplus
115 }
116 #endif
117
118 #endif  /* _domdec_network_h */