-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelloWorld.mpi3.hybrid.F90
More file actions
36 lines (23 loc) · 883 Bytes
/
Copy pathhelloWorld.mpi3.hybrid.F90
File metadata and controls
36 lines (23 loc) · 883 Bytes
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
program hello_world
use mpi_f08
use omp_lib
implicit none
type(MPI_Comm) :: comm
integer :: myid, npes, ierror
integer :: name_length
integer :: num_threads, my_thread
character(len=MPI_MAX_PROCESSOR_NAME) :: processor_name
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)
!$omp parallel default(shared) private(num_threads, my_thread)
num_threads = omp_get_num_threads()
my_thread = omp_get_thread_num()
write (*,'(A,1X,I4,1X,A,1X,I4,1X,A,1X,I4,1X,A,1X,I4,1X,A,1X,A)') &
"Hello from thread", my_thread, "out of", num_threads, &
"on process", myid, "of", npes, "on processor", trim(processor_name)
!$omp end parallel
call MPI_Finalize(ierror)
end program hello_world