Advanced Computing Platform for Theoretical Physics

commit大文件会使得服务器变得不稳定,请大家尽量只commit代码,不要commit大的文件。

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() {
param.blockDim = 64;
param.cpu_prec = QUDA_SINGLE_PRECISION;
param.cuda_prec = QUDA_SINGLE_PRECISION;
param.reconstruct = QUDA_RECONSTRUCT_8;
param.cpu_prec = QUDA_DOUBLE_PRECISION;
param.cuda_prec = QUDA_DOUBLE_PRECISION;
param.reconstruct = QUDA_RECONSTRUCT_12;
param.cuda_prec_sloppy = param.cuda_prec;
param.reconstruct_sloppy = param.reconstruct;
param.X[0] = 24;
param.X[1] = 24;
param.X[2] = 24;
param.X[3] = 24;
param.X[0] = 8;
param.X[1] = 8;
param.X[2] = 8;
param.X[3] = 4;
setDims(param.X);
param.anisotropy = 2.3;
......@@ -74,7 +74,7 @@ void SU3Test() {
loadGaugeQuda(gauge, &param);
saveGaugeQuda(new_gauge);
check_gauge(gauge, new_gauge, param.cpu_prec);
check_gauge(gauge, new_gauge, 1e-3, param.cpu_prec);
end();
}
......
......@@ -554,7 +554,7 @@ void strong_check(void *spinorRef, void *spinorGPU, int len, Precision prec) {
}
template <typename Float>
void checkGauge(Float **oldG, Float **newG) {
void checkGauge(Float **oldG, Float **newG, double epsilon) {
int fail_check = 17;
int fail[fail_check];
......@@ -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<18; i++) iter[i] = 0;
for (int eo=0; eo<2; eo++) {
for (int i=0; i<Vh; i++) {
int ga_idx = (eo*Vh+i);
for (int d=0; d<4; d++) {
for (int d=0; d<4; d++) {
for (int eo=0; eo<2; eo++) {
for (int i=0; i<Vh; i++) {
int ga_idx = (eo*Vh+i);
for (int j=0; j<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]++;
if (diff > 1e-3) iter[j]++;
if (diff > epsilon) iter[j]++;
}
}
}
......@@ -584,9 +584,9 @@ void checkGauge(Float **oldG, Float **newG) {
}
void check_gauge(void *oldG, void *newG, QudaPrecision precision) {
if (precision == QUDA_SINGLE_PRECISION)
checkGauge((double**)oldG, (double**)newG);
void check_gauge(void **oldG, void **newG, double epsilon, QudaPrecision precision) {
if (precision == QUDA_DOUBLE_PRECISION)
checkGauge((double**)oldG, (double**)newG, epsilon);
else
checkGauge((float**)oldG, (float**)newG);
checkGauge((float**)oldG, (float**)newG, epsilon);
}
......@@ -29,7 +29,7 @@ extern "C" {
void strong_check(void *spinor, void *spinorGPU, int len, 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 ----------
......
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