@@ -70,12 +70,12 @@ extern "C" {
70
70
#include < cfloat>
71
71
#include < cstdlib>
72
72
#include < cstring>
73
- #include " qphix/blas_new_c.h"
74
- #include " qphix/invcg.h"
75
- #include " qphix/invbicgstab.h"
76
- #include " qphix/print_utils.h"
77
- #include " qphix/qphix_config.h"
78
- #include " qphix/wilson.h"
73
+ #include < qphix/blas_new_c.h>
74
+ #include < qphix/invcg.h>
75
+ #include < qphix/invbicgstab.h>
76
+ #include < qphix/print_utils.h>
77
+ #include < qphix/qphix_config.h>
78
+ #include < qphix/wilson.h>
79
79
using namespace std ;
80
80
using namespace QPhiX ;
81
81
@@ -118,6 +118,15 @@ using namespace QPhiX;
118
118
#include < qmp.h>
119
119
#endif
120
120
121
+ int qphix_input_By;
122
+ int qphix_input_Bz;
123
+ int qphix_input_NCores;
124
+ int qphix_input_Sy;
125
+ int qphix_input_Sz;
126
+ int qphix_input_PadXY;
127
+ int qphix_input_PadXYZ;
128
+ int qphix_input_MinCt;
129
+
121
130
int By;
122
131
int Bz;
123
132
int NCores;
@@ -128,7 +137,7 @@ int PadXYZ;
128
137
int MinCt;
129
138
int N_simt;
130
139
bool compress12;
131
- QphixPrec precision ;
140
+ QphixPrec qphix_precision ;
132
141
133
142
int subLattSize[4 ];
134
143
int lattSize[4 ];
@@ -174,9 +183,10 @@ void _initQphix(int argc, char **argv, int By_, int Bz_, int NCores_, int Sy_, i
174
183
MinCt = MinCt_;
175
184
N_simt = Sy_ * Sz_;
176
185
compress12 = c12;
177
- precision = precision_;
186
+ qphix_precision = precision_;
178
187
179
- omp_set_num_threads (NCores * Sy * Sz);
188
+ // this is called within tmLQCD already, it should not be called here
189
+ // omp_set_num_threads(NCores * Sy * Sz);
180
190
181
191
#ifdef QPHIX_QMP_COMMS
182
192
// Declare the logical topology
@@ -564,11 +574,7 @@ int invert_eo_qphix_helper(spinor * const tmlqcd_even_out,
564
574
* *
565
575
************************/
566
576
567
- // FIXME: This should be called properly somewhere else
568
- _initQphix (0 , nullptr , /* By = */ 2 , /* Bz = */ 2 , /* Ncores = */ 1 ,
569
- /* Sy = */ 1 , /* Sz = */ 1 ,
570
- /* PadXY = */ 1 , /* PadXYZ = */ 1 , /* MinCt = */ 1 ,
571
- /* compress12 = */ 1 , QPHIX_DOUBLE_PREC);
577
+ // _initQphix should have been called at this point
572
578
573
579
masterPrintf (" # VECLEN = %d, SOALEN = %d\n " , V, S);
574
580
masterPrintf (" # Declared QMP Topology: %d %d %d %d\n " ,
@@ -860,7 +866,7 @@ int invert_eo_qphix_helper(spinor * const tmlqcd_even_out,
860
866
861
867
// Template wrapper for the Dslash operator call-able from C code
862
868
void D_psi_qphix (spinor* tmlqcd_out, const spinor* tmlqcd_in) {
863
- if (precision == QPHIX_DOUBLE_PREC) {
869
+ if (qphix_precision == QPHIX_DOUBLE_PREC) {
864
870
if (QPHIX_SOALEN > VECLEN_DP) {
865
871
masterPrintf (" SOALEN=%d is greater than the double prec VECLEN=%d\n " , QPHIX_SOALEN,
866
872
VECLEN_DP);
@@ -872,7 +878,7 @@ void D_psi_qphix(spinor* tmlqcd_out, const spinor* tmlqcd_in) {
872
878
} else {
873
879
D_psi<double , VECLEN_DP, QPHIX_SOALEN, false >(tmlqcd_out, tmlqcd_in);
874
880
}
875
- } else if (precision == QPHIX_FLOAT_PREC) {
881
+ } else if (qphix_precision == QPHIX_FLOAT_PREC) {
876
882
if (QPHIX_SOALEN > VECLEN_SP) {
877
883
masterPrintf (" SOALEN=%d is greater than the single prec VECLEN=%d\n " , QPHIX_SOALEN,
878
884
VECLEN_SP);
@@ -886,7 +892,7 @@ void D_psi_qphix(spinor* tmlqcd_out, const spinor* tmlqcd_in) {
886
892
}
887
893
}
888
894
#if defined(QPHIX_MIC_SOURCE)
889
- else if (precision == QPHIX_HALF_PREC) {
895
+ else if (qphix_precision == QPHIX_HALF_PREC) {
890
896
if (QPHIX_SOALEN > VECLEN_HP) {
891
897
masterPrintf (" SOALEN=%d is greater than the single prec VECLEN=%d\n " , QPHIX_SOALEN,
892
898
VECLEN_SP);
@@ -924,6 +930,11 @@ int invert_eo_qphix(spinor * const Even_new,
924
930
}
925
931
masterPrintf (" # INITIALIZING QPHIX SOLVER\n " );
926
932
masterPrintf (" # USING DOUBLE PRECISION\n " );
933
+ _initQphix (0 , nullptr , qphix_input_By, qphix_input_Bz, qphix_input_NCores,
934
+ qphix_input_Sy, qphix_input_Sz,
935
+ qphix_input_PadXY, qphix_input_PadXYZ, qphix_input_MinCt,
936
+ compression, QPHIX_DOUBLE_PREC);
937
+
927
938
if (compress12) {
928
939
return invert_eo_qphix_helper<double , VECLEN_DP, QPHIX_SOALEN, true >
929
940
(Even_new,
@@ -949,16 +960,25 @@ int invert_eo_qphix(spinor * const Even_new,
949
960
solver_params,
950
961
compression);
951
962
}
963
+ #ifdef QPHIX_MIC_SOURCE
952
964
} else if (precision < rsdTarget<float >::value) {
965
+ #else
966
+ } else {
967
+ #endif
953
968
if (QPHIX_SOALEN > VECLEN_SP) {
954
969
masterPrintf (" SOALEN=%d is greater than the single prec VECLEN=%d\n " , QPHIX_SOALEN,
955
970
VECLEN_SP);
956
971
abort ();
957
972
}
958
973
masterPrintf (" # INITIALIZING QPHIX SOLVER\n " );
959
974
masterPrintf (" # USING SINGLE PRECISION\n " );
975
+ _initQphix (0 , nullptr , qphix_input_By, qphix_input_Bz, qphix_input_NCores,
976
+ qphix_input_Sy, qphix_input_Sz,
977
+ qphix_input_PadXY, qphix_input_PadXYZ, qphix_input_MinCt,
978
+ compression, QPHIX_FLOAT_PREC);
979
+
960
980
if (compress12) {
961
- return invert_eo_qphix_helper<float , VECLEN_DP , QPHIX_SOALEN, true >
981
+ return invert_eo_qphix_helper<float , VECLEN_SP , QPHIX_SOALEN, true >
962
982
(Even_new,
963
983
Odd_new,
964
984
Even,
@@ -970,7 +990,7 @@ int invert_eo_qphix(spinor * const Even_new,
970
990
solver_params,
971
991
compression);
972
992
} else {
973
- return invert_eo_qphix_helper<float , VECLEN_DP , QPHIX_SOALEN, false >
993
+ return invert_eo_qphix_helper<float , VECLEN_SP , QPHIX_SOALEN, false >
974
994
(Even_new,
975
995
Odd_new,
976
996
Even,
@@ -992,8 +1012,13 @@ int invert_eo_qphix(spinor * const Even_new,
992
1012
}
993
1013
masterPrintf (" # INITIALIZING QPHIX SOLVER\n " );
994
1014
masterPrintf (" # USING HALF PRECISION\n " );
1015
+ _initQphix (0 , nullptr , qphix_input_By, qphix_input_Bz, qphix_input_NCores,
1016
+ qphix_input_Sy, qphix_input_Sz,
1017
+ qphix_input_PadXY, qphix_input_PadXYZ, qphix_input_MinCt,
1018
+ compression, QPHIX_HALF_PREC);
1019
+
995
1020
if (compress12) {
996
- return invert_eo_qphix_helper<half, VECLEN_DP , QPHIX_SOALEN, true >
1021
+ return invert_eo_qphix_helper<half, VECLEN_SP , QPHIX_SOALEN, true >
997
1022
(Even_new,
998
1023
Odd_new,
999
1024
Even,
@@ -1005,7 +1030,7 @@ int invert_eo_qphix(spinor * const Even_new,
1005
1030
solver_params,
1006
1031
compression);
1007
1032
} else {
1008
- return invert_eo_qphix_helper<half, VECLEN_DP , QPHIX_SOALEN, false >
1033
+ return invert_eo_qphix_helper<half, VECLEN_SP , QPHIX_SOALEN, false >
1009
1034
(Even_new,
1010
1035
Odd_new,
1011
1036
Even,
0 commit comments