6 #include <cuda_runtime.h>
25 #define TDIFF(a,b) (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec))
30 extern void usage(
char** argv);
34 static double unitarize_eps = 1e-6;
35 static bool reunit_allow_svd =
true;
36 static bool reunit_svd_only =
false;
37 static double svd_rel_error = 1e-4;
38 static double svd_abs_error = 1e-5;
39 static double max_allowed_error = 1e-11;
40 static bool check_unitarization =
true;
66 qudaGaugeParam.
X[0] =
xdim;
67 qudaGaugeParam.
X[1] =
ydim;
68 qudaGaugeParam.
X[2] =
zdim;
69 qudaGaugeParam.
X[3] =
tdim;
117 #define QUDA_VER ((10000*QUDA_VERSION_MAJOR) + (100*QUDA_VERSION_MINOR) + QUDA_VERSION_SUBMINOR)
121 quda::initCommonConstants(*cudaFatLink);
130 errorQuda(
"ERROR: allocating fatlink failed\n");
134 for(
int i=0;i < 4;i++){
136 if(sitelink[i] == NULL){
137 errorQuda(
"ERROR; allocate sitelink[%d] failed\n", i);
144 double act_path_coeff[6];
145 act_path_coeff[0] = 0.625000;
146 act_path_coeff[1] = -0.058479;
147 act_path_coeff[2] = -0.087719;
148 act_path_coeff[3] = 0.030778;
149 act_path_coeff[4] = -0.007200;
150 act_path_coeff[5] = -0.123113;
185 int* num_failures_dev;
186 if(cudaMalloc(&num_failures_dev,
sizeof(
int)) != cudaSuccess){
187 errorQuda(
"cudaMalloc failed for num_failures_dev\n");
189 cudaMemset(num_failures_dev, 0,
sizeof(
int));
191 struct timeval t0, t1;
193 gettimeofday(&t0,NULL);
195 cudaDeviceSynchronize();
196 gettimeofday(&t1,NULL);
199 cudaMemcpy(&num_failures, num_failures_dev,
sizeof(
int), cudaMemcpyDeviceToHost);
204 for(
int dir=0;
dir<4; ++
dir) cudaFreeHost(sitelink[
dir]);
205 cudaFree(num_failures_dev);
220 printfQuda(
"link_precision link_reconstruct space_dimension T_dimension algorithm max allowed error\n");
251 for (i=1; i<argc; i++){
256 fprintf(stderr,
"ERROR: Invalid option:%s\n", argv[i]);
263 int num_failures = unitarize_link_test();
270 printfQuda(
"Number of failures = %d\n", num_failures);
271 if(num_failures > 0){
272 printfQuda(
"Failure rate = %lf%\n", num_failures/(4.0*
V*num_procs));
273 printfQuda(
"You may want to increase your error tolerance or vary the unitarization parameters\n");