QUDA  v0.5.0
A library for QCD on GPUs
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Functions | Variables
interface_quda.cpp File Reference
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>
#include <quda.h>
#include <quda_internal.h>
#include <comm_quda.h>
#include <tune_quda.h>
#include <blas_quda.h>
#include <gauge_field.h>
#include <dirac_quda.h>
#include <dslash_quda.h>
#include <invert_quda.h>
#include <color_spinor_field.h>
#include <clover_field.h>
#include <llfat_quda.h>
#include <fat_force_quda.h>
#include <hisq_links_quda.h>
#include <cuda.h>
#include "check_params.h"
#include "face_quda.h"

Go to the source code of this file.

Classes

struct  LexMapData
 

Namespaces

namespace  quda
 

Macros

#define MAX(a, b)   ((a)>(b)? (a):(b))
 
#define TDIFF(a, b)   (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec))
 
#define spinorSiteSize   24
 
#define MAX_GPU_NUM_PER_NODE   16
 
#define INIT_PARAM
 
#define CHECK_PARAM
 
#define PRINT_PARAM
 

Functions

void setVerbosityQuda (QudaVerbosity verbosity, const char prefix[], FILE *outfile)
 
void initCommsGridQuda (int nDim, const int *dims, QudaCommsMap func, void *fdata)
 
void initQuda (int dev)
 
void loadGaugeQuda (void *h_gauge, QudaGaugeParam *param)
 
void saveGaugeQuda (void *h_gauge, QudaGaugeParam *param)
 
void loadCloverQuda (void *h_clover, void *h_clovinv, QudaInvertParam *inv_param)
 
void freeGaugeQuda (void)
 
void freeCloverQuda (void)
 
void endQuda (void)
 
void quda::setDiracParam (DiracParam &diracParam, QudaInvertParam *inv_param, bool pc)
 
void quda::setDiracSloppyParam (DiracParam &diracParam, QudaInvertParam *inv_param, bool pc)
 
void quda::setDiracPreParam (DiracParam &diracParam, QudaInvertParam *inv_param, const bool pc)
 
void quda::createDirac (Dirac *&d, Dirac *&dSloppy, Dirac *&dPre, QudaInvertParam &param, const bool pc_solve)
 
void quda::massRescale (QudaDslashType dslash_type, double &kappa, QudaSolutionType solution_type, QudaMassNormalization mass_normalization, cudaColorSpinorField &b)
 
void quda::massRescaleCoeff (QudaDslashType dslash_type, double &kappa, QudaSolutionType solution_type, QudaMassNormalization mass_normalization, double &coeff)
 
void dslashQuda (void *h_out, void *h_in, QudaInvertParam *inv_param, QudaParity parity)
 
void MatQuda (void *h_out, void *h_in, QudaInvertParam *inv_param)
 
void MatDagMatQuda (void *h_out, void *h_in, QudaInvertParam *inv_param)
 
quda::cudaGaugeFieldcheckGauge (QudaInvertParam *param)
 
void cloverQuda (void *h_out, void *h_in, QudaInvertParam *inv_param, QudaParity parity, int inverse)
 
void invertQuda (void *hp_x, void *hp_b, QudaInvertParam *param)
 
void invertMultiShiftQuda (void **_hp_x, void *_hp_b, QudaInvertParam *param)
 
void init_quda_ (int *dev)
 
void end_quda_ ()
 
void load_gauge_quda_ (void *h_gauge, QudaGaugeParam *param)
 
void free_gauge_quda_ ()
 
void load_clover_quda_ (void *h_clover, void *h_clovinv, QudaInvertParam *inv_param)
 
void free_clover_quda_ (void)
 
void dslash_quda_ (void *h_out, void *h_in, QudaInvertParam *inv_param, QudaParity *parity)
 
void clover_quda_ (void *h_out, void *h_in, QudaInvertParam *inv_param, QudaParity *parity, int *inverse)
 
void mat_quda_ (void *h_out, void *h_in, QudaInvertParam *inv_param)
 
void mat_dag_mat_quda_ (void *h_out, void *h_in, QudaInvertParam *inv_param)
 
void invert_quda_ (void *hp_x, void *hp_b, QudaInvertParam *param)
 
