24 #define TDIFF(a,b) (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec))
28 static double unitarize_eps = 1e-6;
29 static bool reunit_allow_svd =
true;
30 static bool reunit_svd_only =
false;
31 static double svd_rel_error = 1e-4;
32 static double svd_abs_error = 1e-4;
33 static double max_allowed_error = 1e-11;
42 TEST(unitarization, verify) {
54 ASSERT_EQ(res,1) <<
"CPU and CUDA implementations do not agree";
57 static int unitarize_link_test(
int &test_rc)
63 qudaGaugeParam.
X[0] =
xdim;
64 qudaGaugeParam.
X[1] =
ydim;
65 qudaGaugeParam.
X[2] =
zdim;
66 qudaGaugeParam.
X[3] =
tdim;
81 errorQuda(
"Unsupported gauge order %d", gauge_order);
107 double* link =
reinterpret_cast<double*
>(inlink);
108 for(
int dir=0; dir<4; ++dir){
109 double* slink =
reinterpret_cast<double*
>(sitelink[dir]);
110 for(
int i=0; i<
V; ++i){
117 float* link =
reinterpret_cast<float*
>(inlink);
118 for(
int dir=0; dir<4; ++dir){
119 float* slink =
reinterpret_cast<float*
>(sitelink[dir]);
120 for(
int i=0; i<
V; ++i){
146 double act_path_coeff[6];
147 act_path_coeff[0] = 0.625000;
148 act_path_coeff[1] = -0.058479;
149 act_path_coeff[2] = -0.087719;
150 act_path_coeff[3] = 0.030778;
151 act_path_coeff[4] = -0.007200;
152 act_path_coeff[5] = -0.123113;
166 int *num_failures_h =
static_cast<int *
>(
mapped_malloc(
sizeof(
int)));
170 struct timeval t0, t1;
172 gettimeofday(&t0,NULL);
174 gettimeofday(&t1,NULL);
186 for (
int dir = 0; dir < 4; ++dir)
host_free(sitelink[dir]);
190 int num_failures = *num_failures_h;
206 printfQuda(
"link_precision link_reconstruct space_dimension T_dimension algorithm max allowed error deviation tolerance\n");
222 int main(
int argc,
char **argv)
234 app->parse(argc, argv);
235 }
catch (
const CLI::ParseError &e) {
247 int num_failures = unitarize_link_test(test_rc);
254 printfQuda(
"Number of failures = %d\n", num_failures);
255 if(num_failures > 0){
256 printfQuda(
"Failure rate = %lf\n", num_failures/(4.0*
V*num_procs));
257 printfQuda(
"You may want to increase the error tolerance or vary the unitarization parameters\n");
void loadCPUField(const cpuGaugeField &cpu)
Download into this field from a CPU field.
void saveCPUField(cpuGaugeField &cpu) const
Upload from this field into a CPU field.
TestEventListener * Release(TestEventListener *listener)
TestEventListener * default_result_printer() const
TestEventListeners & listeners()
static UnitTest * GetInstance()
void comm_allreduce_int(int *data)
std::shared_ptr< QUDAApp > make_app(std::string app_description, std::string app_name)
QudaReconstructType link_recon
std::array< int, 4 > gridsize_from_cmdline
enum QudaGaugeFieldOrder_s QudaGaugeFieldOrder
@ QUDA_REFERENCE_FIELD_CREATE
void exchange_llfat_cleanup(void)
#define ASSERT_EQ(val1, val2)
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
QudaGaugeFieldOrder gauge_order
int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision)
int dimPartitioned(int dim)
void initComms(int argc, char **argv, std::array< int, 4 > &commDims)
void createSiteLinkCPU(void **link, QudaPrecision precision, int phase)
#define safe_malloc(size)
#define pinned_malloc(size)
#define get_mapped_device_pointer(ptr)
#define mapped_malloc(size)
const char * get_prec_str(QudaPrecision prec)
const char * get_unitarization_str(bool svd_only)
const char * get_recon_str(QudaReconstructType recon)
void setUnitarizeLinksConstants(double unitarize_eps, double max_error, bool allow_svd, bool svd_only, double svd_rel_error, double svd_abs_error)
void unitarizeLinksCPU(GaugeField &outfield, const GaugeField &infield)
void unitarizeLinks(GaugeField &outfield, const GaugeField &infield, int *fails)
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Main header file for the QUDA library.
QudaGaugeParam newQudaGaugeParam(void)
void initQuda(int device)
void computeKSLinkQuda(void *fatlink, void *longlink, void *ulink, void *inlink, double *path_coeff, QudaGaugeParam *param)
QudaReconstructType reconstruct
QudaPrecision cuda_prec_sloppy
QudaReconstructType reconstruct_sloppy
QudaGaugeFieldOrder gauge_order
QudaReconstructType reconstruct
QudaGaugeFieldOrder order
void setPrecision(QudaPrecision precision, bool force_native=false)
Helper function for setting the precision and corresponding field order for QUDA internal fields.
QudaGhostExchange ghostExchange
int main(int argc, char **argv)
TEST(unitarization, verify)
cudaGaugeField * cudaFatLink
cpuGaugeField * cpuFatLink
cpuGaugeField * cudaResult
cudaGaugeField * cudaULink