-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloWorld.mpi3.F90
More file actions
41 lines (26 loc) · 1.12 KB
/
Copy pathhelloWorld.mpi3.F90
File metadata and controls
41 lines (26 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
program hello_world
use mpi_f08
use iso_fortran_env
implicit none
type(MPI_Comm) :: comm
integer :: myid, npes, ierror
integer :: name_length
character(len=MPI_MAX_PROCESSOR_NAME) :: processor_name
integer :: version, subversion, resultlen
character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: version_string
call mpi_get_version(version, subversion, ierror)
call mpi_get_library_version(version_string, resultlen, ierror)
call mpi_init(ierror)
comm = MPI_COMM_WORLD
call MPI_Comm_Rank(comm,myid,ierror)
call MPI_Comm_Size(comm,npes,ierror)
call MPI_Get_Processor_Name(processor_name,name_length,ierror)
if (myid == 0) then
write (output_unit,'("Compiler Version:",1X,A)') trim(compiler_version())
write (output_unit,'("MPI Version:",1X,I0,".",I0)') version, subversion
write (output_unit,'("MPI Library Version:",1X,A)') trim(version_string)
end if
call mpi_barrier(MPI_COMM_WORLD, ierror)
write (output_unit,'(A,1X,I0,1X,A,1X,I0,1X,A,1X,A)') "Process", myid, "of", npes, "is on", trim(processor_name)
call MPI_Finalize(ierror)
end program hello_world