Advanced Computing Platform for Theoretical Physics

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

Commit 3d8d0d54 authored by rbabich's avatar rbabich
Browse files

implemented asymmetric preconditioning for quda clover (still a bit

broken) and fixed a typo that prevented compiling in emulation mode


git-svn-id: http://lattice.bu.edu/qcdalg/cuda/quda@468 be54200a-260c-0410-bdd7-ce6af2a381ab
parent e11b7242
......@@ -219,7 +219,7 @@ void loadParityClover(ParityClover ret, void *clover, Precision cpu_prec,
if (ret.precision == QUDA_HALF_PRECISION) cudaFreeHost(packedCloverNorm);
#else
free(packedClover);
if (ret.precision == CUDA_HALF_PRECISION) free(packedCloverNorm);
if (ret.precision == QUDA_HALF_PRECISION) free(packedCloverNorm);
#endif
}
......
......@@ -1812,40 +1812,36 @@ void cloverMatPCCuda(ParitySpinor out, FullGauge gauge, FullClover clover, FullC
printf("QUDA error: For asymmetric matpc_type, the uninverted clover term must be loaded\n");
}
if (!dagger) {
// FIXME: For asymmetric, a "dslashCxpay" kernel would improve performance.
if (matpc_type == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC) {
cloverDslashCuda(tmp, gauge, cloverInv, in, 1, dagger);
cloverCuda(out, gauge, clover, in, 0);
dslashXpayCuda(out, gauge, tmp, 0, dagger, out, kappa2);
} else if (matpc_type == QUDA_MATPC_ODD_ODD_ASYMMETRIC) {
cloverDslashCuda(tmp, gauge, cloverInv, in, 0, dagger);
cloverCuda(out, gauge, clover, in, 1);
dslashXpayCuda(out, gauge, tmp, 1, dagger, out, kappa2);
} else if (!dagger) { // symmetric preconditioning
if (matpc_type == QUDA_MATPC_EVEN_EVEN) {
cloverDslashCuda(tmp, gauge, cloverInv, in, 1, dagger);
cloverDslashXpayCuda(out, gauge, cloverInv, tmp, 0, dagger, in, kappa2);
} else if (matpc_type == QUDA_MATPC_ODD_ODD) {
cloverDslashCuda(tmp, gauge, cloverInv, in, 0, dagger);
cloverDslashXpayCuda(out, gauge, cloverInv, tmp, 1, dagger, in, kappa2);
} else if (matpc_type == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC) {
printf("QUDA error: matpc_type QUDA_MATPC_EVEN_EVEN_ASYMMETRIC not implemented yet\n");
exit(1);
} else if (matpc_type == QUDA_MATPC_ODD_ODD_ASYMMETRIC) {
printf("QUDA error: matpc_type QUDA_MATPC_ODD_ODD_ASYMMETRIC not implemented yet\n");
exit(-1);
} else {
printf("QUDA error: invalid matpc_type\n");
exit(-1);
}
} else { // very inefficient (FIXME)
} else { // symmetric preconditioning, dagger
if (matpc_type == QUDA_MATPC_EVEN_EVEN) {
cloverCuda(tmp, gauge, cloverInv, in, 0);
cloverDslashCuda(out, gauge, cloverInv, tmp, 1, dagger);
copyCuda(tmp, out);
cloverCuda(out, gauge, cloverInv, in, 0);
cloverDslashCuda(tmp, gauge, cloverInv, out, 1, dagger);
dslashXpayCuda(out, gauge, tmp, 0, dagger, in, kappa2);
} else if (matpc_type == QUDA_MATPC_ODD_ODD) {
cloverCuda(tmp, gauge, cloverInv, in, 1);
cloverDslashCuda(out, gauge, cloverInv, tmp, 0, dagger);
copyCuda(tmp, out);
cloverCuda(out, gauge, cloverInv, in, 1);
cloverDslashCuda(tmp, gauge, cloverInv, out, 0, dagger);
dslashXpayCuda(out, gauge, tmp, 1, dagger, in, kappa2);
} else if (matpc_type == QUDA_MATPC_EVEN_EVEN_ASYMMETRIC) {
printf("QUDA error: matpc_type QUDA_MATPC_EVEN_EVEN_ASYMMETRIC not implemented yet\n");
exit(1);
} else if (matpc_type == QUDA_MATPC_ODD_ODD_ASYMMETRIC) {
printf("QUDA error: matpc_type QUDA_MATPC_ODD_ODD_ASYMMETRIC not implemented yet\n");
exit(-1);
} else {
printf("QUDA error: invalid matpc_type\n");
exit(-1);
......
......@@ -36,7 +36,7 @@ void init() {
gaugeParam.X[0] = 24;
gaugeParam.X[1] = 24;
gaugeParam.X[2] = 24;
gaugeParam.X[3] = 32;
gaugeParam.X[3] = 48;
setDims(gaugeParam.X);
gaugeParam.anisotropy = 2.3;
......@@ -61,6 +61,8 @@ void init() {
inv_param.kappa = kappa;
inv_param.matpc_type = QUDA_MATPC_EVEN_EVEN_ASYMMETRIC;
inv_param.cpu_prec = QUDA_DOUBLE_PRECISION;
inv_param.cuda_prec = QUDA_SINGLE_PRECISION;
......@@ -85,7 +87,7 @@ void init() {
if (clover_yes) {
size_t cSize = (inv_param.clover_cpu_prec == QUDA_DOUBLE_PRECISION) ? sizeof(double) : sizeof(float);
if (test_type == 2) {
if (test_type > 0) {
hostClover = malloc(V*cloverSiteSize*cSize);
hostCloverInv = hostClover; // fake it
} else {
......@@ -201,10 +203,10 @@ double dslashCUDA() {
if (TRANSFER) {
MatPCQuda(spinorOdd, spinorEven, &inv_param, DAGGER_BIT);
} else if (!clover_yes) {
MatPCCuda(cudaSpinor.odd, gauge, cudaSpinor.even, kappa, tmp, QUDA_MATPC_EVEN_EVEN, DAGGER_BIT);
MatPCCuda(cudaSpinor.odd, gauge, cudaSpinor.even, kappa, tmp, inv_param.matpc_type, DAGGER_BIT);
} else {
cloverMatPCCuda(cudaSpinor.odd, gauge, clover, cloverInv, cudaSpinor.even, kappa, tmp,
QUDA_MATPC_EVEN_EVEN, DAGGER_BIT);
inv_param.matpc_type, DAGGER_BIT);
}
break;
case 2:
......
......@@ -37,7 +37,7 @@ int main(int argc, char **argv)
gauge_param = &Gauge_param;
int clover_yes = 1; // 0 for plain Wilson, 1 for clover
int clover_yes = 0; // 0 for plain Wilson, 1 for clover
if (clover_yes) {
inv_param.dslash_type = QUDA_CLOVER_WILSON_DSLASH;
......
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