Commit 388e5e4b authored by giannozz's avatar giannozz

QE made ready to use MPI module instead of mpif.h include file. See the three

files Modules/parallel_include.f90, LAXlib/la_param.f90, FFTXlib/fft_param.f90
The latter two are now modules and are included as modules, no longer as files


git-svn-id: http://qeforge.qe-forge.org/svn/q-e/trunk/espresso@13183 c92efa57-630b-4861-b058-cf58834340f0
parent f10c9a6f
......@@ -12,8 +12,8 @@ SUBROUTINE fftx_error__( calling_routine, message, ierr )
!
! ... This is a simple routine which writes an error message to output:
!
USE fft_param
IMPLICIT NONE
#include "fft_param.f90"
!
CHARACTER(LEN=*), INTENT(IN) :: calling_routine, message
! the name of the calling calling_routine
......
......@@ -19,9 +19,9 @@
!
MODULE fft_parallel
!
USE fft_param
IMPLICIT NONE
SAVE
#include "fft_param.f90"
!
CONTAINS
!
......
......@@ -6,9 +6,16 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
MODULE fft_param
#if defined(__MPI)
include 'mpif.h'
#endif
#if defined(__MPI_MODULE)
USE mpi
#else
INCLUDE 'mpif.h'
#endif
#endif
INTEGER, PARAMETER :: nfftx = 2049
!! Number of different FFT tables that the module
!!could keep into memory without reinitialization
......@@ -17,6 +24,6 @@
!!Max allowed fft dimension
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
INTEGER, PARAMETER :: stdout = 6 ! unit connected to standard output
END MODULE fft_param
......@@ -20,6 +20,7 @@
!=----------------------------------------------------------------------=!
USE, intrinsic :: iso_c_binding
USE fft_param
IMPLICIT NONE
SAVE
......@@ -27,10 +28,6 @@
PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
! ... Local Parameter
#include "fft_param.f90"
!=----------------------------------------------------------------------=!
CONTAINS
!=----------------------------------------------------------------------=!
......
......@@ -23,6 +23,7 @@
USE, intrinsic :: iso_c_binding
USE MKL_DFTI ! -- this can be found in the MKL include directory
USE fft_param
IMPLICIT NONE
SAVE
......@@ -30,10 +31,6 @@
PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
! ... Local Parameter
#include "fft_param.f90"
TYPE dfti_descriptor_array
TYPE(DFTI_DESCRIPTOR), POINTER :: desc
END TYPE
......
......@@ -22,6 +22,7 @@
!=----------------------------------------------------------------------=!
USE, intrinsic :: iso_c_binding
USE fft_param
IMPLICIT NONE
SAVE
......@@ -31,7 +32,6 @@
! ... Local Parameter
#include "fft_param.f90"
! Workspace that is statically allocated is defined here
! in order to avoid multiple copies of the same workspace
......
......@@ -20,6 +20,7 @@
!=----------------------------------------------------------------------=!
USE, intrinsic :: iso_c_binding
USE fft_param
IMPLICIT NONE
SAVE
......@@ -27,10 +28,6 @@
PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
! ... Local Parameter
#include "fft_param.f90"
!=----------------------------------------------------------------------=!
CONTAINS
!=----------------------------------------------------------------------=!
......
......@@ -20,6 +20,7 @@
!=----------------------------------------------------------------------=!
USE, intrinsic :: iso_c_binding
USE fft_param
IMPLICIT NONE
SAVE
......@@ -29,8 +30,6 @@
! ... Local Parameter
#include "fft_param.f90"
#if defined(__OPENMP)
#include "fftw3.f03"
#else
......
......@@ -20,6 +20,7 @@
!=----------------------------------------------------------------------=!
USE, intrinsic :: iso_c_binding
USE fft_param
IMPLICIT NONE
SAVE
......@@ -27,10 +28,6 @@
PRIVATE
PUBLIC :: cft_1z, cft_2xy, cfft3d, cfft3ds
! ... Local Parameter
#include "fft_param.f90"
!=----------------------------------------------------------------------=!
CONTAINS
!=----------------------------------------------------------------------=!
......
!
! Copyright (C) Quantum ESPRESSO group
!
! This file is distributed under the terms of the
......@@ -144,10 +144,8 @@ end function allowed
! an fft order is not good if not implemented (as on IBM with ESSL)
! or implemented but with awful performances (most other cases)
!
USE fft_param
IMPLICIT NONE
#include "fft_param.f90"
INTEGER, INTENT(IN) :: nr
INTEGER, OPTIONAL, INTENT(IN) :: np
INTEGER :: new
......
......@@ -12,13 +12,12 @@ MODULE fft_types
!=----------------------------------------------------------------------------=!
USE fft_support, ONLY : good_fft_order, good_fft_dimension
USE fft_param
IMPLICIT NONE
PRIVATE
SAVE
#include "fft_param.f90"
TYPE fft_type_descriptor
INTEGER :: nst ! total number of sticks
......
fft_error.o : fft_param.o
fft_interfaces.o : fft_parallel.o
fft_interfaces.o : fft_scalar.o
fft_interfaces.o : fft_smallbox.o
fft_interfaces.o : fft_smallbox_type.o
fft_interfaces.o : fft_types.o
fft_interfaces.o : task_groups.o
fft_parallel.o : fft_param.o
fft_parallel.o : fft_scalar.o
fft_parallel.o : fft_types.o
fft_parallel.o : scatter_mod.o
fft_parallel.o : task_groups.o
fft_scalar.o :fft_param.o
fft_support.o : fft_param.o
fft_types.o : fft_param.o
fft_types.o : fft_support.o
fft_types.o : stick_base.o
scatter_mod.o : fft_param.o
scatter_mod.o : fft_types.o
scatter_mod.o : task_groups.o
stick_base.o : fft_param.o
task_groups.o : fft_param.o
task_groups.o : fft_types.o
test.o : fft_parallel.o
test.o : fft_param.o
test.o : fft_support.o
test.o : fft_types.o
test.o : stick_base.o
test.o : task_groups.o
test0.o : fft_interfaces.o
test0.o : fft_parallel.o
test0.o : fft_param.o
test0.o : fft_scalar.o
test0.o : fft_support.o
test0.o : fft_types.o
fft_scalar.o : fft_param.f90
fft_scalar.o : fft_param.f90
fft_scalar.o : fft_param.f90
fft_scalar.o : fft_param.f90
fft_scalar.o : fft_param.f90
fft_scalar.o : fft_param.f90
fft_scalar.o : ../include/fft_defs.h
fft_scalar.o :../include/fft_defs.h
fft_smallbox.o : ../include/fft_defs.h
fft_stick.o : ../include/c_defs.h
fft_stick.o : fftw.c
fft_support.o : ../include/fft_defs.h
fft_support.o : fft_param.f90
fft_types.o : fft_param.f90
fftw.o :
fftw.o :
......@@ -17,9 +17,9 @@
USE fft_types, ONLY: fft_type_descriptor
USE task_groups, ONLY: task_groups_descriptor
USE fft_param
IMPLICIT NONE
#include "fft_param.f90"
INTERFACE gather_grid
MODULE PROCEDURE gather_real_grid, gather_complex_grid
......
......@@ -2,12 +2,11 @@
MODULE stick_base
!=----------------------------------------------------------------------=
USE fft_param
IMPLICIT NONE
PRIVATE
SAVE
#include "fft_param.f90"
PUBLIC :: sticks_map_set
PUBLIC :: sticks_map_index, sticks_sort_new, sticks_dist_new
PUBLIC :: sticks_map, sticks_map_allocate
......
......@@ -69,13 +69,13 @@ SUBROUTINE task_groups_init( dffts, dtgs, nogrp )
!
USE fft_types, ONLY : fft_type_descriptor
USE fft_param
! T.G.
! NPGRP: Number of processors per group
! NOGRP: Number of processors per orbital task group
IMPLICIT NONE
#include "fft_param.f90"
TYPE(fft_type_descriptor), INTENT(inout) :: dffts
TYPE(task_groups_descriptor), INTENT(inout) :: dtgs
......@@ -187,9 +187,9 @@ END SUBROUTINE task_groups_init
SUBROUTINE task_groups_init_first( dffts, dtgs, nogrp )
!
USE fft_types, ONLY : fft_type_descriptor
USE fft_param
!
IMPLICIT NONE
#include "fft_param.f90"
!
TYPE(fft_type_descriptor), INTENT(inout) :: dffts
TYPE(task_groups_descriptor), INTENT(inout) :: dtgs
......
......@@ -650,10 +650,10 @@ end subroutine
! between the fft mesh points and the array of g vectors.
!
USE fft_types
USE fft_param
!
IMPLICIT NONE
!
#include "fft_param.f90"
REAL(DP), PARAMETER :: eps8 = 1.0E-8_DP
!
LOGICAL, INTENT(IN) :: gamma_only
......@@ -984,8 +984,8 @@ subroutine hpsort_eps (n, ra, ind, eps)
!
! adapted from Numerical Recipes pg. 329 (new edition)
!
USE fft_param
implicit none
#include "fft_param.f90"
!-input/output variables
integer, intent(in) :: n
integer, intent(inout) :: ind (*)
......@@ -1085,8 +1085,8 @@ end subroutine hpsort_eps
subroutine prepare_psi( ib, nbnd, ngms, psi, tg_psic, nls, nlsm, dtgs)
USE task_groups
USE fft_param
implicit none
#include "fft_param.f90"
integer, intent(in) :: ib, nbnd, ngms
TYPE(task_groups_descriptor), intent(in) :: dtgs
complex(DP) :: tg_psic( dtgs%tg_nnr * dtgs%nogrp )
......@@ -1123,8 +1123,8 @@ end subroutine prepare_psi
subroutine accumulate_hpsi( ib, nbnd, ngms, hpsi, tg_psic, nls, nlsm, dtgs, dffts)
USE task_groups
USE fft_types
USE fft_param
implicit none
#include "fft_param.f90"
integer, intent(in) :: ib, nbnd, ngms
integer, intent(in) :: nls(ngms), nlsm(ngms)
TYPE(task_groups_descriptor), intent(in) :: dtgs
......
......@@ -15,8 +15,8 @@ program test
USE fft_parallel
USE fft_scalar
USE fft_support
USE fft_param
IMPLICIT NONE
!include 'fft_param.f90'
TYPE(fft_type_descriptor) :: dfftp, dffts, dfft3d
INTEGER :: nx = 128
INTEGER :: ny = 128
......
......@@ -9,11 +9,10 @@
MODULE dspev_module
USE la_param
IMPLICIT NONE
#include "la_param.f90"
SAVE
PRIVATE
......
......@@ -12,8 +12,8 @@ SUBROUTINE lax_error__( calling_routine, message, ierr )
!
! ... This is a simple routine which writes an error message to output:
!
USE la_param
IMPLICIT NONE
#include "la_param.f90"
!
CHARACTER(LEN=*), INTENT(IN) :: calling_routine, message
! the name of the calling calling_routine
......
......@@ -6,15 +6,16 @@
! in the root directory of the present distribution,
! or http://www.gnu.org/copyleft/gpl.txt .
!
MODULE la_param
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
#if defined(__MPI)
#if defined(__MPI_MODULE)
USE mpi
#else
INCLUDE 'mpif.h'
#endif
#if defined __AIX
# define __BSIZ_VALUE 55
#else
# define __BSIZ_VALUE 35
#endif
INTEGER, PARAMETER :: DP = selected_real_kind(14,200)
END MODULE la_param
dspev_drv.o : la_param.o
dspev_drv.o : la_types.o
la_error.o : la_param.o
ptoolkit.o : dspev_drv.o
ptoolkit.o : la_param.o
ptoolkit.o : la_types.o
ptoolkit.o : zhpev_drv.o
test.o : dspev_drv.o
test.o : la_param.o
test.o : la_types.o
dspev_drv.o : la_param.f90
ptoolkit.o : la_param.f90
test.o : la_param.f90
transto.o : la_param.f90
zhpev_drv.o : la_param.f90
transto.o : la_param.o
zhpev_drv.o : la_param.o
......@@ -9,11 +9,10 @@
MODULE parallel_toolkit
!==----------------------------------------------==!
USE la_param
IMPLICIT NONE
SAVE
#include "la_param.f90"
PRIVATE
PUBLIC :: rep_matmul_drv
......@@ -1714,10 +1713,9 @@ SUBROUTINE sqr_mm_cannon( transa, transb, n, alpha, a, lda, b, ldb, beta, c, ldc
! Parallel square matrix multiplication with Cannon's algorithm
!
USE descriptors
USE la_param
!
IMPLICIT NONE
#include "la_param.f90"
!
CHARACTER(LEN=1), INTENT(IN) :: transa, transb
INTEGER, INTENT(IN) :: n
......@@ -2013,11 +2011,10 @@ SUBROUTINE sqr_zmm_cannon( transa, transb, n, alpha, a, lda, b, ldb, beta, c, ld
! Parallel square matrix multiplication with Cannon's algorithm
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
CHARACTER(LEN=1), INTENT(IN) :: transa, transb
INTEGER, INTENT(IN) :: n
COMPLEX(DP), INTENT(IN) :: alpha, beta
......@@ -2316,11 +2313,10 @@ SUBROUTINE sqr_tr_cannon( n, a, lda, b, ldb, desc )
! Parallel square matrix transposition with Cannon's algorithm
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: lda, ldb
REAL(DP) :: a(lda,*), b(ldb,*)
......@@ -2450,11 +2446,10 @@ SUBROUTINE redist_row2col( n, a, b, ldx, nx, desc )
! to obtain b, with the second dim. distributed over processor clolumn
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: ldx, nx
REAL(DP) :: a(ldx,nx), b(ldx,nx)
......@@ -2534,12 +2529,11 @@ SUBROUTINE cyc2blk_redist( n, a, lda, nca, b, ldb, ncb, desc )
! A (input) is cyclically distributed by rows across processors
! B (output) is distributed by block across 2D processors grid
!
USE descriptors
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: lda, nca, ldb, ncb
REAL(DP) :: a( lda, nca ), b( ldb, ncb )
......@@ -2695,11 +2689,10 @@ SUBROUTINE cyc2blk_zredist( n, a, lda, nca, b, ldb, ncb, desc )
! B (output) is distributed by block across 2D processors grid
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: lda, nca, ldb, ncb
COMPLEX(DP) :: a( lda, nca ), b( ldb, ncb )
......@@ -2849,11 +2842,10 @@ SUBROUTINE blk2cyc_redist( n, a, lda, nca, b, ldb, ncb, desc )
! B (input) is distributed by block across 2D processors grid
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: lda, nca, ldb, ncb
REAL(DP) :: a( lda, nca ), b( ldb, ncb )
......@@ -2974,11 +2966,10 @@ SUBROUTINE blk2cyc_zredist( n, a, lda, nca, b, ldb, ncb, desc )
! B (input) is distributed by block across 2D processors grid
!
USE descriptors
USE la_param
!
IMPLICIT NONE
!
#include "la_param.f90"
!
INTEGER, INTENT(IN) :: n
INTEGER, INTENT(IN) :: lda, nca, ldb, ncb
COMPLEX(DP) :: a( lda, nca ), b( ldb, ncb )
......@@ -3101,12 +3092,11 @@ END SUBROUTINE blk2cyc_zredist
SUBROUTINE qe_pzpotrf( sll, ldx, n, desc )
!
use descriptors
USE descriptors
USE la_param
!
implicit none
!
#include "la_param.f90"
!
integer :: n, ldx
TYPE(la_descriptor), INTENT(IN) :: desc
real(DP) :: one, zero
......@@ -3331,12 +3321,11 @@ END SUBROUTINE qe_pzpotrf
SUBROUTINE qe_pdpotrf( sll, ldx, n, desc )
!
use descriptors
USE descriptors
USE la_param
!
implicit none
!
#include "la_param.f90"
!
integer :: n, ldx
TYPE(la_descriptor), INTENT(IN) :: desc
REAL(DP) :: one, zero
......@@ -3587,10 +3576,9 @@ SUBROUTINE qe_pztrtri ( sll, ldx, n, desc )
!
USE descriptors
USE la_param
IMPLICIT NONE
#include "la_param.f90"
INTEGER, INTENT( IN ) :: n, ldx
TYPE(la_descriptor), INTENT(IN) :: desc
......@@ -3948,10 +3936,9 @@ SUBROUTINE qe_pdtrtri ( sll, ldx, n, desc )
!
USE descriptors
USE la_param
IMPLICIT NONE
#include "la_param.f90"
INTEGER, INTENT( IN ) :: n, ldx
TYPE(la_descriptor), INTENT(IN) :: desc
......@@ -4285,9 +4272,9 @@ END SUBROUTINE qe_pdtrtri
SUBROUTINE qe_pdsyevd( tv, n, desc, hh, ldh, e )
USE descriptors
USE la_param
USE dspev_module, ONLY : pdspev_drv
IMPLICIT NONE
#include "la_param.f90"
LOGICAL, INTENT(IN) :: tv
! if tv is true compute eigenvalues and eigenvectors (not used)
INTEGER, INTENT(IN) :: n, ldh
......@@ -4331,9 +4318,9 @@ END SUBROUTINE
SUBROUTINE qe_pzheevd( tv, n, desc, hh, ldh, e )
USE descriptors
USE la_param
USE zhpev_module, ONLY : pzhpev_drv
IMPLICIT NONE
#include "la_param.f90"
LOGICAL, INTENT(IN) :: tv
! if tv is true compute eigenvalues and eigenvectors (not used)
INTEGER, INTENT(IN) :: n, ldh
......@@ -4378,10 +4365,9 @@ SUBROUTINE sqr_dsetmat( what, n, alpha, a, lda, desc )
! Set the values of a square distributed matrix
!
USE descriptors
USE la_param
!
IMPLICIT NONE
#include "la_param.f90"
!
CHARACTER(LEN=1), INTENT(IN) :: what
! what = 'A' set all the values of "a" equal to alpha
......@@ -4461,10 +4447,9 @@ SUBROUTINE sqr_zsetmat( what, n, alpha, a, lda, desc )
! Set the values of a square distributed matrix
!
USE descriptors
USE la_param
!
IMPLICIT NONE
#include "la_param.f90"
!
CHARACTER(LEN=1), INTENT(IN) :: what
! what = 'A' set all the values of "a" equal to alpha
......
program lax_test
use descriptors
USE la_param
use dspev_module
IMPLICIT NONE
#include "la_param.f90"
#if defined(__MPI)
INTEGER STATUS(MPI_STATUS_SIZE)
#endif
......
......@@ -11,17 +11,20 @@
!
! written by Carlo Cavazzoni
!
#if defined __AIX
# define __BSIZ_VALUE 55
#else
# define __BSIZ_VALUE 35
#endif
SUBROUTINE mytranspose(x, ldx, y, ldy, n, m)
!
! x input matrix (n by m) to be trasposed
! y output matrix (m by n), the transpose of x
!
USE la_param
IMPLICIT NONE
#include "la_param.f90"
INTEGER :: ldx, ldy, n, m, what
REAL(DP) :: x(ldx, m), y(ldy, n)
INTEGER :: i, j, k, d, nb, mb, ib, jb, ioff, joff
......@@ -147,9 +150,9 @@
! y output matrix (m by n), the transpose of x
!
USE la_param
IMPLICIT NONE
#include "la_param.f90"
INTEGER :: ldx, ldy, n, m, what
COMPLEX(DP) :: x(ldx, m), y(ldy, n)
......
......@@ -7,11 +7,10 @@
!
MODULE zhpev_module
USE la_param
IMPLICIT NONE
SAVE
#include "la_param.f90"
PRIVATE
PUBLIC :: pzhpev_drv, zhpev_drv
......
......@@ -10,16 +10,20 @@
!------------------------------------------------------------------------------C
MODULE parallel_include
#if defined __MPI
!
! Include file for MPI
!
INCLUDE 'mpif.h'
#if defined (__MPI)
!
! Include file for MPI
!
#if defined (__MPI_MODULE)
USE mpi
#else
INCLUDE 'mpif.h'
#endif
#else
! dummy world and null communicator
INTEGER, PARAMETER :: MPI_COMM_WORLD = 0
INTEGER, PARAMETER :: MPI_COMM_NULL = -1
INTEGER, PARAMETER :: MPI_COMM_SELF = -2
! dummy world and null communicator
INTEGER, PARAMETER :: MPI_COMM_WORLD = 0
INTEGER, PARAMETER :: MPI_COMM_NULL = -1
INTEGER, PARAMETER :: MPI_COMM_SELF = -2
#endif
END MODULE parallel_include
......@@ -88,7 +88,7 @@ for dir in $dirs; do
$TOPDIR/includedep.sh $DEPENDS >> make.depend
# handle special cases: FFTs
sed 's/fft_scalar.*.o/fft_scalar.o/' make.depend > make.depend.tmp
sed 's/fft_scalar.*.o : /fft_scalar.o :/' make.depend > make.depend.tmp
# handle special cases: modules for C-fortran binding, hdf5
sed '/@iso_c_binding@/d;/@hdf5@/d' make.depend.tmp > make.depend
......@@ -96,13 +96,13 @@ for dir in $dirs; do
if test "$DIR" = "FFTXlib"
then
sed '/@mpi@/d;/@fft_scalar.*.f90@/d' make.depend > make.depend.tmp
sed '/@mkl_dfti/d;/@fftw3.f/d;s/@fftw.c@/fftw.c/;s/@fft_param.f90@/fft_param.f90/' make.depend.tmp > make.depend
sed '/@mkl_dfti/d;/@fftw3.f/d;s/@fftw.c@/fftw.c/' make.depend.tmp > make.depend
fi
if test "$DIR" = "LAXlib"
then
sed '/@mpi@/d;/@elpa1@/d' make.depend > make.depend.tmp
sed 's/@la_param.f90@/la_param.f90/' make.depend.tmp > make.depend
sed '/@mpi@/d' make.depend > make.depend.tmp
sed '/@elpa1@/d' make.depend.tmp > make.depend
fi
if test "$DIR" = "Modules"
......
Markdown is supported
0% or