Skip to content

Commit

Permalink
do not compute sw_term when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcogarofalo committed Apr 23, 2024
1 parent b415eb6 commit e29573f
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 45 deletions.
58 changes: 31 additions & 27 deletions monomial/cloverdet_monomial.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,6 @@ void cloverdet_derivative(const int id, hamiltonian_field_t * const hf) {
monomial * mnl = &monomial_list[id];
int N = VOLUME/2;
tm_stopwatch_push(&g_timers, __func__, mnl->name);
tm_stopwatch_push(&g_timers, "su3_zero", "");
#ifdef TM_USE_OMP
#pragma omp parallel for
#endif
for(int i = 0; i < VOLUME; i++) {
for(int mu = 0; mu < 4; mu++) {
_su3_zero(swm[i][mu]);
_su3_zero(swp[i][mu]);
}
}
tm_stopwatch_pop(&g_timers, 0, 1, "");

mnl->forcefactor = 1.;
/*********************************************************************
Expand All @@ -89,16 +78,29 @@ void cloverdet_derivative(const int id, hamiltonian_field_t * const hf) {
g_kappa = mnl->kappa;
boundary(mnl->kappa);

// we compute the clover term (1 + T_ee(oo)) for all sites x
sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
// we invert it for the even sites only
if(!mnl->even_odd_flag) {
N = VOLUME;
}
else {
sw_invert(EE, mnl->mu);
if( g_debug_level > 2 || g_strict_residual_check || !(mnl->external_library == QUDA_LIB && mnl->solver_params.external_inverter == QUDA_INVERTER) ){
tm_stopwatch_push(&g_timers, "su3_zero", "");
#ifdef TM_USE_OMP
#pragma omp parallel for
#endif
for(int i = 0; i < VOLUME; i++) {
for(int mu = 0; mu < 4; mu++) {
_su3_zero(swm[i][mu]);
_su3_zero(swp[i][mu]);
}
}
tm_stopwatch_pop(&g_timers, 0, 1, "");

// we compute the clover term (1 + T_ee(oo)) for all sites x
sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
// we invert it for the even sites only
if(!mnl->even_odd_flag) {
N = VOLUME;
}
else {
sw_invert(EE, mnl->mu);
}
}

// Invert Q_{+} Q_{-}
// X_o -> w_fields[1]
chrono_guess(mnl->w_fields[1], mnl->pf, mnl->csg_field, mnl->csg_index_array,
Expand Down Expand Up @@ -274,15 +276,17 @@ double cloverdet_acc(const int id, hamiltonian_field_t * const hf) {
g_kappa = mnl->kappa;
boundary(mnl->kappa);

sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
if( g_debug_level > 2 || g_strict_residual_check || !(mnl->external_library == QUDA_LIB && mnl->solver_params.external_inverter == QUDA_INVERTER) ){

if(!mnl->even_odd_flag) {
N = VOLUME;
}
else {
sw_invert(EE, mnl->mu);
}
sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);

if(!mnl->even_odd_flag) {
N = VOLUME;
}
else {
sw_invert(EE, mnl->mu);
}
}
g_sloppy_precision_flag = 0;

if( mnl->solver == MG || mnl->solver == BICGSTAB ){
Expand Down
40 changes: 22 additions & 18 deletions monomial/ndrat_monomial.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,23 +83,25 @@ void ndrat_derivative(const int id, hamiltonian_field_t * const hf) {
tm_stopwatch_push(&g_timers, __func__, mnl->name);
nd_set_global_parameter(mnl);
if(mnl->type == NDCLOVERRAT) {
tm_stopwatch_push(&g_timers, "su3_zero", "");
#ifdef TM_USE_OMP
#pragma omp parallel for
#endif
for(int i = 0; i < VOLUME; i++) {
for(int mu = 0; mu < 4; mu++) {
_su3_zero(swm[i][mu]);
_su3_zero(swp[i][mu]);
if( g_debug_level > 2 || g_strict_residual_check || !(mnl->external_library == QUDA_LIB && mnl->solver_params.external_inverter == QUDA_INVERTER) ){
tm_stopwatch_push(&g_timers, "su3_zero", "");
#ifdef TM_USE_OMP
#pragma omp parallel for
#endif
for(int i = 0; i < VOLUME; i++) {
for(int mu = 0; mu < 4; mu++) {
_su3_zero(swm[i][mu]);
_su3_zero(swp[i][mu]);
}
}
tm_stopwatch_pop(&g_timers, 0, 1, "");

// we compute the clover term (1 + T_ee(oo)) for all sites x
sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
// we invert it for the even sites only
sw_invert_nd(mnl->mubar*mnl->mubar - mnl->epsbar*mnl->epsbar);
copy_32_sw_fields();
}
tm_stopwatch_pop(&g_timers, 0, 1, "");

// we compute the clover term (1 + T_ee(oo)) for all sites x
sw_term( (const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
// we invert it for the even sites only
sw_invert_nd(mnl->mubar*mnl->mubar - mnl->epsbar*mnl->epsbar);
copy_32_sw_fields();
}
mnl->forcefactor = mnl->EVMaxInv;

Expand Down Expand Up @@ -323,9 +325,11 @@ double ndrat_acc(const int id, hamiltonian_field_t * const hf) {
tm_stopwatch_push(&g_timers, __func__, mnl->name);
nd_set_global_parameter(mnl);
if(mnl->type == NDCLOVERRAT) {
sw_term((const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
sw_invert_nd(mnl->mubar*mnl->mubar - mnl->epsbar*mnl->epsbar);
copy_32_sw_fields();
if( g_debug_level > 2 || g_strict_residual_check || !(mnl->external_library == QUDA_LIB && mnl->solver_params.external_inverter == QUDA_INVERTER) ){
sw_term((const su3**) hf->gaugefield, mnl->kappa, mnl->c_sw);
sw_invert_nd(mnl->mubar*mnl->mubar - mnl->epsbar*mnl->epsbar);
copy_32_sw_fields();
}
}
mnl->energy1 = 0.;

Expand Down

0 comments on commit e29573f

Please sign in to comment.