Commit bde76c45 authored by Victor Yu's avatar Victor Yu

Avoid MPI_Allreduce in elsi_get_entropy

When using PEXSI, there was an `MPI_Allreduce` in `elsi_get_entropy`,
which means that `elsi_get_entropy` must be called by all MPI ranks.
This all reduce is now performed right after the PEXSI solver finishes
instead of when `elsi_get_entropy` is called.
parent 12f29e16
......@@ -7,7 +7,7 @@ SET(elsi_URL "http://elsi-interchange.org")
SET(elsi_EMAIL "elsi-team@duke.edu")
SET(elsi_LICENSE "BSD 3")
SET(elsi_DESCRIPTION "Electronic Structure Infrastructure")
SET(elsi_DATESTAMP "20200528")
SET(elsi_DATESTAMP "20200609")
### CMake modules ###
LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
......
......@@ -259,10 +259,6 @@ subroutine elsi_get_entropy(eh,entropy)
entropy = eh%ph%ts
if(eh%ph%solver == PEXSI_SOLVER .and. eh%ph%pexsi_options%method /= 2) then
call elsi_reduce_energy(eh%ph,eh%bh,entropy)
end if
end subroutine
!>
......
......@@ -15,7 +15,7 @@ module ELSI_PEXSI
use ELSI_MPI, only: MPI_SUM,MPI_REAL8,MPI_COMPLEX16
use ELSI_OUTPUT, only: elsi_say,elsi_get_time
use ELSI_PRECISION, only: r8,i4
use ELSI_UTIL, only: elsi_check_err
use ELSI_UTIL, only: elsi_check_err,elsi_reduce_energy
use F_PPEXSI_INTERFACE, only: f_ppexsi_plan_initialize,&
f_ppexsi_plan_finalize,f_ppexsi_set_default_options,&
f_ppexsi_load_real_hs_matrix,f_ppexsi_load_complex_hs_matrix,&
......@@ -445,7 +445,11 @@ subroutine elsi_solve_pexsi_real(ph,bh,row_ind,col_ptr,ne_vec,ham,ovlp,dm)
! Compute entropy
if(ph%pexsi_options%method /= 2) then
ph%ts = ph%ebs-free_energy-ph%mu*ph%n_electrons
local_energy = ph%ebs-free_energy-ph%mu*ph%n_electrons
call elsi_reduce_energy(ph,bh,local_energy)
ph%ts = local_energy
end if
call elsi_get_time(t1)
......@@ -922,7 +926,11 @@ subroutine elsi_solve_pexsi_cmplx(ph,bh,row_ind,col_ptr,ne_vec,ham,ovlp,dm)
! Compute entropy
if(ph%pexsi_options%method /= 2) then
ph%ts = ph%ebs-free_energy-ph%mu*ph%n_electrons
local_energy = ph%ebs-free_energy-ph%mu*ph%n_electrons
call elsi_reduce_energy(ph,bh,local_energy)
ph%ts = local_energy
end if
call elsi_get_time(t1)
......
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