Skip to content

Commit e49cc24

Browse files
committed
mpi-2 compatible
1 parent 5fbd0f8 commit e49cc24

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

cmake/mpi.cmake

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,4 @@ if(MPI_Fortran_HAVE_F08_MODULE)
4141
message(CHECK_PASS "yes")
4242
else()
4343
message(CHECK_FAIL "no")
44-
message(WARNING "MPI-3 Fortran module mpi_f08 not found, builds may fail.")
4544
endif()

test/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ set_property(TEST MPIhello PROPERTY FIXTURES_SETUP mpi_fxt)
3131

3232
# --- actual message passing
3333

34-
if(MPI_Fortran_VERSION VERSION_GREATER 3.0)
35-
3634
add_executable(mpi_pass thread_pass.f90)
3735
target_link_libraries(mpi_pass PRIVATE MPI::MPI_Fortran)
3836

@@ -45,9 +43,6 @@ DISABLED $<VERSION_LESS:${MPIEXEC_MAX_NUMPROCS},2>
4543
FIXTURES_REQUIRED mpi_fxt
4644
)
4745

48-
49-
endif()
50-
5146
# --- test properties
5247

5348
get_property(tests DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY TESTS)

test/thread_pass.f90

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ program mpi_pass
66

77
use, intrinsic :: iso_fortran_env, only: compiler_version, int64, stderr=>error_unit
88

9-
use mpi_f08
9+
use mpi
1010

1111
implicit none
1212

@@ -15,7 +15,8 @@ program mpi_pass
1515
integer :: dest, i, num_procs, id, tag
1616
integer(int64) :: tic, toc, rate
1717

18-
type(MPI_STATUS) :: status
18+
! type(MPI_STATUS) :: status
19+
integer :: status(MPI_STATUS_SIZE)
1920

2021
call system_clock(tic)
2122

@@ -43,11 +44,13 @@ program mpi_pass
4344
select case (id)
4445
case (0)
4546
print *, id, "waiting for MPI_send() from image 1"
46-
call MPI_Recv (val, size(val), MPI_REAL, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, status)
47+
call MPI_Recv (val, size(val), MPI_REAL, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, status, ierr)
48+
if (ierr /= MPI_SUCCESS) error stop "MPI_Recv failed"
4749

48-
print '(i0,a,i0,a,i0)', id, ' Got data from processor ', status%MPI_SOURCE, ' tag ',status%MPI_TAG
50+
! print '(i0,a,i0,a,i0)', id, ' Got data from processor ', status%MPI_SOURCE, ' tag ',status%MPI_TAG
4951

50-
call MPI_Get_count(status, MPI_REAL, mcount)
52+
call MPI_Get_count(status, MPI_REAL, mcount, ierr)
53+
if (ierr /= MPI_SUCCESS) error stop "MPI_Get_count failed"
5154

5255
print '(i0,a,i0,a)', id, ' Got ', mcount, ' elements.'
5356

@@ -61,7 +64,9 @@ program mpi_pass
6164

6265
dest = 0
6366
tag = 55
64-
call MPI_Send(dat, size(dat), MPI_REAL, dest, tag, MPI_COMM_WORLD)
67+
call MPI_Send(dat, size(dat), MPI_REAL, dest, tag, MPI_COMM_WORLD, ierr)
68+
if(ierr /= MPI_SUCCESS) error stop "MPI_Send failed"
69+
6570
case default
6671
print '(i0,a,i0)', id, ': MPI has no work for image', id
6772
end select

0 commit comments

Comments
 (0)