Commit 25905708 authored by Uliana Alekseeva's avatar Uliana Alekseeva

ELPA_2016.05.004 interface added

parent f049ac93
...@@ -30,11 +30,14 @@ LINK_LIBRARIES ${FLEUR_LIBRARIES}) ...@@ -30,11 +30,14 @@ LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_NEW ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_NEW.f90 try_compile(FLEUR_USE_ELPA_NEW ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_NEW.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES}) LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201605003 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605003.f90 try_compile(FLEUR_USE_ELPA_201605003 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605003.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES})
try_compile(FLEUR_USE_ELPA_201605004 ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/cmake/tests/test_ELPA_201605004.f90
LINK_LIBRARIES ${FLEUR_LIBRARIES}) LINK_LIBRARIES ${FLEUR_LIBRARIES})
message("Version check for ELPA:") message("Version check for ELPA:")
message("OLD ELPA : ${FLEUR_USE_ELPA_OLD}") message("OLD ELPA : ${FLEUR_USE_ELPA_OLD}")
message("NEW ELPA : ${FLEUR_USE_ELPA_NEW}") message("NEW ELPA : ${FLEUR_USE_ELPA_NEW}")
message("201605003 ELPA: ${FLEUR_USE_ELPA_201605003}") message("201605003 ELPA: ${FLEUR_USE_ELPA_201605003}")
message("201605004 ELPA: ${FLEUR_USE_ELPA_201605004}")
#Set preprocessor switches #Set preprocessor switches
if (FLEUR_USE_ELPA_OLD) if (FLEUR_USE_ELPA_OLD)
set(FLEUR_USE_ELPA TRUE) set(FLEUR_USE_ELPA TRUE)
...@@ -48,4 +51,8 @@ LINK_LIBRARIES ${FLEUR_LIBRARIES}) ...@@ -48,4 +51,8 @@ LINK_LIBRARIES ${FLEUR_LIBRARIES})
set(FLEUR_USE_ELPA TRUE) set(FLEUR_USE_ELPA TRUE)
set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605003") set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605003")
endif() endif()
if (FLEUR_USE_ELPA_201605004)
set(FLEUR_USE_ELPA TRUE)
set(FLEUR_MPI_DEFINITIONS ${FLEUR_MPI_DEFINITIONS} "CPP_ELPA" "CPP_ELPA2" "CPP_ELPA_201605004")
endif()
endif() endif()
program test
use elpa1
integer:: ierr,mpi_subcom, myrowblacs, mycolblacs
integer:: mpi_comm_rows,mpi_comm_cols,m,nb,myrowsssca,mycolssca
logical :: ok
real :: bsca(10,10),asca(10,10),eigvec(10)
ok= elpa_mult_at_b_real('U', 'L',m, m,bsca,myrowssca,mycolssca,asca,SIZE(asca,1),SIZE(asca,2),nb,&
mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca,mycolssca)
!ok=CHOLESKY_real (m,bsca,SIZE(bsca,1),nb,mycolssca,mpi_comm_rows,mpi_comm_cols,.false.)
end
...@@ -26,7 +26,11 @@ CONTAINS ...@@ -26,7 +26,11 @@ CONTAINS
#define CPP_transpose pdtran #define CPP_transpose pdtran
#define CPP_ONE 1.0 #define CPP_ONE 1.0
#define CPP_ZERO 0.0 #define CPP_ZERO 0.0
#ifdef CPP_ELPA_201605004
#define CPP_mult elpa_mult_at_b_real
#else
#define CPP_mult mult_at_b_real #define CPP_mult mult_at_b_real
#endif
#define CPP_REAL #define CPP_REAL
SUBROUTINE elpa_r(m, SUB_COMM, a,b, z,eig,num) SUBROUTINE elpa_r(m, SUB_COMM, a,b, z,eig,num)
! !
...@@ -63,7 +67,11 @@ CONTAINS ...@@ -63,7 +67,11 @@ CONTAINS
#define CPP_transpose pztranc #define CPP_transpose pztranc
#define CPP_ONE cmplx(1.,0.) #define CPP_ONE cmplx(1.,0.)
#define CPP_ZERO cmplx(0.,0.) #define CPP_ZERO cmplx(0.,0.)
#ifdef CPP_ELPA_201605004
#define CPP_mult mult_ah_b_complex #define CPP_mult mult_ah_b_complex
#else
#define CPP_mult mult_ah_b_complex
#endif
#undef CPP_REAL #undef CPP_REAL
SUBROUTINE elpa_c(m, SUB_COMM, a,b, z,eig,num) SUBROUTINE elpa_c(m, SUB_COMM, a,b, z,eig,num)
! !
...@@ -192,7 +200,7 @@ CONTAINS ...@@ -192,7 +200,7 @@ CONTAINS
!Create communicators for ELPA !Create communicators for ELPA
!print *,"creating ELPA comms" !print *,"creating ELPA comms"
#if (defined CPP_ELPA_201605003)||defined(CPP_ELPA_NEW) #if defined (CPP_ELPA_201605004) || defined (CPP_ELPA_201605003)||defined(CPP_ELPA_NEW)
ierr=get_elpa_row_col_comms(mpi_subcom, myrowblacs, mycolblacs,mpi_comm_rows, mpi_comm_cols) ierr=get_elpa_row_col_comms(mpi_subcom, myrowblacs, mycolblacs,mpi_comm_rows, mpi_comm_cols)
#else #else
CALL get_elpa_row_col_comms(mpi_subcom, myrowblacs, mycolblacs,mpi_comm_rows, mpi_comm_cols) CALL get_elpa_row_col_comms(mpi_subcom, myrowblacs, mycolblacs,mpi_comm_rows, mpi_comm_cols)
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
! Please note: cholesky_complex/invert_trm_complex are not trimmed for speed. ! Please note: cholesky_complex/invert_trm_complex are not trimmed for speed.
! The only reason having them is that the Scalapack counterpart ! The only reason having them is that the Scalapack counterpart
! PDPOTRF very often fails on higher processor numbers for unknown reasons! ! PDPOTRF very often fails on higher processor numbers for unknown reasons!
#ifdef CPP_ELPA_201605003 #if defined(CPP_ELPA_201605003) || defined(CPP_ELPA_201605004)
ok=CPP_CHOLESKY (m,bsca,SIZE(bsca,1),nb,mycolssca,mpi_comm_rows,mpi_comm_cols,.false.) ok=CPP_CHOLESKY (m,bsca,SIZE(bsca,1),nb,mycolssca,mpi_comm_rows,mpi_comm_cols,.false.)
ok=CPP_invert_trm(m,bsca,SIZE(bsca,1),nb,mycolssca,mpi_comm_rows,mpi_comm_cols,.false.) ok=CPP_invert_trm(m,bsca,SIZE(bsca,1),nb,mycolssca,mpi_comm_rows,mpi_comm_cols,.false.)
#elif defined CPP_ELPA_NEW #elif defined CPP_ELPA_NEW
...@@ -109,7 +109,10 @@ ...@@ -109,7 +109,10 @@
n_row = numroc (n_col, nb, myrow, 0, nprow) n_row = numroc (n_col, nb, myrow, 0, nprow)
asca(n_row+1:myrowssca,i) = eigvec(n_row+1:myrowssca,i) asca(n_row+1:myrowssca,i) = eigvec(n_row+1:myrowssca,i)
ENDDO ENDDO
#ifdef CPP_ELPA_201605003 #ifdef CPP_ELPA_201605004
ok=CPP_mult ('U', 'L',m, m,bsca,myrowssca,mycolssca,asca,SIZE(asca,1),SIZE(asca,2),nb,&
mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca,mycolssca)
#elif CPP_ELPA_201605003
ok=CPP_mult ('U', 'L',m, m,bsca,myrowssca,asca,SIZE(asca,1),nb, mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca) ok=CPP_mult ('U', 'L',m, m,bsca,myrowssca,asca,SIZE(asca,1),nb, mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca)
#else #else
CALL CPP_mult ('U', 'L',m, m,bsca,myrowssca,asca,SIZE(asca,1),nb, mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca) CALL CPP_mult ('U', 'L',m, m,bsca,myrowssca,asca,SIZE(asca,1),nb, mpi_comm_rows, mpi_comm_cols,eigvec,myrowssca)
...@@ -118,7 +121,10 @@ ...@@ -118,7 +121,10 @@
CALL CPP_transpose(m,m,CPP_ONE,eigvec,1,1,sc_desc,CPP_ZERO,tmp2,1,1,sc_desc) CALL CPP_transpose(m,m,CPP_ONE,eigvec,1,1,sc_desc,CPP_ZERO,tmp2,1,1,sc_desc)
! 2c. A = U**-T * tmp2 ( = U**-T * Aorig * U**-1 ) ! 2c. A = U**-T * tmp2 ( = U**-T * Aorig * U**-1 )
#ifdef CPP_ELPA_201605003 #ifdef CPP_ELPA_201605004
ok=CPP_mult ('U', 'U', m, m, bsca, SIZE(bsca,1),SIZE(bsca,2), tmp2,&
SIZE(tmp2,1),SIZE(tmp2,2),nb, mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1),SIZE(asca,2))
#elif CPP_ELPA_201605003
ok=CPP_mult ('U', 'U', m, m, bsca, SIZE(bsca,1), tmp2,& ok=CPP_mult ('U', 'U', m, m, bsca, SIZE(bsca,1), tmp2,&
SIZE(tmp2,1),nb, mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1)) SIZE(tmp2,1),nb, mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1))
#else #else
...@@ -144,7 +150,7 @@ ...@@ -144,7 +150,7 @@
! 3. Calculate eigenvalues/eigenvectors of U**-T * A * U**-1 ! 3. Calculate eigenvalues/eigenvectors of U**-T * A * U**-1
! Eigenvectors go to eigvec ! Eigenvectors go to eigvec
num2=num num2=num
#ifdef CPP_ELPA_201605003 #if defined(CPP_ELPA_201605003) || defined(CPP_ELPA_201605004)
#ifdef CPP_ELPA2 #ifdef CPP_ELPA2
ok=CPP_solve_evp_2stage(m,num2,asca,SIZE(asca,1),& ok=CPP_solve_evp_2stage(m,num2,asca,SIZE(asca,1),&
eig2,eigvec,SIZE(asca,1), nb,mycolssca, mpi_comm_rows, mpi_comm_cols,sub_comm) eig2,eigvec,SIZE(asca,1), nb,mycolssca, mpi_comm_rows, mpi_comm_cols,sub_comm)
...@@ -155,10 +161,10 @@ ...@@ -155,10 +161,10 @@
#elif defined CPP_ELPA_NEW #elif defined CPP_ELPA_NEW
#ifdef CPP_ELPA2 #ifdef CPP_ELPA2
err=CPP_solve_evp_2stage(m,num2,asca,SIZE(asca,1),& err=CPP_solve_evp_2stage(m,num2,asca,SIZE(asca,1),&
eig2,eigvec,SIZE(asca,1), nb,mycolssca, mpi_comm_rows, mpi_comm_cols,sub_comm) eig2,eigvec, SIZE(asca,1), nb,mycolssca, mpi_comm_rows, mpi_comm_cols,sub_comm)
#else #else
err=CPP_solve_evp(m, num2,asca,SIZE(asca,1),& err=CPP_solve_evp(m, num2,asca,SIZE(asca,1),&
eig2,eigvec, SIZE(asca,1), nb,mpi_comm_rows, mpi_comm_cols) eig2,eigvec, SIZE(asca,1), nb,mycolssca, mpi_comm_rows, mpi_comm_cols)
#endif #endif
#else #else
#ifdef CPP_ELPA2 #ifdef CPP_ELPA2
...@@ -175,7 +181,10 @@ ...@@ -175,7 +181,10 @@
! mult_ah_b_complex needs the transpose of U**-1, thus tmp2 = (U**-1)**T ! mult_ah_b_complex needs the transpose of U**-1, thus tmp2 = (U**-1)**T
CALL CPP_transpose(m,m,CPP_ONE,bsca,1,1,sc_desc,CPP_ZERO,tmp2,1,1,sc_desc) CALL CPP_transpose(m,m,CPP_ONE,bsca,1,1,sc_desc,CPP_ZERO,tmp2,1,1,sc_desc)
#ifdef CPP_ELPA_201605003 #ifdef CPP_ELPA_201605004
ok= CPP_mult ('L', 'N',m, num2, tmp2, SIZE(asca,1),SIZE(asca,2),&
eigvec, SIZE(asca,1),SIZE(asca,2),nb,mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1),SIZE(asca,2))
#elif CPP_ELPA_201605003
ok= CPP_mult ('L', 'N',m, num2, tmp2, SIZE(asca,1),& ok= CPP_mult ('L', 'N',m, num2, tmp2, SIZE(asca,1),&
eigvec, SIZE(asca,1),nb,mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1)) eigvec, SIZE(asca,1),nb,mpi_comm_rows, mpi_comm_cols, asca, SIZE(asca,1))
#else #else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment