forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 1
/
xchange_deri.c
154 lines (140 loc) · 4.49 KB
/
xchange_deri.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* $Id$ */
/**********************************************************
*
* exchange routines for gauge fields
*
* Author: Carsten Urbach
*
**********************************************************/
#ifdef HAVE_CONFIG_H
# include<config.h>
#endif
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#ifdef MPI
# include <mpi.h>
#endif
#include "global.h"
#include "mpi_init.h"
#include "su3.h"
#include "su3adj.h"
#include "xchange_deri.h"
void xchange_deri()
{
#ifdef MPI
int ix,mu, t, y, z, x;
MPI_Status status;
/* send the data to the neighbour on the left in time direction */
/* recieve the data from the neighbour on the right in time direction */
MPI_Sendrecv(&df0[(T+1)*LX*LY*LZ][0].d1, 1, deri_time_slice_cont, g_nb_t_dn, 43,
&ddummy[(T-1)*LX*LY*LZ][0].d1, 1, deri_time_slice_cont, g_nb_t_up, 43,
g_cart_grid, &status);
/* add ddummy to df0 */
for(x = 0; x < LX; x++) {
for(y = 0; y < LY; y++) {
for(z = 0; z < LZ; z++) {
ix = g_ipt[T-1][x][y][z];
for(mu=0;mu<4;mu++){
df0[ix][mu].d1 += ddummy[ix][mu].d1;
df0[ix][mu].d2 += ddummy[ix][mu].d2;
df0[ix][mu].d3 += ddummy[ix][mu].d3;
df0[ix][mu].d4 += ddummy[ix][mu].d4;
df0[ix][mu].d5 += ddummy[ix][mu].d5;
df0[ix][mu].d6 += ddummy[ix][mu].d6;
df0[ix][mu].d7 += ddummy[ix][mu].d7;
df0[ix][mu].d8 += ddummy[ix][mu].d8;
}
}
}
}
/* send the data to the neighbour on the right is not needed*/
# if (defined PARALLELXT || defined PARALLELXYT || defined PARALLELXYZT)
/* send the data to the neighbour on the left in x direction */
/* recieve the data from the neighbour on the right in x direction */
MPI_Sendrecv(&df0[(T+2)*LX*LY*LZ + T*LY*LZ][0], 1, deri_x_slice_cont, g_nb_x_dn, 44,
&ddummy[(LX-1)*LY*LZ][0], 1, deri_x_slice_gath, g_nb_x_up, 44,
g_cart_grid, &status);
/* add ddummy to df0 */
for(t = 0; t < T; t++) {
for(y = 0; y < LY; y++) {
for(z = 0; z < LZ; z++) {
ix = g_ipt[t][LX-1][y][z];
for(mu=0;mu<4;mu++){
df0[ix][mu].d1 += ddummy[ix][mu].d1;
df0[ix][mu].d2 += ddummy[ix][mu].d2;
df0[ix][mu].d3 += ddummy[ix][mu].d3;
df0[ix][mu].d4 += ddummy[ix][mu].d4;
df0[ix][mu].d5 += ddummy[ix][mu].d5;
df0[ix][mu].d6 += ddummy[ix][mu].d6;
df0[ix][mu].d7 += ddummy[ix][mu].d7;
df0[ix][mu].d8 += ddummy[ix][mu].d8;
}
}
}
}
/* send the data to the neighbour on the right is not needed*/
/* end of ifdef PARALLELXT || PARALLELXYT */
# endif
# if (defined PARALLELXYT || defined PARALLELXYZT)
/* send the data to the neighbour on the left in y direction */
/* recieve the data from the neighbour on the right in y direction */
MPI_Sendrecv((void*)df0[VOLUME + 2*LZ*(LX*LY + T*LY) + T*LX*LZ],
1, deri_y_slice_cont, g_nb_y_dn, 45,
(void*)ddummy[(LY-1)*LZ],
1, deri_y_slice_gath, g_nb_y_up, 45,
g_cart_grid, &status);
/* add ddummy to df0 */
for(t = 0; t < T; t++) {
for(x = 0; x < LX; x++) {
for(z = 0; z < LZ; z++) {
ix = g_ipt[t][x][LY-1][z];
for(mu=0;mu<4;mu++){
df0[ix][mu].d1 += ddummy[ix][mu].d1;
df0[ix][mu].d2 += ddummy[ix][mu].d2;
df0[ix][mu].d3 += ddummy[ix][mu].d3;
df0[ix][mu].d4 += ddummy[ix][mu].d4;
df0[ix][mu].d5 += ddummy[ix][mu].d5;
df0[ix][mu].d6 += ddummy[ix][mu].d6;
df0[ix][mu].d7 += ddummy[ix][mu].d7;
df0[ix][mu].d8 += ddummy[ix][mu].d8;
}
}
}
}
/* send the data to the neighbour on the right is not needed*/
/* end of ifdef PARALLELXYT */
# endif
# ifdef PARALLELXYZT
/* send the data to the neighbour on the left in y direction */
/* recieve the data from the neighbour on the right in y direction */
MPI_Sendrecv((void*)df0[VOLUME + 2*LX*LY*LZ + 2*T*LY*LZ + 2*T*LX*LZ + T*LX*LY],
1, deri_z_slice_cont, g_nb_z_dn, 46,
(void*)ddummy[LZ-1],
1, deri_z_slice_gath, g_nb_z_up, 46,
g_cart_grid, &status);
/* add ddummy to df0 */
for(t = 0; t < T; t++) {
for(x = 0; x < LX; x++) {
for(y = 0; y < LY; y++) {
ix = g_ipt[t][x][y][LZ-1];
for(mu=0;mu<4;mu++){
df0[ix][mu].d1 += ddummy[ix][mu].d1;
df0[ix][mu].d2 += ddummy[ix][mu].d2;
df0[ix][mu].d3 += ddummy[ix][mu].d3;
df0[ix][mu].d4 += ddummy[ix][mu].d4;
df0[ix][mu].d5 += ddummy[ix][mu].d5;
df0[ix][mu].d6 += ddummy[ix][mu].d6;
df0[ix][mu].d7 += ddummy[ix][mu].d7;
df0[ix][mu].d8 += ddummy[ix][mu].d8;
}
}
}
}
/* send the data to the neighbour on the right is not needed*/
/* end of ifdef PARALLELXYT */
# endif
return;
#endif
}
static char const rcsid[] = "$Id$";