From 01b9d8b83e8ff6bd4b0bf7d7d79cf4834b9f9ea8 Mon Sep 17 00:00:00 2001 From: Daniel Wortmann Date: Thu, 29 Mar 2018 16:52:59 +0200 Subject: [PATCH] Added code to distribute forcetheo in MPI case --- forcetheorem/mae.F90 | 20 +++++++++++++++++++- main/fleur_init.F90 | 4 ++++ mpi/CMakeLists.txt | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/forcetheorem/mae.F90 b/forcetheorem/mae.F90 index 1d8caf3c..cc8ba8d4 100644 --- a/forcetheorem/mae.F90 +++ b/forcetheorem/mae.F90 @@ -17,7 +17,8 @@ MODULE m_types_mae PROCEDURE :: next_job=>mae_next_job PROCEDURE :: eval =>mae_eval PROCEDURE :: postprocess => mae_postprocess - PROCEDURE :: init => mae_init + PROCEDURE :: init => mae_init !not overloaded + PROCEDURE :: dist => mae_dist !not overloaded END TYPE t_forcetheo_mae CONTAINS @@ -99,4 +100,21 @@ CONTAINS END DO CALL closeXMLElement('Forcetheorem_MAE') END SUBROUTINE mae_postprocess + + SUBROUTINE mae_dist(this,mpi) + USE m_types_mpi + IMPLICIT NONE + CLASS(t_forcetheo_mae),INTENT(INOUT):: this + TYPE(t_mpi),INTENT(in):: mpi + + INTEGER:: i,ierr +#ifdef CPP_MPI + INCLUDE 'mpif.h' + IF (mpi%irank==0) i=SIZE(this%theta) + call MPI_BCAST(i,1,MPI_INTEGER,0,mpi%mpi_comm,ierr) + IF (mpi%irank.NE.0) ALLOCATE(this%phi(i),this%theta(i),this%evsum(i));this%evsum=0.0 + CALL MPI_BCAST(this%phi,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr) + CALL MPI_BCAST(this%theta,i,MPI_DOUBLE_PRECISION,0,mpi%mpi_comm,ierr) +#endif + END SUBROUTINE mae_dist END MODULE m_types_mae diff --git a/main/fleur_init.F90 b/main/fleur_init.F90 index 63adfdb7..f420aee3 100644 --- a/main/fleur_init.F90 +++ b/main/fleur_init.F90 @@ -36,6 +36,7 @@ USE m_writeOutHeader #ifdef CPP_MPI USE m_mpi_bc_all, ONLY : mpi_bc_all + USE m_mpi_dist_forcetheorem #endif #ifdef CPP_HDF USE m_hdf_tools @@ -341,6 +342,9 @@ #ifdef CPP_MPI CALL MPI_BCAST(namex,4,MPI_CHARACTER,0,mpi%mpi_comm,ierr) CALL MPI_BCAST(l_krla,1,MPI_LOGICAL,0,mpi%mpi_comm,ierr) + + CALL mpi_dist_forcetheorem(mpi,forcetheo) + #endif IF (mpi%irank.NE.0) THEN CALL xcpot%init(namex,l_krla) diff --git a/mpi/CMakeLists.txt b/mpi/CMakeLists.txt index 94d09af4..2291d99a 100644 --- a/mpi/CMakeLists.txt +++ b/mpi/CMakeLists.txt @@ -10,5 +10,6 @@ if (${FLEUR_USE_MPI}) mpi/mpi_bc_pot.F90 mpi/mpi_col_den.F90 mpi/mpi_make_groups.F90 + mpi/mpi_dist_forcetheorem.F90 ) endif() -- GitLab