Skip to content

Commit 065a1a3

Browse files
Merge pull request #237 from YaphetS-jx/dev
2 parents 6b53441 + ab9d36b commit 065a1a3

File tree

5 files changed

+299
-9
lines changed

5 files changed

+299
-9
lines changed

ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
-Date
33
-Name
44
-changes
5+
6+
--------------
7+
Dec 10, 2024
8+
Name: Xin Jing
9+
Changes: (linearAlgebra.c, eigenSolver.c, eigenSovlerKpt.c)
10+
1. Support ELPA
11+
2. Fix a bug in initialization
12+
513
--------------
614
Dec 4, 2024
715
Name: Lucas Timmerman

src/include/linearAlgebra.h

+9
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,13 @@ void pdgemm_subcomm(
145145
int *descA, const double *B, int *descB, double beta, double *C, int *descC,
146146
MPI_Comm comm, int max_nproc);
147147

148+
#ifdef USE_ELPA
149+
void elpa_pdsygvx(
150+
double *a, int desca[9], double *b, int descb[9], int nev, double *ev, double *z, MPI_Comm comm, int *ierr);
151+
void elpa_pdsyevx(
152+
double *a, int desca[9], int nev, double *ev, double *z, MPI_Comm comm, int *ierr);
153+
void elpa_pzhegvx(
154+
double _Complex *a, int desca[9], double _Complex *b, int descb[9], int nev, double *ev, double _Complex *z, MPI_Comm comm, int *ierr);
155+
#endif
156+
148157
#endif // LINEARALGEBRA_H

src/initialization.c

+18-5
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,13 @@ void Initialize(SPARC_OBJ *pSPARC, int argc, char *argv[]) {
429429
if (rank == 0) printf("The dimension of subgrid for eigen sovler is (%d x %d).\n",
430430
pSPARC->eig_paral_subdims[0], pSPARC->eig_paral_subdims[1]);
431431
#endif
432+
433+
#ifdef USE_ELPA
434+
// No processor can have zero data in ELPA
435+
int maxdim = max(pSPARC->eig_paral_subdims[0], pSPARC->eig_paral_subdims[1]);
436+
pSPARC->eig_paral_blksz = max(1,min(pSPARC->Nstates/maxdim, pSPARC->eig_paral_blksz));
437+
// if (rank == 0) printf("eig_paral_blksz %d\n", pSPARC->eig_paral_blksz);
438+
#endif
432439
}
433440
}
434441

@@ -2601,6 +2608,14 @@ void SPARC_copy_input(SPARC_OBJ *pSPARC, SPARC_INPUT_OBJ *pSPARC_Input) {
26012608
}
26022609
}
26032610

2611+
#if defined(USE_ELPA)
2612+
#if !defined(USE_MKL) && !defined(USE_SCALAPACK)
2613+
if (rank == 0)
2614+
printf(RED "ERROR: To use ELPA, please turn on MKL or SCALAPACK in makefile!\n"RESET);
2615+
exit(EXIT_FAILURE);
2616+
#endif
2617+
#endif
2618+
26042619
#if !defined(USE_MKL) && !defined(USE_FFTW)
26052620
if (pSPARC->ixc[3] != 0){
26062621
if (rank == 0)
@@ -3649,7 +3664,7 @@ void write_output_init(SPARC_OBJ *pSPARC) {
36493664
}
36503665

36513666
fprintf(output_fp,"***************************************************************************\n");
3652-
fprintf(output_fp,"* SPARC (version Dec 4, 2024) *\n");
3667+
fprintf(output_fp,"* SPARC (version Dec 10, 2024) *\n");
36533668
fprintf(output_fp,"* Copyright (c) 2020 Material Physics & Mechanics Group, Georgia Tech *\n");
36543669
fprintf(output_fp,"* Distributed under GNU General Public License 3 (GPL) *\n");
36553670
fprintf(output_fp,"* Start time: %s *\n",c_time_str);
@@ -4281,8 +4296,7 @@ void SPARC_Input_MPI_create(MPI_Datatype *pSPARC_INPUT_MPI) {
42814296
MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE,
42824297
MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE, MPI_DOUBLE,
42834298
MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR,
4284-
MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR,
4285-
MPI_CHAR};
4299+
MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR, MPI_CHAR};
42864300
int blens[N_MEMBR] = {3, 3, 7, /* int array */
42874301
1, 1, 1, 1, 1,
42884302
1, 1, 1, 1, 1,
@@ -4325,8 +4339,7 @@ void SPARC_Input_MPI_create(MPI_Datatype *pSPARC_INPUT_MPI) {
43254339
1, 1, 1, 1, 1,
43264340
1, /* double */
43274341
32, 32, 32, L_STRING, L_STRING, /* char */
4328-
L_STRING, L_STRING, L_STRING, L_STRING,
4329-
L_STRING};
4342+
L_STRING, L_STRING, L_STRING, L_STRING, L_STRING};
43304343

43314344
// calculating offsets in an architecture independent manner
43324345
MPI_Aint addr[N_MEMBR],disps[N_MEMBR], base;

0 commit comments

Comments
 (0)