65 memcpy(
v, dynamic_cast<const cpuColorSpinorField&>(src).
v,
bytes);
69 errorQuda(
"Unknown input ColorSpinorField %s",
typeid(src).name());
83 errorQuda(
"Unknown input ColorSpinorField %s",
typeid(src).name());
108 src.saveSpinorField(*
this);
147 void cpuColorSpinorField::destroy() {
163 for (
int i=0; i<x[
nDim-1]; i++) memcpy(((
void**)
v)[i], ((
void**)src.
v)[i],
bytes);
194 errorQuda(
"Full spinor is not supported in alllocateGhostBuffer\n");
197 int X1 = this->x[0]*2;
201 int X5 = this->
nDim == 5 ? this->x[4] : 1;
203 int Vsh[4]={ X2*X3*X4*X5/2,
209 if(this->
nSpin == 1) num_faces = 3;
212 for (
int i=0; i<4; i++) {
213 size_t nbytes = num_faces*Vsh[i]*spinor_size;
228 for(
int i=0;i < 4; i++){
242 errorQuda(
"Full spinor is not supported in packGhost for cpu");
250 if(this->
nSpin == 1){
255 int X1 = this->x[0]*2;
259 int X5 = this->
nDim == 5 ? this->x[4]: 1;
262 for(
int i=0;i < this->
volume;i++){
278 x1odd = (x2 + x3 + x4 + x5 +
oddBit) & 1;
283 x1odd = (x2 + x3 + x4 +
oddBit) & 1;
297 ghost_face_idx = (x1*X5*X4*X3*X2 + x5*X4*X3*X2 + x4*(X3*
X2)+x3*X2 +x2)>>1;
298 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
301 if (x1 >=X1 - num_faces){
302 ghost_face_idx = ((x1-X1+num_faces)*X5*X4*X3*X2 + x5*X4*X3*X2 + x4*(X3*X2)+x3*X2 +
x2)>>1;
303 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
311 ghost_face_idx = (x2*X5*X4*X3*X1 +x5*X4*X3*X1 + x4*X3*X1+x3*X1+
x1)>>1;
312 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
315 if (x2 >= X2 - num_faces){
316 ghost_face_idx = ((x2-X2+num_faces)*X5*X4*X3*X1 +x5*X4*X3*X1+ x4*X3*X1+x3*X1+x1)>>1;
317 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
325 ghost_face_idx = (x3*X5*X4*X2*X1 + x5*X4*X2*X1 + x4*X2*X1+x2*X1+
x1)>>1;
326 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
329 if (x3 >= X3 - num_faces){
330 ghost_face_idx = ((x3-X3+num_faces)*X5*X4*X2*X1 + x5*X4*X2*X1 + x4*X2*X1 + x2*X1 + x1)>>1;
331 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
339 ghost_face_idx = (x4*X5*X3*X2*X1 + x5*X3*X2*X1 + x3*X2*X1+x2*X1+
x1)>>1;
340 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
343 if (x4 >= X4 - num_faces){
344 ghost_face_idx = ((x4-X4+num_faces)*X5*X3*X2*X1 + x5*X3*X2*X1 + x3*X2*X1+x2*X1+x1)>>1;
345 memcpy( ((
char*)ghost_spinor) + ghost_face_idx*spinor_size, ((
char*)
v)+i*spinor_size, spinor_size);
360 errorQuda(
"Full spinor is not supported in unpackGhost for cpu");
static int initGhostFaceBuffer
void allocateGhostBuffer(void)
int genericCompare(const cpuColorSpinorField &a, const cpuColorSpinorField &b, int tol)
void copy(const cpuColorSpinorField &)
QudaFieldOrder fieldOrder
void unpackGhost(void *ghost_spinor, const int dim, const QudaDirection dir, const int dagger)
cpuColorSpinorField(const cpuColorSpinorField &)
void Source(const QudaSourceType sourceType, const int st=0, const int s=0, const int c=0)
QudaDWFPCType DWFPCtype() const
void copyGenericColorSpinor(ColorSpinorField &dst, const ColorSpinorField &src, QudaFieldLocation location, void *Dst=0, void *Src=0, void *dstNorm=0, void *srcNorm=0)
void PrintVector(unsigned int x)
void packGhost(void *ghost_spinor, const int dim, const QudaDirection dir, const QudaParity parity, const int dagger)
enum QudaSourceType_s QudaSourceType
enum QudaDirection_s QudaDirection
static void * backGhostFaceSendBuffer[QUDA_MAX_DIM]
static void checkField(const ColorSpinorField &, const ColorSpinorField &)
#define ALIGNMENT_ADJUST(n)
static void * backGhostFaceBuffer[QUDA_MAX_DIM]
enum QudaParity_s QudaParity
void genericSource(cpuColorSpinorField &a, QudaSourceType sourceType, int x, int s, int c)
static void * fwdGhostFaceSendBuffer[QUDA_MAX_DIM]
static void freeGhostBuffer(void)
#define safe_malloc(size)
static void * fwdGhostFaceBuffer[QUDA_MAX_DIM]
static int Compare(const cpuColorSpinorField &a, const cpuColorSpinorField &b, const int resolution=1)
void genericPrintVector(cpuColorSpinorField &a, unsigned int x)
virtual ColorSpinorField & operator=(const ColorSpinorField &)
QudaFieldLocation Location() const
enum QudaFieldLocation_s QudaFieldLocation
void * memset(void *s, int c, size_t n)
virtual ~cpuColorSpinorField()
enum QudaFieldCreate_s QudaFieldCreate
void init(int argc, char **argv)
#define QUDA_MAX_DIM
Maximum number of dimensions supported by QUDA. In practice, no routines make use of more than 5...
QudaSiteSubset siteSubset
ColorSpinorField & operator=(const ColorSpinorField &)