From 4eaa31263301116d8701d502f6ee7e024aea2e13 Mon Sep 17 00:00:00 2001 From: giannozz Date: Sat, 11 Jan 2014 09:14:24 +0000 Subject: [PATCH] Calls to mpi_comm_split replaced by interface mp_comm_split git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@10675 c92efa57-630b-4861-b058-cf58834340f0 --- Modules/io_files.f90 | 9 +++------ Modules/make.depend | 2 ++ Modules/mp_bands.f90 | 16 +++++----------- Modules/mp_diag.f90 | 10 ++++------ Modules/mp_images.f90 | 16 ++++++---------- Modules/mp_pools.f90 | 14 ++++---------- Modules/mp_pots.f90 | 14 ++++---------- 7 files changed, 28 insertions(+), 53 deletions(-) diff --git a/Modules/io_files.f90 b/Modules/io_files.f90 index 067f44986..2ed510a30 100644 --- a/Modules/io_files.f90 +++ b/Modules/io_files.f90 @@ -294,24 +294,21 @@ subroutine seqopn (unit, extension, formatt, exst, tmp_dir_) else tempfile = trim(tmp_dir) // trim(filename) end if - if ( trim(nd_nmbr) == '1' .or. trim(nd_nmbr) == '01'.or. & - trim(nd_nmbr) == '001' .or. trim(nd_nmbr) == '0001'.or. & - trim(nd_nmbr) == '00001' .or. trim(nd_nmbr) == '000001' ) then + if ( trim(nd_nmbr) /= '1' .and. trim(nd_nmbr) /= '01' .and. & + trim(nd_nmbr) /= '001' .and. trim(nd_nmbr) /= '0001' .and. & + trim(nd_nmbr) /= '00001' .and. trim(nd_nmbr) /= '000001' ) then ! ! do not add processor number to files opened by processor 1 ! in parallel execution: if only the first processor writes, ! we do not want the filename to be dependent on the number ! of processors ! - !tempfile = tempfile - else tempfile = trim(tempfile) // nd_nmbr end if inquire (file = tempfile, exist = exst) ! ! Open the file ! - open (unit = unit, file = tempfile, form = formatt, status = & 'unknown', iostat = ios) diff --git a/Modules/make.depend b/Modules/make.depend index d97ef82a5..c22bb7953 100644 --- a/Modules/make.depend +++ b/Modules/make.depend @@ -52,6 +52,7 @@ constraints_module.o : kind.o control_flags.o : kind.o control_flags.o : parameters.o dspev_drv.o : kind.o +dspev_drv.o : mp.o dspev_drv.o : mp_bands.o dspev_drv.o : mp_diag.o electrons_base.o : constants.o @@ -155,6 +156,7 @@ mp_diag.o : mp_pools.o mp_diag.o : mp_world.o mp_diag.o : parallel_include.o mp_global.o : command_line_options.o +mp_global.o : mp.o mp_global.o : mp_bands.o mp_global.o : mp_diag.o mp_global.o : mp_images.o diff --git a/Modules/mp_bands.f90 b/Modules/mp_bands.f90 index d03d27a1c..fdbaa0e8c 100644 --- a/Modules/mp_bands.f90 +++ b/Modules/mp_bands.f90 @@ -9,7 +9,7 @@ MODULE mp_bands !---------------------------------------------------------------------------- ! - USE mp, ONLY : mp_barrier, mp_bcast, mp_size, mp_rank + USE mp, ONLY : mp_barrier, mp_bcast, mp_size, mp_rank, mp_comm_split USE parallel_include ! IMPLICIT NONE @@ -51,7 +51,7 @@ CONTAINS INTEGER, INTENT(IN) :: nband_, parent_comm INTEGER, INTENT(IN), OPTIONAL :: ntg_ ! - INTEGER :: parent_nproc = 1, parent_mype = 0, ierr = 0 + INTEGER :: parent_nproc = 1, parent_mype = 0 ! #if defined (__MPI) ! @@ -84,19 +84,13 @@ CONTAINS ! ! ... the intra_bgrp_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, my_bgrp_id, parent_mype, intra_bgrp_comm, ierr ) - ! - IF ( ierr /= 0 ) CALL errore( 'mp_start_bands', & - 'intra band group communicator initialization', ABS(ierr) ) + CALL mp_comm_split( parent_comm, my_bgrp_id, parent_mype, intra_bgrp_comm ) ! CALL mp_barrier( parent_comm ) ! ! ... the inter_bgrp_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, me_bgrp, parent_mype, inter_bgrp_comm, ierr ) - ! - IF ( ierr /= 0 ) CALL errore( 'mp_start_bands', & - 'inter band group communicator initialization', ABS(ierr) ) + CALL mp_comm_split( parent_comm, me_bgrp, parent_mype, inter_bgrp_comm ) ! IF ( PRESENT(ntg_) ) THEN ntask_groups = ntg_ @@ -112,7 +106,7 @@ CONTAINS IMPLICIT NONE INTEGER, INTENT(IN) :: comm, nbnd - INTEGER :: npe, myrank, ierror, rest, k + INTEGER :: npe, myrank, rest, k myrank = mp_rank(comm) npe = mp_size(comm) diff --git a/Modules/mp_diag.f90 b/Modules/mp_diag.f90 index e9d899a07..dbde63261 100644 --- a/Modules/mp_diag.f90 +++ b/Modules/mp_diag.f90 @@ -9,7 +9,7 @@ MODULE mp_diag !---------------------------------------------------------------------------- ! - USE mp, ONLY : mp_size, mp_rank, mp_sum, mp_comm_free + USE mp, ONLY : mp_size, mp_rank, mp_sum, mp_comm_free, mp_comm_split ! ! The following variables are needed in order to set up the communicator ! for scalapack @@ -193,9 +193,7 @@ CONTAINS ! ! initialize the communicator for the new group by splitting the input communicator ! - CALL MPI_COMM_SPLIT( comm_all, color, key, ortho_comm, ierr ) - IF( ierr /= 0 ) & - CALL errore( " init_ortho_group ", " initializing ortho group communicator ", ierr ) + CALL mp_comm_split ( comm_all, color, key, ortho_comm ) ! ! Computes coordinates of the processors, in row maior order ! @@ -213,8 +211,8 @@ CONTAINS IF( me_ortho1*leg_ortho /= me_all ) & CALL errore( " init_ortho_group ", " wrong rank assignment in ortho group ", ierr ) - CALL MPI_COMM_SPLIT( ortho_comm, me_ortho(2), me_ortho(1), ortho_col_comm, ierr ) - CALL MPI_COMM_SPLIT( ortho_comm, me_ortho(1), me_ortho(2), ortho_row_comm, ierr ) + CALL mp_comm_split( ortho_comm, me_ortho(2), me_ortho(1), ortho_col_comm) + CALL mp_comm_split( ortho_comm, me_ortho(1), me_ortho(2), ortho_row_comm) else ortho_comm_id = 0 diff --git a/Modules/mp_images.f90 b/Modules/mp_images.f90 index a2b4468df..2248aac87 100644 --- a/Modules/mp_images.f90 +++ b/Modules/mp_images.f90 @@ -9,7 +9,7 @@ MODULE mp_images !---------------------------------------------------------------------------- ! - USE mp, ONLY : mp_barrier, mp_bcast, mp_size, mp_rank + USE mp, ONLY : mp_barrier, mp_bcast, mp_size, mp_rank, mp_comm_split USE io_global, ONLY : ionode, ionode_id USE parallel_include ! @@ -40,7 +40,7 @@ CONTAINS IMPLICIT NONE INTEGER, INTENT(IN) :: nimage_, parent_comm ! - INTEGER :: parent_nproc, parent_mype, ierr = 0 + INTEGER :: parent_nproc, parent_mype ! ! ... nothing needed to be done in serial calculation ! @@ -75,19 +75,15 @@ CONTAINS ! ! ... the intra_image_comm communicator is created ! - CALL MPI_COMM_SPLIT ( parent_comm, my_image_id, parent_mype, & - intra_image_comm, ierr ) - IF ( ierr /= 0 ) CALL errore & - ( 'mp_start_images', 'intra image communicator initialization', ABS(ierr) ) + CALL mp_comm_split ( parent_comm, my_image_id, parent_mype, & + intra_image_comm ) ! CALL mp_barrier( parent_comm ) ! ! ... the inter_image_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, me_image, parent_mype, & - inter_image_comm, ierr ) - IF ( ierr /= 0 ) CALL errore & - ( 'mp_start_images', 'inter image communicator initialization', ABS(ierr) ) + CALL mp_comm_split ( parent_comm, me_image, parent_mype, & + inter_image_comm ) ! ! ... set processor that performs I/O ! diff --git a/Modules/mp_pools.f90 b/Modules/mp_pools.f90 index 0700e29a2..00b10f570 100644 --- a/Modules/mp_pools.f90 +++ b/Modules/mp_pools.f90 @@ -9,7 +9,7 @@ MODULE mp_pools !---------------------------------------------------------------------------- ! - USE mp, ONLY : mp_barrier, mp_size, mp_rank + USE mp, ONLY : mp_barrier, mp_size, mp_rank, mp_comm_split USE parallel_include ! IMPLICIT NONE @@ -44,7 +44,7 @@ CONTAINS ! INTEGER, INTENT(IN) :: npool_, parent_comm ! - INTEGER :: parent_nproc = 1, parent_mype = 0, ierr = 0 + INTEGER :: parent_nproc = 1, parent_mype = 0 ! #if defined (__MPI) ! @@ -76,19 +76,13 @@ CONTAINS ! ! ... the intra_pool_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, my_pool_id, parent_mype, intra_pool_comm, ierr ) - ! - IF ( ierr /= 0 ) CALL errore( 'mp_start_pools', & - 'intra pool communicator initialization', ABS(ierr) ) + CALL mp_comm_split ( parent_comm, my_pool_id, parent_mype, intra_pool_comm ) ! CALL mp_barrier( parent_comm ) ! ! ... the inter_pool_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, me_pool, parent_mype, inter_pool_comm, ierr ) - ! - IF ( ierr /= 0 ) CALL errore( 'mp_start_pools', & - 'inter pool communicator initialization', ABS(ierr) ) + CALL mp_comm_split ( parent_comm, me_pool, parent_mype, inter_pool_comm ) ! #endif ! diff --git a/Modules/mp_pots.f90 b/Modules/mp_pots.f90 index 170cd3f32..ec2d366da 100644 --- a/Modules/mp_pots.f90 +++ b/Modules/mp_pots.f90 @@ -9,7 +9,7 @@ MODULE mp_pots !---------------------------------------------------------------------------- ! - USE mp, ONLY : mp_barrier, mp_size, mp_rank + USE mp, ONLY : mp_barrier, mp_size, mp_rank, mp_comm_split USE parallel_include ! IMPLICIT NONE @@ -41,7 +41,7 @@ CONTAINS ! INTEGER, INTENT(IN) :: npot_, parent_comm ! - INTEGER :: parent_nproc = 1, parent_mype = 0, ierr = 0 + INTEGER :: parent_nproc = 1, parent_mype = 0 ! #if defined (__MPI) ! @@ -74,19 +74,13 @@ CONTAINS ! ! ... the intra_pot_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, my_pot_id, parent_mype, intra_pot_comm, ierr ) - ! - IF ( ierr /= 0 ) CALL errore( 'mp_start_pots', & - 'intra pot communicator initialization', ABS(ierr) ) + CALL mp_comm_split( parent_comm, my_pot_id, parent_mype, intra_pot_comm ) ! CALL mp_barrier( parent_comm ) ! ! ... the inter_pot_comm communicator is created ! - CALL MPI_COMM_SPLIT( parent_comm, me_pot, parent_mype, inter_pot_comm, ierr ) - ! - IF ( ierr /= 0 ) & - CALL errore( 'mp_start_pots', 'inter pot communicator initialization', ABS(ierr) ) + CALL mp_comm_split( parent_comm, me_pot, parent_mype, inter_pot_comm ) ! #endif !