forked from csc-training/advanced-mpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskeleton.F90
49 lines (37 loc) · 828 Bytes
/
skeleton.F90
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
42
43
44
45
46
47
48
49
program datatype1
use mpi_f08
implicit none
integer, dimension(8,8) :: array
integer :: rank, ierr
!TODO: declare variable for datatype
integer :: i, j
call mpi_init(ierr)
call mpi_comm_rank(MPI_COMM_WORLD, rank ,ierr)
! initialize arrays
if (rank == 0) then
do i=1,8
do j=1,8
array(i,j) = i*10 + j
end do
end do
else
array(:,:) = 0
end if
if (rank == 0) then
write(*,*) 'Data in rank 0'
do i=1,8
write(*,'(8I3)') array(i, :)
end do
end if
!TODO: create datatype
!TODO: communicate with datatype
!TODO: free datatype
! Print out the result
if (rank == 1) then
write(*,*) 'Received data'
do i=1,8
write(*,'(8I3)') array(i, :)
end do
end if
call mpi_finalize(ierr)
end program datatype1