only test mpif.h
This commit is contained in:
@ -1,6 +1,5 @@
|
|||||||
if(MPI_FOUND)
|
if(MPI_FOUND)
|
||||||
add_executable(example example.F90)
|
add_executable(example example.F90)
|
||||||
target_link_libraries(example ${MPI_LIBRARIES})
|
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "MPI not found")
|
message(FATAL_ERROR "MPI not found")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,33 +1,13 @@
|
|||||||
program example
|
program example
|
||||||
|
|
||||||
call init()
|
|
||||||
call test_use()
|
|
||||||
call finalize()
|
|
||||||
|
|
||||||
contains
|
|
||||||
|
|
||||||
subroutine init()
|
|
||||||
use mpi, only: MPI_Init
|
|
||||||
implicit none
|
|
||||||
integer :: ierr
|
|
||||||
call MPI_Init(ierr)
|
|
||||||
end subroutine
|
|
||||||
|
|
||||||
subroutine finalize()
|
|
||||||
use mpi, only: MPI_Finalize
|
|
||||||
implicit none
|
|
||||||
integer :: ierr
|
|
||||||
call MPI_Finalize(ierr)
|
|
||||||
end subroutine
|
|
||||||
|
|
||||||
subroutine test_use()
|
|
||||||
|
|
||||||
implicit none
|
implicit none
|
||||||
#include "mpif.h"
|
#include "mpif.h"
|
||||||
|
|
||||||
integer :: ierr, rank, num_ranks
|
integer :: ierr, rank, num_ranks
|
||||||
logical :: test_ok
|
logical :: test_ok
|
||||||
|
|
||||||
|
call MPI_Init(ierr)
|
||||||
|
|
||||||
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
|
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierr)
|
||||||
call MPI_COMM_SIZE(MPI_COMM_WORLD, num_ranks, ierr)
|
call MPI_COMM_SIZE(MPI_COMM_WORLD, num_ranks, ierr)
|
||||||
|
|
||||||
@ -39,6 +19,6 @@ contains
|
|||||||
stop "FAILED"
|
stop "FAILED"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
end subroutine
|
call MPI_Finalize(ierr)
|
||||||
|
|
||||||
end program
|
end program
|
||||||
|
Reference in New Issue
Block a user