void new_quda_gauge_param_ (QudaGaugeParam *param)
 
void new_quda_invert_param_ (QudaInvertParam *param)
 
void comm_set_gridsize_ (int *grid)
 

Variables

int numa_affinity_enabled = 1
 
cudaGaugeFieldgaugePrecise = NULL
 
cudaGaugeFieldgaugeSloppy = NULL
 
cudaGaugeFieldgaugePrecondition = NULL
 
cudaGaugeField *& gaugeFatPrecise = gaugePrecise
 
cudaGaugeField *& gaugeFatSloppy = gaugeSloppy
 
cudaGaugeField *& gaugeFatPrecondition = gaugePrecondition
 
cudaGaugeFieldgaugeLongPrecise = NULL
 
cudaGaugeFieldgaugeLongSloppy = NULL
 
cudaGaugeFieldgaugeLongPrecondition = NULL
 
cudaCloverFieldcloverPrecise = NULL
 
cudaCloverFieldcloverSloppy = NULL
 
cudaCloverFieldcloverPrecondition = NULL
 
cudaDeviceProp deviceProp
 
cudaStream_t * streams
 

Macro Definition Documentation

#define CHECK_PARAM

Definition at line 51 of file interface_quda.cpp.

#define INIT_PARAM

Definition at line 46 of file interface_quda.cpp.

#define MAX (   a,
 
)    ((a)>(b)? (a):(b))

Definition at line 38 of file interface_quda.cpp.

#define MAX_GPU_NUM_PER_NODE   16

Definition at line 43 of file interface_quda.cpp.

#define PRINT_PARAM

Definition at line 56 of file interface_quda.cpp.

#define spinorSiteSize   24

Definition at line 41 of file interface_quda.cpp.

#define TDIFF (   a,
 
)    (b.tv_sec - a.tv_sec + 0.000001*(b.tv_usec - a.tv_usec))

Definition at line 39 of file interface_quda.cpp.

Function Documentation

quda::cudaGaugeField* checkGauge ( QudaInvertParam param)

Definition at line 1027 of file interface_quda.cpp.

void clover_quda_ ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param,
QudaParity parity,
int *  inverse 
)

Apply the clover operator or its inverse.

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage
parityThe source and destination parity of the field
inverseWhether to apply the inverse of the clover term

Definition at line 1976 of file interface_quda.cpp.

void cloverQuda ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param,
QudaParity  parity,
int  inverse 
)

Definition at line 1048 of file interface_quda.cpp.

void comm_set_gridsize_ ( int *  grid)

Setter method for the comm grid size to all us to reuse BQCD's MPI topology. This is considered a temporary hack that will be fixed when an interface for setting the logical topology is created (issue 31 on github).

Definition at line 2006 of file interface_quda.cpp.

void dslash_quda_ ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param,
QudaParity parity 
)

Apply the Dslash operator (D_{eo} or D_{oe}).

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage
parityThe destination parity of the field

Definition at line 1974 of file interface_quda.cpp.

void dslashQuda ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param,
QudaParity  parity 
)

Apply the Dslash operator (D_{eo} or D_{oe}).

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage
parityThe destination parity of the field

Definition at line 819 of file interface_quda.cpp.

void end_quda_ ( void  )

Finalize the library.

Definition at line 1968 of file interface_quda.cpp.

void endQuda ( void  )

Finalize the library.

Definition at line 552 of file interface_quda.cpp.

void free_clover_quda_ ( void  )

Free QUDA's internal copy of the clover term and/or clover inverse.

Definition at line 1973 of file interface_quda.cpp.

void free_gauge_quda_ ( void  )

Free QUDA's internal copy of the gauge field.

Definition at line 1970 of file interface_quda.cpp.

void freeCloverQuda ( void  )

Free QUDA's internal copy of the clover term and/or clover inverse.

Definition at line 539 of file interface_quda.cpp.

void freeGaugeQuda ( void  )

Free QUDA's internal copy of the gauge field.

Definition at line 510 of file interface_quda.cpp.

void init_quda_ ( int *  device)

Initialize the library.

Parameters
deviceCUDA device number to use. In a multi-GPU build, this parameter may be either set explicitly on a per-process basis or set to -1 to enable a default allocation of devices to processes.

Definition at line 1967 of file interface_quda.cpp.

void initCommsGridQuda ( int  nDim,
const int *  dims,
QudaCommsMap  func,
void *  fdata 
)

Declare the grid mapping ("logical topology" in QMP parlance) used for communications in a multi-GPU grid. This function should be called prior to initQuda(). The only case in which it's optional is when QMP is used for communication and the logical topology has already been declared by the application.

Parameters
nDimNumber of grid dimensions. "4" is the only supported value currently.
dimsArray of grid dimensions. dims[0]*dims[1]*dims[2]*dims[3] must equal the total number of MPI ranks or QMP nodes.
funcPointer to a user-supplied function that maps coordinates in the communication grid to MPI ranks (or QMP node IDs). If the pointer is NULL, the default mapping depends on whether QMP or MPI is being used for communication. With QMP, the existing logical topology is used if it's been declared. With MPI or as a fallback with QMP, the default ordering is lexicographical with the fourth ("t") index varying fastest.
fdataPointer to any data required by "func" (may be NULL)
See Also
QudaCommsMap

Definition at line 151 of file interface_quda.cpp.

void initQuda ( int  device)

Initialize the library.

Parameters
deviceCUDA device number to use. In a multi-GPU build, this parameter may either be set explicitly on a per-process basis or set to -1 to enable a default allocation of devices to processes.

Definition at line 194 of file interface_quda.cpp.

void invert_quda_ ( void *  h_x,
void *  h_b,
QudaInvertParam param 
)

Perform the solve, according to the parameters set in param. It is assumed that the gauge field has already been loaded via loadGaugeQuda().

Parameters
h_xSolution spinor field
h_bSource spinor field
paramContains all metadata regarding host and device storage and solver parameters

Definition at line 1982 of file interface_quda.cpp.

void invertMultiShiftQuda ( void **  _hp_x,
void *  _hp_b,
QudaInvertParam param 
)

Generic version of the multi-shift solver. Should work for most fermions. Note that offset[0] is not folded into the mass parameter.

At present, the solution_type must be MATDAG_MAT or MATPCDAG_MATPC, and solve_type must be NORMOP or NORMOP_PC. The solution and solve preconditioning have to match.

Definition at line 1327 of file interface_quda.cpp.

void invertQuda ( void *  h_x,
void *  h_b,
QudaInvertParam param 
)

Perform the solve, according to the parameters set in param. It is assumed that the gauge field has already been loaded via loadGaugeQuda().

Parameters
h_xSolution spinor field
h_bSource spinor field
paramContains all metadata regarding host and device storage and solver parameters

Definition at line 1119 of file interface_quda.cpp.

void load_clover_quda_ ( void *  h_clover,
void *  h_clovinv,
QudaInvertParam inv_param 
)

Load the clover term and/or the clover inverse from the host. Either h_clover or h_clovinv may be set to NULL.

Parameters
h_cloverBase pointer to host clover field
h_cloverinvBase pointer to host clover inverse field
inv_paramContains all metadata regarding host and device storage

Definition at line 1971 of file interface_quda.cpp.

void load_gauge_quda_ ( void *  h_gauge,
QudaGaugeParam param 
)

Load the gauge field from the host.

Parameters
h_gaugeBase pointer to host gauge field (regardless of dimensionality)
paramContains all metadata regarding host and device storage

Definition at line 1969 of file interface_quda.cpp.

void loadCloverQuda ( void *  h_clover,
void *  h_clovinv,
QudaInvertParam inv_param 
)

Load the clover term and/or the clover inverse from the host. Either h_clover or h_clovinv may be set to NULL.

Parameters
h_cloverBase pointer to host clover field
h_cloverinvBase pointer to host clover inverse field
inv_paramContains all metadata regarding host and device storage

Definition at line 420 of file interface_quda.cpp.

void loadGaugeQuda ( void *  h_gauge,
QudaGaugeParam param 
)

Load the gauge field from the host.

Parameters
h_gaugeBase pointer to host gauge field (regardless of dimensionality)
paramContains all metadata regarding host and device storage

Definition at line 293 of file interface_quda.cpp.

void mat_dag_mat_quda_ ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param 
)

Apply M^{}M, possibly even/odd preconditioned.

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage

Definition at line 1980 of file interface_quda.cpp.

void mat_quda_ ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param 
)

Apply the full Dslash matrix, possibly even/odd preconditioned.

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage

Definition at line 1978 of file interface_quda.cpp.

void MatDagMatQuda ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param 
)

Apply M^{}M, possibly even/odd preconditioned.

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage

Definition at line 953 of file interface_quda.cpp.

void MatQuda ( void *  h_out,
void *  h_in,
QudaInvertParam inv_param 
)

Apply the full Dslash matrix, possibly even/odd preconditioned.

Parameters
h_outResult spinor field
h_inInput spinor field
paramContains all metadata regarding host and device storage

Definition at line 884 of file interface_quda.cpp.

void new_quda_gauge_param_ ( QudaGaugeParam param)

Initializes the QudaGaugeParam with default entries.

Parameters
TheQudaGaugeParam to be initialized

Definition at line 1984 of file interface_quda.cpp.

void new_quda_invert_param_ ( QudaInvertParam param)

Initializes the QudaInvertParam with default entries.

Parameters
TheQudaInvertParam to be initialized

Definition at line 1987 of file interface_quda.cpp.

void saveGaugeQuda ( void *  h_gauge,
QudaGaugeParam param 
)

Save the gauge field to the host.

Parameters
h_gaugeBase pointer to host gauge field (regardless of dimensionality)
paramContains all metadata regarding host and device storage

Definition at line 387 of file interface_quda.cpp.

void setVerbosityQuda ( QudaVerbosity  verbosity,
const char  prefix[],
FILE *  outfile 
)

Set parameters related to status reporting.

In typical usage, this function will be called once (or not at all) just before the call to initQuda(), but it's valid to call it any number of times at any point during execution. Prior to the first time it's called, the parameters take default values as indicated below.

Parameters
verbosityDefault verbosity, ranging from QUDA_SILENT to QUDA_DEBUG_VERBOSE. Within a solver, this parameter is overridden by the "verbosity" member of QudaInvertParam. The default value is QUDA_SUMMARIZE.
prefixString to prepend to all messages from QUDA. This defaults to the empty string (""), but you may wish to specify something like "QUDA: " to distinguish QUDA's output from that of your application.
outfileFile pointer (such as stdout, stderr, or a handle returned by fopen()) where messages should be printed. The default is stdout.

Definition at line 111 of file interface_quda.cpp.

Variable Documentation

cudaCloverField* cloverPrecise = NULL

Definition at line 79 of file interface_quda.cpp.

cudaCloverField* cloverPrecondition = NULL

Definition at line 81 of file interface_quda.cpp.

cudaCloverField* cloverSloppy = NULL

Definition at line 80 of file interface_quda.cpp.

cudaDeviceProp deviceProp

Definition at line 84 of file interface_quda.cpp.

cudaGaugeField*& gaugeFatPrecise = gaugePrecise

Definition at line 71 of file interface_quda.cpp.

cudaGaugeField*& gaugeFatPrecondition = gaugePrecondition

Definition at line 73 of file interface_quda.cpp.

cudaGaugeField*& gaugeFatSloppy = gaugeSloppy

Definition at line 72 of file interface_quda.cpp.

cudaGaugeField* gaugeLongPrecise = NULL

Definition at line 75 of file interface_quda.cpp.

cudaGaugeField* gaugeLongPrecondition = NULL

Definition at line 77 of file interface_quda.cpp.

cudaGaugeField* gaugeLongSloppy = NULL

Definition at line 76 of file interface_quda.cpp.

cudaGaugeField* gaugePrecise = NULL

Definition at line 66 of file interface_quda.cpp.

cudaGaugeField* gaugePrecondition = NULL

Definition at line 68 of file interface_quda.cpp.

cudaGaugeField* gaugeSloppy = NULL

Definition at line 67 of file interface_quda.cpp.

int numa_affinity_enabled = 1

Definition at line 62 of file interface_quda.cpp.

cudaStream_t* streams

Definition at line 85 of file interface_quda.cpp.