50
50
#ifdef QUDA
51
51
# include "quda_interface.h"
52
52
#endif
53
-
53
+ #ifdef TM_USE_QPHIX
54
+ #include "qphix_interface.h"
55
+ #endif
54
56
55
57
#ifdef HAVE_GPU
56
58
# include "GPU/cudadefs.h"
@@ -63,20 +65,19 @@ extern su3* g_trafo;
63
65
# endif
64
66
#endif
65
67
66
-
67
68
int invert_doublet_eo (spinor * const Even_new_s , spinor * const Odd_new_s ,
68
69
spinor * const Even_new_c , spinor * const Odd_new_c ,
69
70
spinor * const Even_s , spinor * const Odd_s ,
70
71
spinor * const Even_c , spinor * const Odd_c ,
71
72
const double precision , const int max_iter ,
72
73
const int solver_flag , const int rel_prec ,
73
- solver_params_t solver_params , const ExternalInverter inverter ,
74
+ solver_params_t solver_params , const ExternalInverter external_inverter ,
74
75
const SloppyPrecision sloppy , const CompressionType compression ) {
75
76
76
77
int iter = 0 ;
77
78
78
79
#ifdef QUDA
79
- if ( inverter == QUDA_INVERTER ) {
80
+ if ( external_inverter == QUDA_INVERTER ) {
80
81
return invert_doublet_eo_quda ( Even_new_s , Odd_new_s , Even_new_c , Odd_new_c ,
81
82
Even_s , Odd_s , Even_c , Odd_c ,
82
83
precision , max_iter ,
@@ -118,43 +119,51 @@ int invert_doublet_eo(spinor * const Even_new_s, spinor * const Odd_new_s,
118
119
printf ("# Using CG for TMWILSON flavour doublet!\n" );
119
120
fflush (stdout );
120
121
}
121
- gamma5 ( g_spinor_field [ DUM_DERI ], g_spinor_field [ DUM_DERI ], VOLUME / 2 );
122
- gamma5 (g_spinor_field [DUM_DERI + 1 ], g_spinor_field [DUM_DERI + 1 ], VOLUME /2 );
123
-
122
+ if ( external_inverter == NO_EXT_INV ){
123
+ gamma5 (g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI ], VOLUME /2 );
124
+ gamma5 ( g_spinor_field [ DUM_DERI + 1 ], g_spinor_field [ DUM_DERI + 1 ], VOLUME / 2 );
124
125
125
126
#ifdef HAVE_GPU
126
- if (usegpu_flag ) { // GPU, mixed precision solver
127
- # if ( defined TM_USE_MPI && defined PARALLELT )
128
- iter = mixedsolve_eo_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
129
- max_iter , precision , rel_prec );
130
- # elif ( !defined TM_USE_MPI && !defined PARALLELT )
131
- iter = mixedsolve_eo_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
132
- max_iter , precision , rel_prec );
133
- # else
134
- printf ("MPI and/or PARALLELT are not appropriately set for the GPU implementation. Aborting...\n" );
135
- exit (-1 );
136
- # endif
137
- }
138
- else { // CPU, conjugate gradient
139
- iter = cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
140
- max_iter , precision , rel_prec ,
141
- VOLUME /2 , & Qtm_pm_ndpsi );
142
- }
127
+ if (usegpu_flag ) { // GPU, mixed precision solver
128
+ # if ( defined TM_USE_MPI && defined PARALLELT )
129
+ iter = mixedsolve_eo_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
130
+ max_iter , precision , rel_prec );
131
+ # elif ( !defined TM_USE_MPI && !defined PARALLELT )
132
+ iter = mixedsolve_eo_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
133
+ max_iter , precision , rel_prec );
134
+ # else
135
+ printf ("MPI and/or PARALLELT are not appropriately set for the GPU implementation. Aborting...\n" );
136
+ exit (-1 );
137
+ # endif
138
+ }
139
+ else { // CPU, conjugate gradient
140
+ iter = cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
141
+ max_iter , precision , rel_prec ,
142
+ VOLUME /2 , & Qtm_pm_ndpsi );
143
+ }
143
144
#else // CPU, conjugate gradient
144
- if (solver_flag == RGMIXEDCG ){
145
- iter = rg_mixed_cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
146
- solver_params , max_iter , precision , rel_prec , VOLUME /2 ,
147
- & Qtm_pm_ndpsi , & Qtm_pm_ndpsi_32 );
148
- }
149
- else {
150
- iter = cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
151
- max_iter , precision , rel_prec , VOLUME /2 , & Qtm_pm_ndpsi );
152
- }
145
+ if (solver_flag == RGMIXEDCG ){
146
+ iter = rg_mixed_cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
147
+ solver_params , max_iter , precision , rel_prec , VOLUME /2 ,
148
+ & Qtm_pm_ndpsi , & Qtm_pm_ndpsi_32 );
149
+ }
150
+ else {
151
+ iter = cg_her_nd (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
152
+ max_iter , precision , rel_prec , VOLUME /2 , & Qtm_pm_ndpsi );
153
+ }
153
154
#endif
154
-
155
-
156
- Qtm_dagger_ndpsi (Odd_new_s , Odd_new_c ,
157
- Odd_new_s , Odd_new_c );
155
+ Qtm_dagger_ndpsi (Odd_new_s , Odd_new_c ,
156
+ Odd_new_s , Odd_new_c );
157
+ } // if(NO_EXT_INV)
158
+ #ifdef TM_USE_QPHIX
159
+ else if (external_inverter == QPHIX_INVERTER ) {
160
+ // using QPhiX, we invert M M^dagger y = b, so we don't need gamma_5 multiplications
161
+ iter = invert_eo_qphix_twoflavour (Odd_new_s , Odd_new_c , g_spinor_field [DUM_DERI ], g_spinor_field [DUM_DERI + 1 ],
162
+ max_iter , precision , solver_flag , rel_prec ,
163
+ solver_params , sloppy , compression );
164
+ // and it multiplies y internally by M^dagger, returning M^{-1} b as required
165
+ }
166
+ #endif // TM_USE_QPHIX
158
167
159
168
/* Reconstruct the even sites */
160
169
Hopping_Matrix (EO , g_spinor_field [DUM_DERI ], Odd_new_s );
@@ -188,12 +197,12 @@ int invert_cloverdoublet_eo(spinor * const Even_new_s, spinor * const Odd_new_s,
188
197
spinor * const Even_c , spinor * const Odd_c ,
189
198
const double precision , const int max_iter ,
190
199
const int solver_flag , const int rel_prec , solver_params_t solver_params ,
191
- const ExternalInverter inverter , const SloppyPrecision sloppy , const CompressionType compression ) {
200
+ const ExternalInverter external_inverter , const SloppyPrecision sloppy , const CompressionType compression ) {
192
201
193
202
int iter = 0 ;
194
203
195
204
#ifdef QUDA
196
- if ( inverter == QUDA_INVERTER ) {
205
+ if ( external_inverter == QUDA_INVERTER ) {
197
206
return invert_doublet_eo_quda ( Even_new_s , Odd_new_s , Even_new_c , Odd_new_c ,
198
207
Even_s , Odd_s , Even_c , Odd_c ,
199
208
precision , max_iter ,
0 commit comments