Commit 931b5dbc authored by Junchao Zhang's avatar Junchao Zhang
Browse files

Move MPI dataypes out of array initialization

So that the tests are also compilable with other MPI implementations such as OpenMPI,
where predefined MPI dataypes are not compile-time constants.

No reviewer
parent a9631042
...@@ -20,7 +20,7 @@ program get_elem_d ...@@ -20,7 +20,7 @@ program get_elem_d
TYPE(MPI_Status) :: status TYPE(MPI_Status) :: status
integer :: i,ii,count,ka,j,jj,k,kj integer :: i,ii,count,ka,j,jj,k,kj
integer :: blklen(nb)=(/2,2/) integer :: blklen(nb)=(/2,2/)
TYPE(MPI_Datatype) :: types(nb)=(/MPI_DOUBLE_PRECISION,MPI_INTEGER/) TYPE(MPI_Datatype) :: types(nb)
integer(kind=MPI_ADDRESS_KIND) :: disp(nb) integer(kind=MPI_ADDRESS_KIND) :: disp(nb)
integer :: ntlen,ians(20),ians0(0:3),ians1(24),ians2(20) integer :: ntlen,ians(20),ians0(0:3),ians1(24),ians2(20)
TYPE(MPI_Datatype) :: newtype TYPE(MPI_Datatype) :: newtype
...@@ -30,6 +30,8 @@ program get_elem_d ...@@ -30,6 +30,8 @@ program get_elem_d
call MPI_Init(ierror) call MPI_Init(ierror)
comm=MPI_COMM_WORLD comm=MPI_COMM_WORLD
types(1) = MPI_DOUBLE_PRECISION
types(2) = MPI_INTEGER
call MPI_Comm_size(comm, size, ierror) call MPI_Comm_size(comm, size, ierror)
dest=size-1 dest=size-1
call MPI_Comm_rank(comm, rank, ierror) call MPI_Comm_rank(comm, rank, ierror)
......
...@@ -18,7 +18,7 @@ PROGRAM get_elem_u ...@@ -18,7 +18,7 @@ PROGRAM get_elem_u
INTEGER, PARAMETER :: nb=2 INTEGER, PARAMETER :: nb=2
INTEGER :: blklen(nb)=(/1,1/) INTEGER :: blklen(nb)=(/1,1/)
TYPE(MPI_DATATYPE) :: types(nb)=(/MPI_DOUBLE_PRECISION,MPI_CHAR/) TYPE(MPI_DATATYPE) :: types(nb)
INTEGER(kind=MPI_ADDRESS_KIND) :: disp(nb)=(/0,8/) INTEGER(kind=MPI_ADDRESS_KIND) :: disp(nb)=(/0,8/)
INTEGER, PARAMETER :: amax=200 INTEGER, PARAMETER :: amax=200
...@@ -29,6 +29,8 @@ PROGRAM get_elem_u ...@@ -29,6 +29,8 @@ PROGRAM get_elem_u
errs = 0 errs = 0
CALL MPI_Init( ierr ) CALL MPI_Init( ierr )
COMM = MPI_COMM_WORLD COMM = MPI_COMM_WORLD
types(1) = MPI_DOUBLE_PRECISION
types(2) = MPI_CHAR
CALL MPI_Comm_rank(COMM,RANK,IERR) CALL MPI_Comm_rank(COMM,RANK,IERR)
CALL MPI_Comm_size(COMM,SIZE,IERR) CALL MPI_Comm_size(COMM,SIZE,IERR)
dest=size-1 dest=size-1
......
...@@ -19,7 +19,7 @@ program get_elem_d ...@@ -19,7 +19,7 @@ program get_elem_d
integer :: status(MPI_STATUS_SIZE) integer :: status(MPI_STATUS_SIZE)
integer :: i,ii,count,ka,j,jj,k,kj integer :: i,ii,count,ka,j,jj,k,kj
integer :: blklen(nb)=(/2,2/) integer :: blklen(nb)=(/2,2/)
integer :: types(nb)=(/MPI_DOUBLE_PRECISION,MPI_INTEGER/) integer :: types(nb)
integer(kind=MPI_ADDRESS_KIND) :: disp(nb) integer(kind=MPI_ADDRESS_KIND) :: disp(nb)
integer :: newtype,ntlen,ians(20),ians0(0:3),ians1(24),ians2(20) integer :: newtype,ntlen,ians(20),ians0(0:3),ians1(24),ians2(20)
double precision :: dbuff(dmax), a double precision :: dbuff(dmax), a
...@@ -28,6 +28,8 @@ program get_elem_d ...@@ -28,6 +28,8 @@ program get_elem_d
call MPI_Init(ierror) call MPI_Init(ierror)
comm=MPI_COMM_WORLD comm=MPI_COMM_WORLD
types(1) = MPI_DOUBLE_PRECISION
types(2) = MPI_INTEGER
call MPI_Comm_size(comm, size, ierror) call MPI_Comm_size(comm, size, ierror)
dest=size-1 dest=size-1
call MPI_Comm_rank(comm, rank, ierror) call MPI_Comm_rank(comm, rank, ierror)
......
...@@ -17,7 +17,7 @@ PROGRAM get_elem_u ...@@ -17,7 +17,7 @@ PROGRAM get_elem_u
INTEGER, PARAMETER :: nb=2 INTEGER, PARAMETER :: nb=2
INTEGER :: blklen(nb)=(/1,1/) INTEGER :: blklen(nb)=(/1,1/)
INTEGER :: types(nb)=(/MPI_DOUBLE_PRECISION,MPI_CHAR/) INTEGER :: types(nb)
INTEGER(kind=MPI_ADDRESS_KIND) :: disp(nb)=(/0,8/) INTEGER(kind=MPI_ADDRESS_KIND) :: disp(nb)=(/0,8/)
INTEGER, PARAMETER :: amax=200 INTEGER, PARAMETER :: amax=200
...@@ -27,6 +27,8 @@ PROGRAM get_elem_u ...@@ -27,6 +27,8 @@ PROGRAM get_elem_u
errs = 0 errs = 0
CALL MPI_Init( ierr ) CALL MPI_Init( ierr )
COMM = MPI_COMM_WORLD COMM = MPI_COMM_WORLD
types(1) = MPI_DOUBLE_PRECISION
types(2) = MPI_CHAR
CALL MPI_Comm_rank(COMM,RANK,IERR) CALL MPI_Comm_rank(COMM,RANK,IERR)
CALL MPI_Comm_size(COMM,SIZE,IERR) CALL MPI_Comm_size(COMM,SIZE,IERR)
dest=size-1 dest=size-1
......
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