47 unsigned int i, nRepeatCount = 1;
51 double *pKValue[3] = {NULL, NULL, NULL};
61 MPI_Comm_size(MPI_COMM_WORLD, &world_size);
62 MPI_Comm_rank(MPI_COMM_WORLD, &rank);
77 system("rmdir /s /q result");
79 system(
"rm -rf result");
84 if(omp_get_num_threads() > 1)
86 if(omp_get_thread_num() == 0)
104 #ifndef DISABLE_MPI_ROUTINE
109 gethostname(host_name, 256);
116 double *local_real = NULL;
117 double *local_imaginary = NULL;
118 unsigned int *local_row = NULL;
119 unsigned int *local_col = NULL;
120 unsigned int local_size = 0;
121 unsigned int local_row_size = 0;
122 unsigned int local_col_size = 0;
124 double *left_real = NULL;
125 double *left_imaginary = NULL;
126 unsigned int *left_row = NULL;
127 unsigned int *left_col = NULL;
128 unsigned int left_size = 0;
129 unsigned int left_row_size = 0;
130 unsigned int left_col_size = 0;
132 double *right_real = NULL;
133 double *right_imaginary = NULL;
134 unsigned int *right_row = NULL;
135 unsigned int *right_col = NULL;
136 unsigned int right_size = 0;
137 unsigned int right_row_size = 0;
138 unsigned int right_col_size = 0;
149 local_row_size = plocalH->
m_vectRow.size();
151 #pragma offload_transfer target(mic:phi_tid) \
152 nocopy(local_real[0:local_size] : ALLOC) \
153 nocopy(local_imaginary[0:local_size] : ALLOC) \
154 nocopy(local_row[0:local_row_size] : ALLOC) \
155 nocopy(local_col[0:local_col_size] : ALLOC)
162 left_row_size = plocalHm1->
m_vectRow.size();
164 #pragma offload_transfer target(mic:phi_tid) \
165 nocopy(left_real[0:left_size] : ALLOC) \
166 nocopy(left_imaginary[0:left_size] : ALLOC) \
167 nocopy(left_row[0:left_row_size] : ALLOC) \
168 nocopy(left_col[0:left_col_size] : ALLOC)
184 right_row_size = plocalHp1->
m_vectRow.size();
186 #pragma offload_transfer target(mic:phi_tid) \
187 nocopy(right_real[0:right_size] : ALLOC) \
188 nocopy(right_imaginary[0:right_size] : ALLOC) \
189 nocopy(right_row[0:right_row_size] : ALLOC) \
190 nocopy(right_col[0:right_col_size] : ALLOC)
196 local_row = pHamiltonian->
m_vectRow.data();
199 local_row_size = pHamiltonian->
m_vectRow.size();
201 #pragma offload_transfer target(mic:phi_tid) \
202 nocopy(local_real[0:local_size] : ALLOC) \
203 nocopy(local_imaginary[0:local_size] : ALLOC) \
204 nocopy(local_row[0:local_row_size] : ALLOC) \
205 nocopy(local_col[0:local_col_size] : ALLOC)
213 #pragma offload_transfer target(mic:phi_tid) \
214 in(local_real[0:local_size] : REUSE) \
215 in(local_imaginary[0:local_size] : REUSE) \
216 in(local_row[0:local_row_size] : REUSE) \
217 in(local_col[0:local_col_size] : REUSE)
219 #pragma offload_transfer target(mic:phi_tid) \
220 in(left_real[0:left_size] : REUSE) \
221 in(left_imaginary[0:left_size] : REUSE) \
222 in(left_row[0:left_row_size] : REUSE) \
223 in(left_col[0:left_col_size] : REUSE)
225 #pragma offload_transfer target(mic:phi_tid) \
226 in(right_real[0:right_size] : REUSE) \
227 in(right_imaginary[0:right_size] : REUSE) \
228 in(right_row[0:right_row_size] : REUSE) \
229 in(right_col[0:right_col_size] : REUSE)
233 #pragma offload_transfer target(mic:phi_tid) \
234 in(local_real[0:local_size] : REUSE) \
235 in(local_imaginary[0:local_size] : REUSE) \
236 in(local_row[0:local_row_size] : REUSE) \
237 in(local_col[0:local_col_size] : REUSE)
284 #pragma offload_transfer target(mic:phi_tid) \
285 nocopy(local_real : FREE) \
286 nocopy(local_imaginary : FREE) \
287 nocopy(local_row : FREE) \
288 nocopy(local_col : FREE)
290 #pragma offload_transfer target(mic:phi_tid) \
291 nocopy(left_real : FREE) \
292 nocopy(left_imaginary : FREE) \
293 nocopy(left_row : FREE) \
294 nocopy(left_col : FREE)
296 #pragma offload_transfer target(mic:phi_tid) \
297 nocopy(right_real : FREE) \
298 nocopy(right_imaginary : FREE) \
299 nocopy(right_row : FREE) \
300 nocopy(right_col : FREE)
304 #pragma offload_transfer target(mic:phi_tid) \
305 nocopy(local_real : FREE) \
306 nocopy(local_imaginary : FREE) \
307 nocopy(local_row : FREE) \
308 nocopy(local_col : FREE)
unsigned int nLanczosIterationCount
static void InitCommunicationBufferMetric()
Initializing MPI Communication buffer for MVMul.
static void ShowMsg(char *pszBuffer)
Show message.
unsigned int nCheckEigenvalueInterval
static void SetMPIEnviroment(int nRank, int nTotalNode)
Set MPI Enviroment.
static CKNLanczosMethod::LPEIGENVALUE_RESULT LaunchingLanczos(CKNMatrixOperation::CKNCSR *pA, bool bShowMsg, LPLANCZOS_PARAM lpParam, bool bMPI)
Lanczos API entry function.
static void MergeDegeneratedEigenvalues(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, unsigned int nFindingDegeneratedEVCount, CKNMatrixOperation::CKNCSR *pA, CKNMatrixOperation::CKNCSR *pLocalBlock, CKNMatrixOperation::CKNCSR *pLeftBlock, CKNMatrixOperation::CKNCSR *pRightBlock)
Merging eigenvalue into mater group.
static bool InitLevel(int nMPILevel, int nFindingDegeneratedEVCount)
Init MPI Level, most low level is for multi node cacluation for Lanczos.
unsigned int GetNoneZeroCount()
Getting numbers of none zero elements.
double_vector_t m_vectValueRealBuffer
A member variable for saving none zero elements.
Show message and debugging variable.
bool bCalculateWaveFunction
Data and operation representation of CSR(Compressed Sparse Row)
This class for doing Lanczos method.
This class for parsing input command file.
Lanczos method result audit class.
double_vector_t m_vectValueImaginaryBuffer
A member variable for saving none zero elements.
static int GetTotalNodeCount()
#define CALCULATION_SUCCESS
Return code at main loop, every steps completed.
#define SHOW_SIMPLE_MSG(message)
uint_vector_t m_vectColumn
A member variable for saving column information.
static void RecalcuWaveFunction(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult)
Recalculating wavefunction after merging degenerated eigenvalues.
unsigned int nFindingEigenValueCount
unsigned int nMPILevel
MPI Grouping level.
static void SaveLanczosResult(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, bool bCalcuEigenvalue, bool bWaveFunction, double *pKValue, int nRepeatCount)
Saving Lanczos computation result into file.
static void SetShow(bool bShow)
Common definition for Solver.
Structure for engienvalue computing.
static void UpdateLocalCSR(CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)
This class includes functions for matrix debugging.
double fConvergeceCriteria
LPEIGENVALUE_RESULT DoLanczosMethod(CKNMatrixOperation::CKNCSR *pAMatrix, unsigned int nIterationCount, unsigned int nEigenValueCheckInterval, unsigned int nEigenValueCount, double fEigenvalueMin, double fEignevalueMax, double fConvergenceTolerance, bool bReorthogonalization, bool bCalcuEigVector, bool bWaveFunction, double load_in_MIC, CKNMatrixOperation::CKNCSR *pmylocalblock=NULL, CKNMatrixOperation::CKNCSR *leftlocalblock=NULL, CKNMatrixOperation::CKNCSR *rightlocalblock=NULL)
Doing lanczos method.
This class includes functions for matrix debugging.
static int GetCurrentRank()
static void TotalMeasurementEnd()
Measurement end for total taken time.
static void BuildLocalCSR(CKNMatrixOperation::CKNCSR *source, CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)
bool bDoSelectiveReorthogonalization
static void TotalMeasurementStart()
Measurement start for total taken time.
static void AllocateLocalCSR(CKNMatrixOperation::CKNCSR **mine, CKNMatrixOperation::CKNCSR **left, CKNMatrixOperation::CKNCSR **right)
static bool IsRootRank()
Get Total node count.
uint_vector_t m_vectRow
A member variable for saving row information.
unsigned int nFindingDegeneratedEVCount
Degenerated eigenvalue count for want to find.
bool bCalculateEigenVectors
static bool IsMultiLevelMPI()
Get MPI_Comm.
Structure for Lanczos parameters.
static void InitTimer()
Init time related variable.
static void ShowLanczosResult(CKNLanczosMethod::LPEIGENVALUE_RESULT lpResult, bool bCalculateEigenVectors, bool bCalculateWaveFunction, double *pKValue, int nRepeatCount)
Save calculating result into file.
static void FreeLocalCSR(CKNMatrixOperation::CKNCSR *mine, CKNMatrixOperation::CKNCSR *left, CKNMatrixOperation::CKNCSR *right)