Commit c82f869e authored by Matthias Redies's avatar Matthias Redies

fix for too may communicators error

parent 62febca6
......@@ -44,7 +44,6 @@ CONTAINS
USE m_unfold_band_kpts !used for unfolding bands
USE m_types_mpimat
IMPLICIT NONE
TYPE(t_results),INTENT(INOUT):: results
CLASS(t_xcpot),INTENT(IN) :: xcpot
......@@ -172,12 +171,6 @@ CONTAINS
l_wu=.FALSE.
ne_all=DIMENSION%neigd
if (allocated(zmat)) then
CALL zmat%free()
deallocate(zmat, stat=dealloc_stat, errmsg=errmsg)
if(dealloc_stat /= 0) call juDFT_error("deallocate failed for zmat",&
hint=errmsg, calledby="eigen.F90")
endif
!Try to symmetrize matrix
CALL symmetrize_matrix(mpi,noco,kpts,nk,hmat,smat)
......@@ -200,6 +193,7 @@ CONTAINS
END IF
CALL eigen_diag(mpi,hmat,smat,nk,jsp,iter,ne_all,eig,zMat)
CALL smat%free()
CALL hmat%free()
DEALLOCATE(hmat,smat, stat=dealloc_stat, errmsg=errmsg)
......@@ -216,11 +210,11 @@ CONTAINS
#else
ne_found=ne_all
#endif
IF (.NOT.zmat%l_real) THEN
IF (.NOT.zMat%l_real) THEN
zMat%data_c(:lapw%nmat,:ne_found) = CONJG(zMat%data_c(:lapw%nmat,:ne_found))
END IF
CALL write_eig(eig_id, nk,jsp,ne_found,ne_all,&
eig(:ne_found),n_start=mpi%n_size,n_end=mpi%n_rank,zmat=zMat)
eig(:ne_found),n_start=mpi%n_size,n_end=mpi%n_rank,zMat=zMat)
neigBuffer(nk,jsp) = ne_found
#if defined(CPP_MPI)
! RMA synchronization
......@@ -236,6 +230,8 @@ CONTAINS
hint=errmsg, calledby="eigen.F90")
END IF
call zMat%free()
deallocate(zMat)
END DO k_loop
END DO ! spin loop ends
......
......@@ -98,13 +98,6 @@ CONTAINS
CALL eigen_redist_matrix(mpi,lapw,atoms,smat,smat_final)
CALL eigen_redist_matrix(mpi,lapw,atoms,hmat,hmat_final,smat_final)
DO i=1,nspins
DO j=1,nspins
call smat(i,j)%free()
call hmat(i,j)%free()
ENDDO
ENDDO
END SUBROUTINE eigen_hssetup
END MODULE m_eigen_hssetup
......@@ -46,7 +46,7 @@ MODULE m_types_mpimat
PROCEDURE,PASS :: generate_full_matrix ! construct full matrix if only upper triangle of hermitian matrix is given
PROCEDURE,PASS :: print_matrix
PROCEDURE,PASS :: from_non_dist
FINAL :: finalize
FINAL :: finalize, finalize_1d, finalize_2d, finalize_3d
END TYPE t_mpimat
PUBLIC t_mpimat
......@@ -295,6 +295,44 @@ CONTAINS
CALL mpimat_free(mat)
END SUBROUTINE finalize
SUBROUTINE finalize_1d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:)
INTEGER :: i
DO i = 1,size(mat)
CALL mpimat_free(mat(i))
ENDDO
END SUBROUTINE finalize_1d
SUBROUTINE finalize_2d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:,:)
INTEGER :: i,j
DO i = 1,size(mat, dim=1)
DO j = 1,size(mat, dim=2)
CALL mpimat_free(mat(i,j))
ENDDO
ENDDO
END SUBROUTINE finalize_2d
SUBROUTINE finalize_3d(mat)
IMPLICIT NONE
TYPE(t_mpimat),INTENT(INOUT) :: mat(:,:,:)
INTEGER :: i,j,k
DO i = 1,size(mat, dim=1)
DO j = 1,size(mat, dim=2)
DO k = 1,size(mat, dim=3)
CALL mpimat_free(mat(i,j,k))
ENDDO
ENDDO
ENDDO
END SUBROUTINE finalize_3d
SUBROUTINE mpimat_free(mat)
IMPLICIT NONE
CLASS(t_mpimat),INTENT(INOUT) :: mat
......
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