Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions include/PLEGMA_Correlator.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ namespace plegma {
bool hasSource(int dir) const {
// Tells if the source is included in the local lattice for the given direction
if(dir<0 || dir>N_DIMS) return false;
return ((HGC_procPosition[dir]*HGC_localL[dir]) <= source[dir])
&& (source[dir] < ((HGC_procPosition[dir]+1)*HGC_localL[dir]));
return ((HGC.procPosition[dir]*HGC.localL[dir]) <= source[dir])
&& (source[dir] < ((HGC.procPosition[dir]+1)*HGC.localL[dir]));
}
bool hasSource() const {
bool ret=true;
Expand All @@ -53,15 +53,15 @@ namespace plegma {
int startT() const {
// Returns the starting point in time of the correlator wrt the source.
// Zero is returned if the local time slice is not used.
int start=(HGC_procPosition[DIM_T] * HGC_localL[DIM_T] + HGC_totalL[DIM_T] - source[DIM_T] )
% HGC_totalL[DIM_T];
int start=(HGC.procPosition[DIM_T] * HGC.localL[DIM_T] + HGC.totalL[DIM_T] - source[DIM_T] )
% HGC.totalL[DIM_T];
return (start>=totalT) ? 0 : start;
}
int endT() const {
// Returns the end point
int start = startT();
if(start>0)
return std::min(totalT, HGC_localL[DIM_T]+start);
return std::min(totalT, HGC.localL[DIM_T]+start);
else
return 0;
}
Expand All @@ -71,18 +71,18 @@ namespace plegma {
// When the source is in the local lattice we may have two pieces:
// |--> s | from startT to endT
// | s-->| from the source to the end
int t_source = source[DIM_T]%HGC_localL[DIM_T];
return endT() - startT() + std::min(totalT, HGC_localL[DIM_T]-t_source);
int t_source = source[DIM_T]%HGC.localL[DIM_T];
return endT() - startT() + std::min(totalT, HGC.localL[DIM_T]-t_source);
} else {
return endT() - startT();
}
}

PLEGMA_Correlator(CORR_SPACE corr_space, site source, int Q2_max = 0, int totalT=HGC_totalL[DIM_T]):
PLEGMA_Correlator(CORR_SPACE corr_space, site source, int Q2_max = 0, int totalT=HGC.totalL[DIM_T]):
source(source), totalT(totalT), corr_space(corr_space), corr_pos_space(nullptr),
corr_mom_space(corr_space==MOMENTUM_SPACE ?
new PLEGMA_FT<Float>(Q2_max, 3, false, localT()) : nullptr),
comm(new MPI_Comm(HGC_fullComm)) { }
comm(new MPI_Comm(HGC.fullComm)) { }

~PLEGMA_Correlator() {}

Expand Down
14 changes: 7 additions & 7 deletions include/PLEGMA_FT.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ namespace plegma {
@params bool accum = false: In case we want to accumulation results from each transformation on the class buffer
@params bool dimT = HGC_localL[DIM_T]: Size of the time dimension in case we want to transform only part of the vector
**/
PLEGMA_FT(int Q2_max, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT(int Q2_max, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);
/**
@brief Constructor of the FT class with specific momentum vector
@params std::vector<int> mom: Momentum vector, either 3 or 4 components based on the choice of D3D4
@params int D3D4 = 3: The dimensionality of the FT, either 3 or 4 dimensions are supported
@params bool accum = false: In case we want to accumulation results from each transformation on the class buffer
@params bool dimT = HGC_localL[DIM_T]: Size of the time dimension in case we want to transform only part of the vector
**/
PLEGMA_FT(std::vector<int> mom, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT(std::vector<int> mom, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

PLEGMA_FT( std::vector<std::vector<int>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT( std::vector<std::vector<int>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

PLEGMA_FT(std::vector<float> mom, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT(std::vector<float> mom, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

PLEGMA_FT( std::vector<std::vector<float>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT( std::vector<std::vector<float>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

PLEGMA_FT(std::vector<double> mom, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT(std::vector<double> mom, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

PLEGMA_FT( std::vector<std::vector<double>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC_localL[DIM_T]);
PLEGMA_FT( std::vector<std::vector<double>> &moms, int D3D4 = 3, bool accum = false, int dimT = HGC.localL[DIM_T]);

~PLEGMA_FT() {};

Expand Down
10 changes: 5 additions & 5 deletions include/PLEGMA_Field.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ namespace plegma {
@param isPinnedHost: see "isPinnedHost"
@param checkErr: see "checkErr"
*/
PLEGMA_Field(ALLOCATION_FLAG alloc_flag, int site_size, size_t localV = HGC_localVolume, GHOST_FLAG ghost_flag=NO_GHOSTS, bool isPinnedHost = false, bool checkErr = true);
PLEGMA_Field(ALLOCATION_FLAG alloc_flag, int site_size, size_t localV = HGC.localVolume, GHOST_FLAG ghost_flag=NO_GHOSTS, bool isPinnedHost = false, bool checkErr = true);
/**
@brief virtual destructor responsible for freeing memory. Virtual because it could be called from an instance of a derived class through a pointer to base class
*/
Expand Down Expand Up @@ -393,7 +393,7 @@ namespace plegma {
}

virtual bool includesActiveTimeSlice() const{return true;}
virtual bool is4D() const{assert(Total_length()==HGC_localVolume); return true;}
virtual bool is4D() const{assert(Total_length()==HGC.localVolume); return true;}
};


Expand All @@ -409,11 +409,11 @@ namespace plegma {
PLEGMA_Field3D(ALLOCATION_FLAG alloc_flag, CLASS_ENUM classT, GHOST_FLAG ghost_flag=NO_GHOSTS, bool isPinnedHost = false, bool checkErr = true) :
PLEGMA_Field<Float>(alloc_flag, classT, ghost_flag, isPinnedHost, checkErr), activeTimeSlice(false) { }
PLEGMA_Field3D(ALLOCATION_FLAG alloc_flag, int site_size, GHOST_FLAG ghost_flag=NO_GHOSTS, bool isPinnedHost = false, bool checkErr = true) :
PLEGMA_Field<Float>(alloc_flag, site_size, HGC_localVolume3D, ghost_flag, isPinnedHost, checkErr), activeTimeSlice(false) { }
PLEGMA_Field3D() : PLEGMA_Field<Float>(NONE, 0, HGC_localVolume3D), activeTimeSlice(false) { }
PLEGMA_Field<Float>(alloc_flag, site_size, HGC.localVolume3D, ghost_flag, isPinnedHost, checkErr), activeTimeSlice(false) { }
PLEGMA_Field3D() : PLEGMA_Field<Float>(NONE, 0, HGC.localVolume3D), activeTimeSlice(false) { }

virtual bool includesActiveTimeSlice() const{return activeTimeSlice;}
virtual bool is4D() const{assert(this->Total_length()==HGC_localVolume3D); return false;}
virtual bool is4D() const{assert(this->Total_length()==HGC.localVolume3D); return false;}

template<typename FloatIn>
void copy(PLEGMA_Field3D<FloatIn> &f, ALLOCATION_FLAG where=DEVICE) {
Expand Down
16 changes: 8 additions & 8 deletions include/PLEGMA_Hprobing.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ namespace plegma {
int* arrlc; // array to hold the elementary coloring block
void createElemColBlock(){for(int i = 0; i < Nc; i++) arrlc[i]=i;}
void createColLattice(){
std::vector<int> lL = {HGC_localL[0], HGC_localL[1], HGC_localL[2], HGC_localL[3]};
std::vector<int> lL = {HGC.localL[0], HGC.localL[1], HGC.localL[2], HGC.localL[3]};
std::vector<int> lu = {Lu,Lu,Lu,Lu};
std::vector<int> bx(d);
std::vector<int> lx(d);
for(size_t i=0; i < HGC_localVolume; i++){
for(size_t i=0; i < HGC.localVolume; i++){
std::vector<int> x = getIndToVec(i,lL);
for(int j = 0 ; j < d; j++) bx[j] = x[j]/lu[j];
int eo=0;
Expand All @@ -78,7 +78,7 @@ namespace plegma {
// void checkColoring();
public:
PLEGMA_Hprobing(int k_probing, int d=4):k(k_probing),Nc(0),d(d),D(0),Lu(0),h_arrVc(nullptr),d_arrVc(nullptr),arrlc(nullptr){
if(!HGC_init_PLEGMA_flag){ fprintf(stderr, "Error PLEGMA should be initialized before use this class"); exit(-1);}
if(!HGC.init_PLEGMA_flag){ fprintf(stderr, "Error PLEGMA should be initialized before use this class"); exit(-1);}
if(d != 4) PLEGMA_error("Hierarchical probing supports only 4D coloring up to now");
if(k<=0) PLEGMA_error("The index of the Hprobing should greater than zero");
Nc = 2*std::pow(2,d*(k-1));
Expand All @@ -88,12 +88,12 @@ namespace plegma {
PLEGMA_printf("Distance of neigbors is %d\n",D);
PLEGMA_printf("The extent of the elementary symmetric color block is %d\n",Lu);
for(int i = 0 ; i < d ; i++){
if(D >= HGC_localL[i]) PLEGMA_error("The coloring distance is larger than the lattice extent in direction %d\n",i);
if( (HGC_localL[i] % (2*Lu)) != 0 )
if(D >= HGC.localL[i]) PLEGMA_error("The coloring distance is larger than the lattice extent in direction %d\n",i);
if( (HGC.localL[i] % (2*Lu)) != 0 )
PLEGMA_error("2*Lu cannot fit in the local lattice extent in direction %d. Try to increase local size in this direction",i);
}
try{
h_arrVc = new int[HGC_localVolume];
h_arrVc = new int[HGC.localVolume];
arrlc = new int[Nc];
}
catch (const std::bad_alloc& err) {
Expand All @@ -102,9 +102,9 @@ namespace plegma {
createElemColBlock();
createColLattice();
// if(check)checkColoring();
d_arrVc=(int*)device_malloc(HGC_localVolume*sizeof(int));
d_arrVc=(int*)device_malloc(HGC.localVolume*sizeof(int));
// checkQudaError();
qudaMemcpy(d_arrVc, h_arrVc, HGC_localVolume*sizeof(int), qudaMemcpyHostToDevice);
qudaMemcpy(d_arrVc, h_arrVc, HGC.localVolume*sizeof(int), qudaMemcpyHostToDevice);
// checkQudaError();
}
~PLEGMA_Hprobing(){
Expand Down
8 changes: 4 additions & 4 deletions include/PLEGMA_ScattCorrelator.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ namespace plegma {
public:
// these constructors does NOT ALLOCATE the memory PLEGMA_ScattCorrelator here, because
// the dimension is not provided. It will be allocated when used.
PLEGMA_ScattCorrelator(site source, int Q2_max, int totalT=HGC_totalL[DIM_T]);
PLEGMA_ScattCorrelator(site source, int Q2_max, int totalT=HGC.totalL[DIM_T]);

PLEGMA_ScattCorrelator(site source, std::vector<int> fixMomVec, int totalT=HGC_totalL[DIM_T]);
PLEGMA_ScattCorrelator(site source, std::vector<int> fixMomVec, int totalT=HGC.totalL[DIM_T]);

PLEGMA_ScattCorrelator(site source, std::vector<std::vector<int>> fixMomsVec, int totalT=HGC_totalL[DIM_T]);
PLEGMA_ScattCorrelator(site source, std::vector<std::vector<int>> fixMomsVec, int totalT=HGC.totalL[DIM_T]);

PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT=HGC_totalL[DIM_T]);
PLEGMA_ScattCorrelator(site source, momList &listmom, int totalT=HGC.totalL[DIM_T]);

~PLEGMA_ScattCorrelator(){;}

Expand Down
4 changes: 2 additions & 2 deletions include/PLEGMA_Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ namespace plegma {
}

void pointSource(const site& sourceposition, int spin, int color, ALLOCATION_FLAG alloc_flag=EVERY){
int my_it = sourceposition[DIM_T] - HGC_procPosition[DIM_T] * HGC_localL[DIM_T];
this->activeTimeSlice = (my_it >= 0) && ( my_it < HGC_localL[DIM_T] );
int my_it = sourceposition[DIM_T] - HGC.procPosition[DIM_T] * HGC.localL[DIM_T];
this->activeTimeSlice = (my_it >= 0) && ( my_it < HGC.localL[DIM_T] );
return ((PLEGMA_Vector<Float>*) this)->pointSource(sourceposition,spin,color,alloc_flag);
}

Expand Down
17 changes: 11 additions & 6 deletions include/PLEGMA_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,30 @@ using namespace std::chrono_literals;
using namespace quda;

namespace plegma {
//======== PLEGMA_printf, PLEGMA_error, PLEGMA_warning =========//

//======== PLEGMA_printf, PLEGMA_error, PLEGMA_warning =========//
#include <global/PLEGMA_prints.hpp>

//======== Enumerations =========//
#include <global/PLEGMA_enums.h>

//======== Templated types and functions =========//
//======== Templated types and functions =========//
#include <global/PLEGMA_templates.h>

//======== Some custom data struct =========//
#include <global/PLEGMA_structs.h>

//======== Class for reading options from command line or file =========//
//======== Class for reading options from command line or file =========//
#include <global/PLEGMA_Options.h>

//======== Some custom data struct =========//
#include <global/PLEGMA_structs.h>

//======== Global constants on host and device =========//
#include <global/PLEGMA_global_constants.h>






static inline void PLEGMA_memset(void *ptr, int value, size_t count){
return qudaMemset(ptr,value,count);
}
Expand Down
16 changes: 8 additions & 8 deletions include/PLEGMA_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ namespace plegma {
returnT writeFile(std::string filename, FILE_FORMAT format, argsT ... args) const {
switch (format) {
case ASCII_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to write file %s in ASCII format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to write file %s in ASCII format\n",filename.c_str());
return writeASCII(filename, args...);
case HDF5_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to write file %s in HDF5 format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to write file %s in HDF5 format\n",filename.c_str());
return writeHDF5(filename, args...);
case LIME_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to write file %s in LIME format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to write file %s in LIME format\n",filename.c_str());
return writeLIME(filename, args...);
case DEFAULT_FORMAT:
default:
if(HGC_verbosity > 1) PLEGMA_printf("Going to write file %s in DEFAULT format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to write file %s in DEFAULT format\n",filename.c_str());
return writeDEFAULT(filename, args...);
}
}
Expand Down Expand Up @@ -91,17 +91,17 @@ namespace plegma {
returnT readFile(std::string filename, FILE_FORMAT format, argsT ... args) {
switch (format) {
case ASCII_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to read file %s in ASCII format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to read file %s in ASCII format\n",filename.c_str());
return readASCII(filename, args...);
case HDF5_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to read file %s in HDF5 format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to read file %s in HDF5 format\n",filename.c_str());
return readHDF5(filename, args...);
case LIME_FORMAT:
if(HGC_verbosity > 1) PLEGMA_printf("Going to read file %s in LIME format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to read file %s in LIME format\n",filename.c_str());
return readLIME(filename, args...);
case DEFAULT_FORMAT:
default:
if(HGC_verbosity > 1) PLEGMA_printf("Going to read file %s in DEFAULT format\n",filename.c_str());
if(HGC.verbosity > 1) PLEGMA_printf("Going to read file %s in DEFAULT format\n",filename.c_str());
return readDEFAULT(filename, args...);
}
}
Expand Down
5 changes: 3 additions & 2 deletions include/global/PLEGMA_Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,10 @@ class Options : public Arguments{
args.erase(args.begin()+i);
countF++;
}
if(countF == 0) { if(visualize>1) print(name,p1,par...); return false; }
if(countF == 0) { //if(visualize>1) print(name,p1,par...);
return false; }
else{
if(visualize)print(name,p1,par...);
//if(visualize)print(name,p1,par...);
listSetOpt.push_back(name);
if(countF>1) PLEGMA_printf("Warning: [%s] found %d times in the arguments. Last occurance is considered", name.c_str(), countF);
return true;
Expand Down
Loading