Skip to content

Commit

Permalink
added wrapper interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
marcuspetschlies committed Jul 4, 2024
1 parent 5c354b5 commit 3369cd9
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 0 deletions.
95 changes: 95 additions & 0 deletions quda_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2922,3 +2922,98 @@ void eigsolveQuda(_Complex double * evals, int n_evals, double tol, int blksize,

tm_stopwatch_pop(&g_timers, 0, 1, "TM_QUDA");
}

/**********************************************************************/
/**********************************************************************/

/**********************************************************************
* simplest version, assuming global gauge field has already been set
*
* CAN THIS INTERFERE WITH LOADED INVERTER GAUGE FIELD ?
* DON'T WANT TO REBUILD CLOVER; MG SETUP after each smearing
* ( also Wuppertal smearing below )
*
* HOW MUCH MORE MEMORY DOES IT NEED ?
**********************************************************************/
void _performAPEnStep ( unsigned int nSteps, double alpha)
{
_initQuda();
_loadGaugeQuda(NO_COMPRESSION);

/* fill smear_param struct */
QudaGaugeSmearParam smear_param = newQudaGaugeSmearParam();
smear_param.smear_type = QUDA_GAUGE_SMEAR_APE;
smear_param.n_steps = nSteps;
smear_param.alpha = alpha;
smear_param.meas_interval = nSteps + 1;

/* fill obs_param struct */
QudaGaugeObservableParam obs_param = newQudaGaugeObservableParam();
obs_param.compute_plaquette = QUDA_BOOLEAN_TRUE;
obs_param.compute_qcharge = QUDA_BOOLEAN_FALSE;
obs_param.su_project = QUDA_BOOLEAN_FALSE;

performGaugeSmearQuda ( &smear_param, &obs_param );

return;

} /* end of _performAPEnStep */

/**********************************************************************/
/**********************************************************************/

/**********************************************************************
* again simplest version, assumes gauge fields are in place
* in partulcar gaugeSmeared, if that is to be used;
* should be preceeded by call to _performAPEnStep so that
* quda interface creates gaugeSmeared
*
* CHECK AGAIN FOR INTERFERENCE
*
* in place should be allowed
**********************************************************************/
void _performWuppertalnStep ( double * const h_out, double * const h_in, unsigned int nSteps, double alpha )
{

if ( h_out != h_in ) {
memcpy ( h_out, h_in, VOLUME*24*sizeof(double) );
}
reorder_spinor_toQuda ( h_out, inv_param.cpu_prec, 0 );

memcpy ( tempSpinor, h_out, VOLUME*24*sizeof(double) );

performWuppertalnStep( (void *)h_out, (void*)tempSpinor, &inv_param, nSteps, alpha );

reorder_spinor_fromQuda ( h_out, inv_param.cpu_prec, 0 );
} /* end of _performWuppertalnStep */

/**********************************************************************/
/**********************************************************************/

/**********************************************************************
* wrapper for GFlowAdjoint
**********************************************************************/
void _performGFlowAdjoint ( double * const h_out, double * const h_in, QudaGaugeSmearParam *smear_param, int const mb, int const nb, int const store )
{
if ( h_out != NULL && h_in != NULL )
{
if ( h_out != h_in )
{
memcpy ( h_out, h_in, VOLUME*24*sizeof(double) );
}
reorder_spinor_toQuda ( h_out, inv_param.cpu_prec, 0 );

memcpy ( tempSpinor, h_out, VOLUME*24*sizeof(double) );
}

performGFlowAdjoint ( (void *)h_out, (void *)h_in, &inv_param, smear_param, mb, nb, store );

if ( h_out != NULL && h_in != NULL )
{
reorder_spinor_fromQuda ( h_out, inv_param.cpu_prec, 0 );
}
} /* end of _performGFlowAdjoint */




6 changes: 6 additions & 0 deletions quda_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,10 @@ void eigsolveQuda(_Complex double * evals, int n_evals, double tol, int blksize,
const int even_odd_flag, const SloppyPrecision refinement_precision,
SloppyPrecision sloppy_precision, CompressionType compression, const int oneFlavourFlag);

void _performAPEnStep ( unsigned int nSteps, double alpha);

void _performWuppertalnStep ( double * const h_out, double * const h_in, unsigned int nSteps, double alpha );

void _performGFlowAdjoint ( double * const h_out, double * const h_in, QudaGaugeSmearParam *smear_param, int const mb, int const nb, int const store );

#endif /* QUDA_INTERFACE_H_ */

0 comments on commit 3369cd9

Please sign in to comment.