7 #include <cuda_runtime.h> 27 #define TDIFF(a,b) (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec)) 32 extern void usage(
char** argv);
58 TEST(unitarization, verify) {
70 ASSERT_EQ(res,1) <<
"CPU and CUDA implementations do not agree";
119 errorQuda(
"ERROR: allocating fatlink failed\n");
123 for(
int i=0;
i < 4;
i++){
125 if(sitelink[
i] == NULL){
126 errorQuda(
"ERROR; allocate sitelink[%d] failed\n",
i);
134 double* link =
reinterpret_cast<double*
>(inlink);
135 for(
int dir=0; dir<4; ++dir){
136 double* slink =
reinterpret_cast<double*
>(sitelink[dir]);
137 for(
int i=0;
i<
V; ++
i){
144 float* link =
reinterpret_cast<float*
>(inlink);
145 for(
int dir=0; dir<4; ++dir){
146 float* slink =
reinterpret_cast<float*
>(sitelink[dir]);
147 for(
int i=0;
i<
V; ++
i){
173 double act_path_coeff[6];
174 act_path_coeff[0] = 0.625000;
175 act_path_coeff[1] = -0.058479;
176 act_path_coeff[2] = -0.087719;
177 act_path_coeff[3] = 0.030778;
178 act_path_coeff[4] = -0.007200;
179 act_path_coeff[5] = -0.123113;
195 errorQuda(
"cudaMalloc failed for num_failures_dev\n");
201 gettimeofday(&t0,NULL);
203 cudaDeviceSynchronize();
204 gettimeofday(&t1,NULL);
210 test_rc = RUN_ALL_TESTS();
219 for(
int dir=0; dir<4; ++dir) cudaFreeHost(sitelink[dir]);
240 printfQuda(
"link_precision link_reconstruct space_dimension T_dimension algorithm max allowed error deviation tolerance\n");
263 int main(
int argc,
char **argv)
266 ::testing::InitGoogleTest(&argc, argv);
274 for (
i=1;
i<argc;
i++){
279 fprintf(stderr,
"ERROR: Invalid option:%s\n", argv[
i]);
296 printfQuda(
"You may want to increase the error tolerance or vary the unitarization parameters\n");
static QudaGaugeParam qudaGaugeParam
int dimPartitioned(int dim)
QudaReconstructType reconstruct_sloppy
QudaGhostExchange ghostExchange
int main(int argc, char **argv)
enum QudaPrecision_s QudaPrecision
void saveCPUField(cpuGaugeField &cpu) const
Upload from this field into a CPU field.
void setUnitarizeLinksConstants(double unitarize_eps, double max_error, bool allow_svd, bool svd_only, double svd_rel_error, double svd_abs_error)
void setPrecision(QudaPrecision precision)
Helper function for setting the precision and corresponding field order for QUDA internal fields...
cpuGaugeField * cpuFatLink
cudaGaugeField * cudaULink
static bool reunit_svd_only
int process_command_line_option(int argc, char **argv, int *idx)
static QudaPrecision cpu_prec
QudaReconstructType link_recon
QudaGaugeFieldOrder gauge_order
void computeKSLinkQuda(void *fatlink, void *longlink, void *ulink, void *inlink, double *path_coeff, QudaGaugeParam *param)
static double svd_rel_error
int compare_floats(void *a, void *b, int len, double epsilon, QudaPrecision precision)
const char * get_prec_str(QudaPrecision prec)
void createSiteLinkCPU(void **link, QudaPrecision precision, int phase)
static void display_test_info()
static double max_allowed_error
else return(__swbuf(_c, _p))
TEST(unitarization, verify)
void loadCPUField(const cpuGaugeField &cpu)
Download into this field from a CPU field.
const char * get_unitarization_str(bool svd_only)
void initQuda(int device)
void unitarizeLinks(cudaGaugeField &outfield, const cudaGaugeField &infield, int *fails)
void * malloc(size_t __size) __attribute__((__warn_unused_result__)) __attribute__((alloc_size(1)))
const char * get_recon_str(QudaReconstructType recon)
QudaGaugeFieldOrder order
QudaPrecision cuda_prec_sloppy
enum QudaGaugeFieldOrder_s QudaGaugeFieldOrder
static double unitarize_eps
QudaReconstructType reconstruct
int fprintf(FILE *, const char *,...) __attribute__((__format__(__printf__
void exchange_llfat_cleanup(void)
static int unitarize_link_test(int &test_rc)
static QudaGaugeFieldOrder gauge_order
static bool reunit_allow_svd
void unitarizeLinksCPU(cpuGaugeField &outfield, const cpuGaugeField &infield)
int gridsize_from_cmdline[]
static double svd_abs_error
enum QudaReconstructType_s QudaReconstructType
Main header file for the QUDA library.
cudaGaugeField * cudaFatLink
void comm_allreduce_int(int *data)
QudaReconstructType reconstruct
void initComms(int argc, char **argv, const int *commDims)
cpuGaugeField * cudaResult
QudaGaugeParam newQudaGaugeParam(void)