TABLE OF CONTENTS
ABINIT/initmpi_world [ Functions ]
NAME
initmpi_world
FUNCTION
Initializes the mpi information for world.
COPYRIGHT
Copyright (C) 2002-2018 ABINIT group (FJ, MT) This file is distributed under the terms of the GNU General Public License, see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt . For the initials of contributors, see ~abinit/doc/developers/contributors.txt.
INPUTS
mpi_enreg=informations about MPI parallelization
OUTPUT
mpi_enreg=informations about MPI parallelization
SIDE EFFECTS
xmpi_world is redifined for the number of processors on which ABINIT is launched
PARENTS
finddistrproc
CHILDREN
abi_io_redirect,libpaw_write_comm_set
SOURCE
36 #if defined HAVE_CONFIG_H 37 #include "config.h" 38 #endif 39 40 #include "abi_common.h" 41 42 subroutine initmpi_world(mpi_enreg,nproc) 43 44 use defs_basis 45 use m_profiling_abi 46 use m_errors 47 48 use defs_abitypes, only : MPI_type 49 use m_xmpi, only : xmpi_world,xmpi_comm_rank,xmpi_comm_size,xmpi_subcomm 50 use m_libpaw_tools, only : libpaw_write_comm_set 51 52 !This section has been created automatically by the script Abilint (TD). 53 !Do not modify the following lines by hand. 54 #undef ABI_FUNC 55 #define ABI_FUNC 'initmpi_world' 56 !End of the abilint section 57 58 implicit none 59 60 !Arguments ------------------------------------ 61 integer, intent(in)::nproc 62 type(MPI_type),intent(inout) :: mpi_enreg 63 64 !Local variables------------------------------- 65 !scalars 66 integer :: ii 67 !arrays 68 integer,allocatable :: ranks(:) 69 70 ! *********************************************************************** 71 72 DBG_ENTER("COLL") 73 74 if(nproc==mpi_enreg%nproc) return 75 76 ABI_ALLOCATE(ranks,(0:nproc-1)) 77 ranks(0:nproc-1)=(/((ii),ii=0,nproc-1)/) 78 mpi_enreg%comm_world=xmpi_subcomm(xmpi_world,nproc,ranks) 79 ABI_DEALLOCATE(ranks) 80 81 if(mpi_enreg%me<nproc) then 82 mpi_enreg%me=xmpi_comm_rank(mpi_enreg%comm_world) 83 mpi_enreg%nproc=xmpi_comm_size(mpi_enreg%comm_world) 84 call abi_io_redirect(new_io_comm=mpi_enreg%comm_world) 85 call libpaw_write_comm_set(mpi_enreg%comm_world) 86 else 87 mpi_enreg%me=-1 88 end if 89 90 DBG_EXIT("COLL") 91 92 end subroutine initmpi_world