QUDA v0.3.2
A library for QCD on GPUs

quda/tests/su3_test.c

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 
00004 #include <test_util.h>
00005 #include <wilson_dslash_reference.h>
00006 
00007 QudaGaugeParam param;
00008 void *gauge[4], *new_gauge[4];
00009 
00010 void init() {
00011 
00012   param.cpu_prec = QUDA_DOUBLE_PRECISION;
00013   param.cuda_prec = QUDA_HALF_PRECISION;
00014   param.reconstruct = QUDA_RECONSTRUCT_8;
00015   param.cuda_prec_sloppy = param.cuda_prec;
00016   param.reconstruct_sloppy = param.reconstruct;
00017   
00018   param.X[0] = 8;
00019   param.X[1] = 8;
00020   param.X[2] = 8;
00021   param.X[3] = 4;
00022   setDims(param.X);
00023 
00024   param.anisotropy = 2.3;
00025   param.t_boundary = QUDA_ANTI_PERIODIC_T;
00026   param.gauge_fix = QUDA_GAUGE_FIXED_NO;
00027 
00028   // construct gauge fields
00029   for (int dir = 0; dir < 4; dir++) {
00030     gauge[dir] = malloc(V*gaugeSiteSize*param.cpu_prec);
00031     new_gauge[dir] = malloc(V*gaugeSiteSize*param.cpu_prec);
00032   }
00033 
00034   int dev = 0;
00035   initQuda(dev);
00036 }
00037 
00038 void end() {
00039   // release memory
00040   for (int dir = 0; dir < 4; dir++) {
00041     free(gauge[dir]);
00042     free(new_gauge[dir]);
00043   }
00044 }
00045 
00046 void SU3Test() {
00047 
00048   init();
00049     
00050   printf("Randomizing fields...");
00051   construct_gauge_field((void**)gauge, 1, param.cpu_prec, &param);
00052   printf("done.\n");
00053 
00054   loadGaugeQuda(gauge, &param);
00055   saveGaugeQuda(new_gauge, &param);
00056 
00057   check_gauge(gauge, new_gauge, 1e-3, param.cpu_prec);
00058 
00059   end();
00060 }
00061 
00062 int main(int argc, char **argv) {
00063   SU3Test();
00064 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines