Skip to content

Commit

Permalink
add ELPA
Browse files Browse the repository at this point in the history
  • Loading branch information
YaphetS-jx committed Dec 10, 2024
1 parent fc438c5 commit ab9d36b
Show file tree
Hide file tree
Showing 5 changed files with 297 additions and 5 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
-Date
-Name
-changes

--------------
Dec 10, 2024
Name: Xin Jing
Changes: (linearAlgebra.c, eigenSolver.c, eigenSovlerKpt.c)
1. Support ELPA
2. Fix a bug in initialization

--------------
Dec 4, 2024
Name: Lucas Timmerman
Expand Down
9 changes: 9 additions & 0 deletions src/include/linearAlgebra.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,13 @@ void pdgemm_subcomm(
int *descA, const double *B, int *descB, double beta, double *C, int *descC,
MPI_Comm comm, int max_nproc);

#ifdef USE_ELPA
void elpa_pdsygvx(
double *a, int desca[9], double *b, int descb[9], int nev, double *ev, double *z, MPI_Comm comm, int *ierr);
void elpa_pdsyevx(
double *a, int desca[9], int nev, double *ev, double *z, MPI_Comm comm, int *ierr);
void elpa_pzhegvx(
double _Complex *a, int desca[9], double _Complex *b, int descb[9], int nev, double *ev, double _Complex *z, MPI_Comm comm, int *ierr);
#endif

#endif // LINEARALGEBRA_H
17 changes: 16 additions & 1 deletion src/initialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ void Initialize(SPARC_OBJ *pSPARC, int argc, char *argv[]) {
if (rank == 0) printf("The dimension of subgrid for eigen sovler is (%d x %d).\n",
pSPARC->eig_paral_subdims[0], pSPARC->eig_paral_subdims[1]);
#endif

#ifdef USE_ELPA
// No processor can have zero data in ELPA
int maxdim = max(pSPARC->eig_paral_subdims[0], pSPARC->eig_paral_subdims[1]);
pSPARC->eig_paral_blksz = max(1,min(pSPARC->Nstates/maxdim, pSPARC->eig_paral_blksz));
// if (rank == 0) printf("eig_paral_blksz %d\n", pSPARC->eig_paral_blksz);
#endif
}
}

Expand Down Expand Up @@ -2601,6 +2608,14 @@ void SPARC_copy_input(SPARC_OBJ *pSPARC, SPARC_INPUT_OBJ *pSPARC_Input) {
}
}

#if defined(USE_ELPA)
#if !defined(USE_MKL) && !defined(USE_SCALAPACK)
if (rank == 0)
printf(RED "ERROR: To use ELPA, please turn on MKL or SCALAPACK in makefile!\n"RESET);
exit(EXIT_FAILURE);
#endif
#endif

#if !defined(USE_MKL) && !defined(USE_FFTW)
if (pSPARC->ixc[3] != 0){
if (rank == 0)
Expand Down Expand Up @@ -3649,7 +3664,7 @@ void write_output_init(SPARC_OBJ *pSPARC) {
}

fprintf(output_fp,"***************************************************************************\n");
fprintf(output_fp,"* SPARC (version Dec 4, 2024) *\n");
fprintf(output_fp,"* SPARC (version Dec 10, 2024) *\n");
fprintf(output_fp,"* Copyright (c) 2020 Material Physics & Mechanics Group, Georgia Tech *\n");
fprintf(output_fp,"* Distributed under GNU General Public License 3 (GPL) *\n");
fprintf(output_fp,"* Start time: %s *\n",c_time_str);
Expand Down
Loading

0 comments on commit ab9d36b

Please sign in to comment.