Commit b65bcf0d authored by Matthias Redies's avatar Matthias Redies

remove MPI_Fence stuff

parent 37eca28c
......@@ -24,7 +24,6 @@ module m_eig66_data
END TYPE
TYPE, extends(t_data):: t_data_MPI
LOGICAL :: read_epoch = .false.
INTEGER :: n_size = 1
INTEGER :: size_k, size_eig
INTEGER :: eig_handle, zr_handle, zc_handle, neig_handle, w_iks_handle
......
......@@ -8,7 +8,7 @@ MODULE m_eig66_mpi
#endif
IMPLICIT NONE
PRIVATE
PUBLIC open_eig, read_eig, write_eig, close_eig, reset_eig, sync_eig
PUBLIC open_eig, read_eig, write_eig, close_eig, reset_eig
CONTAINS
SUBROUTINE priv_find_data(id, d)
......@@ -175,44 +175,23 @@ CONTAINS
pe = d%pe_basis(nk, jspin)
slot = d%slot_basis(nk, jspin)
IF (PRESENT(neig)) THEN
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(neig, 1, MPI_INTEGER, pe, slot, 1, MPI_INTEGER, d%neig_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%neig_handle, e)
! Get current values
CALL MPI_GET(neig, 1, MPI_INTEGER, pe, slot, 1, MPI_INTEGER, d%neig_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%neig_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%neig_handle, e)
! Get current values
CALL MPI_GET(neig, 1, MPI_INTEGER, pe, slot, 1, MPI_INTEGER, d%neig_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%neig_handle, e)
ENDIF
IF (PRESENT(eig) .OR. PRESENT(w_iks)) THEN
ALLOCATE (tmp_real(MIN(SIZE(eig), d%size_eig)))
IF (PRESENT(eig)) THEN
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%eig_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%eig_handle, e)
CALL MPI_GET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%eig_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%eig_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%eig_handle, e)
CALL MPI_GET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%eig_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%eig_handle, e)
eig(:SIZE(tmp_real)) = tmp_real
END IF
IF (PRESENT(w_iks)) THEN
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%w_iks_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%w_iks_handle, e)
CALL MPI_GET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%w_iks_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%w_iks_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%w_iks_handle, e)
CALL MPI_GET(tmp_real, SIZE(tmp_real), MPI_DOUBLE_PRECISION, pe, slot, SIZE(tmp_real), MPI_DOUBLE_PRECISION, d%w_iks_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%w_iks_handle, e)
w_iks(:SIZE(tmp_real)) = tmp_real
END IF
DEALLOCATE (tmp_real)
......@@ -233,47 +212,23 @@ CONTAINS
IF (zmat%l_real) THEN
IF (.NOT. d%l_real) THEN
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zc_handle, e)
CALL MPI_GET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zc_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zc_handle, e)
CALL MPI_GET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zc_handle, e)
!print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_cmplx(1)
zmat%data_r(:, n) = REAL(tmp_cmplx)
ELSE
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(tmp_real, tmp_size, MPI_DOUBLE_PRECISION, pe, slot, tmp_size, MPI_DOUBLE_PRECISION, d%zr_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zr_handle, e)
CALL MPI_GET(tmp_real, tmp_size, MPI_DOUBLE_PRECISION, pe, slot, tmp_size, MPI_DOUBLE_PRECISION, d%zr_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zr_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zr_handle, e)
CALL MPI_GET(tmp_real, tmp_size, MPI_DOUBLE_PRECISION, pe, slot, tmp_size, MPI_DOUBLE_PRECISION, d%zr_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zr_handle, e)
!print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_real(1)
zmat%data_r(:, n) = tmp_real
ENDIF
ELSE
IF (d%l_real) CALL judft_error("Could not read complex data, only real data is stored", calledby="eig66_mpi%read_eig")
IF (d%read_epoch) THEN
#ifdef CPP_MPI
CALL MPI_RGET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, req, e)
CALL MPI_WAIT(req, MPI_STATUS_IGNORE, e)
#endif
ELSE
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zc_handle, e)
CALL MPI_GET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zc_handle, e)
ENDIF
CALL MPI_WIN_LOCK(MPI_LOCK_SHARED, pe, 0, d%zc_handle, e)
CALL MPI_GET(tmp_cmplx, tmp_size, MPI_DOUBLE_COMPLEX, pe, slot, tmp_size, MPI_DOUBLE_COMPLEX, d%zc_handle, e)
CALL MPI_WIN_UNLOCK(pe, d%zc_handle, e)
!print *, nk,jspin,n1,"r PE:",pe," Slot: ",slot," Size:",tmp_size,tmp_cmplx(1)
zmat%data_c(:, n) = tmp_cmplx
ENDIF
......@@ -283,62 +238,6 @@ CONTAINS
#endif
END SUBROUTINE read_eig
SUBROUTINE sync_eig(id, fi, start_read_only)
use m_judft
#ifdef CPP_MPI
use mpi
#endif
type(t_fleurinput) :: fi
INTEGER, INTENT(IN) :: id
logical, intent(in) :: start_read_only
logical :: l_real, l_soc
TYPE(t_data_MPI), POINTER, ASYNCHRONOUS :: d
INTEGER:: err
#ifdef CPP_MPI
if(eig66_data_mode(id) == MPI_mode) then
CALL priv_find_data(id, d)
l_real=fi%sym%invs.AND..NOT.fi%noco%l_noco.AND..NOT.(fi%noco%l_soc.AND.fi%atoms%n_u+fi%atoms%n_hia>0)
l_soc =fi%noco%l_soc
IF (start_read_only) THEN
d%read_epoch = .TRUE.
CALL MPI_Win_fence(MPI_MODE_NOPUT, d%eig_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 6")
IF (l_real .AND. .NOT. l_soc) THEN
CALL MPI_Win_fence(MPI_MODE_NOPUT, d%zr_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 7")
ELSE
CALL MPI_Win_fence(MPI_MODE_NOPUT, d%zc_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 8")
ENDIF
CALL MPI_Win_fence(MPI_MODE_NOPUT, d%neig_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 9")
CALL MPI_Win_fence(MPI_MODE_NOPUT, d%w_iks_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 10")
ELSE
d%read_epoch = .FALSE.
CALL MPI_Win_fence(MPI_MODE_NOSTORE, d%eig_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 1")
IF (l_real .AND. .NOT. l_soc) THEN
CALL MPI_Win_fence(MPI_MODE_NOSTORE, d%zr_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 2")
ELSE
CALL MPI_Win_fence(MPI_MODE_NOSTORE, d%zc_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 3")
ENDIF
CALL MPI_Win_fence(MPI_MODE_NOSTORE, d%neig_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 4")
CALL MPI_Win_fence(MPI_MODE_NOSTORE, d%w_iks_handle, err)
if(err /= 0) call juDFT_error("MPI_Win_fence isn't happy. No. 5")
ENDIF
endif
#endif
END SUBROUTINE sync_eig
SUBROUTINE write_eig(id, nk, jspin, neig, neig_total, eig, w_iks, n_size, n_rank, zmat)
INTEGER, INTENT(IN) :: id, nk, jspin
INTEGER, INTENT(IN), OPTIONAL :: n_size, n_rank
......
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