Advanced Computing Platform for Theoretical Physics

Commit 2bbcd340 authored by mikeaclark's avatar mikeaclark
Browse files

Fixed memory bug in checkGauge

git-svn-id: http://lattice.bu.edu/qcdalg/cuda/quda@517 be54200a-260c-0410-bdd7-ce6af2a381ab
parent 33f0a6b7
...@@ -28,16 +28,16 @@ void init() { ...@@ -28,16 +28,16 @@ void init() {
param.blockDim = 64; param.blockDim = 64;
param.cpu_prec = QUDA_SINGLE_PRECISION; param.cpu_prec = QUDA_DOUBLE_PRECISION;
param.cuda_prec = QUDA_SINGLE_PRECISION; param.cuda_prec = QUDA_DOUBLE_PRECISION;
param.reconstruct = QUDA_RECONSTRUCT_8; param.reconstruct = QUDA_RECONSTRUCT_12;
param.cuda_prec_sloppy = param.cuda_prec; param.cuda_prec_sloppy = param.cuda_prec;
param.reconstruct_sloppy = param.reconstruct; param.reconstruct_sloppy = param.reconstruct;
param.X[0] = 24; param.X[0] = 8;
param.X[1] = 24; param.X[1] = 8;
param.X[2] = 24; param.X[2] = 8;
param.X[3] = 24; param.X[3] = 4;
setDims(param.X); setDims(param.X);
param.anisotropy = 2.3; param.anisotropy = 2.3;
...@@ -74,7 +74,7 @@ void SU3Test() { ...@@ -74,7 +74,7 @@ void SU3Test() {
loadGaugeQuda(gauge, &param); loadGaugeQuda(gauge, &param);
saveGaugeQuda(new_gauge); saveGaugeQuda(new_gauge);
check_gauge(gauge, new_gauge, param.cpu_prec); check_gauge(gauge, new_gauge, 1e-3, param.cpu_prec);
end(); end();
} }
......
...@@ -554,7 +554,7 @@ void strong_check(void *spinorRef, void *spinorGPU, int len, Precision prec) { ...@@ -554,7 +554,7 @@ void strong_check(void *spinorRef, void *spinorGPU, int len, Precision prec) {
} }
template <typename Float> template <typename Float>
void checkGauge(Float **oldG, Float **newG) { void checkGauge(Float **oldG, Float **newG, double epsilon) {
int fail_check = 17; int fail_check = 17;
int fail[fail_check]; int fail[fail_check];
...@@ -562,15 +562,15 @@ void checkGauge(Float **oldG, Float **newG) { ...@@ -562,15 +562,15 @@ void checkGauge(Float **oldG, Float **newG) {
for (int i=0; i<fail_check; i++) fail[i] = 0; for (int i=0; i<fail_check; i++) fail[i] = 0;
for (int i=0; i<18; i++) iter[i] = 0; for (int i=0; i<18; i++) iter[i] = 0;
for (int eo=0; eo<2; eo++) { for (int d=0; d<4; d++) {
for (int i=0; i<Vh; i++) { for (int eo=0; eo<2; eo++) {
int ga_idx = (eo*Vh+i); for (int i=0; i<Vh; i++) {
for (int d=0; d<4; d++) { int ga_idx = (eo*Vh+i);
for (int j=0; j<18; j++) { for (int j=0; j<18; j++) {
double diff = fabs(newG[d][ga_idx*18+j] - oldG[d][ga_idx*18+j]); double diff = fabs(newG[d][ga_idx*18+j] - oldG[d][ga_idx*18+j]);
for (int f=0; f<fail_check; f++) if (diff > pow(10.0,-(f+1))) fail[f]++; for (int f=0; f<fail_check; f++) if (diff > pow(10.0,-(f+1))) fail[f]++;
if (diff > 1e-3) iter[j]++; if (diff > epsilon) iter[j]++;
} }
} }
} }
...@@ -584,9 +584,9 @@ void checkGauge(Float **oldG, Float **newG) { ...@@ -584,9 +584,9 @@ void checkGauge(Float **oldG, Float **newG) {
} }
void check_gauge(void *oldG, void *newG, QudaPrecision precision) { void check_gauge(void **oldG, void **newG, double epsilon, QudaPrecision precision) {
if (precision == QUDA_SINGLE_PRECISION) if (precision == QUDA_DOUBLE_PRECISION)
checkGauge((double**)oldG, (double**)newG); checkGauge((double**)oldG, (double**)newG, epsilon);
else else
checkGauge((float**)oldG, (float**)newG); checkGauge((float**)oldG, (float**)newG, epsilon);
} }
...@@ -29,7 +29,7 @@ extern "C" { ...@@ -29,7 +29,7 @@ extern "C" {
void strong_check(void *spinor, void *spinorGPU, int len, Precision precision); void strong_check(void *spinor, void *spinorGPU, int len, Precision precision);
int compare_floats(void *a, void *b, int len, double epsilon, Precision precision); int compare_floats(void *a, void *b, int len, double epsilon, Precision precision);
void check_gauge(void *, void *, Precision precision); void check_gauge(void **, void **, double epsilon, Precision precision);
// ---------- gauge_read.cpp ---------- // ---------- gauge_read.cpp ----------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment