@@ -6,9 +6,9 @@ program write_slab_mpi_root
6
6
use , intrinsic :: ieee_arithmetic, only : ieee_is_finite
7
7
use , intrinsic :: iso_fortran_env, only : int64, real32, real64, stderr= >error_unit
8
8
9
- use mpi, only : mpi_comm_rank, mpi_comm_size, mpi_integer, mpi_real, mpi_status_ignore
9
+ use mpi, only : mpi_comm_rank, mpi_comm_size, mpi_integer, mpi_real, MPI_STATUS_IGNORE, MPI_COMM_WORLD
10
10
11
- use h5fortran, only : mpi_h5comm, hdf5_file, mpi_tags
11
+ use h5fortran, only : hdf5_file
12
12
13
13
use cli, only : get_cli, get_simsize
14
14
use perf, only : print_timing, sysclock2ms
@@ -18,10 +18,9 @@ program write_slab_mpi_root
18
18
19
19
external :: mpi_bcast, mpi_init, mpi_finalize, mpi_send, mpi_recv
20
20
21
- type (mpi_tags) :: mt
22
-
23
21
type (hdf5_file) :: h5
24
22
23
+ integer , parameter :: ta3 = 100
25
24
real (real32), allocatable :: S3(:,:,:), ts3(:,:,:), V3(:), dv3(:)
26
25
27
26
! > default parameters
@@ -44,8 +43,8 @@ program write_slab_mpi_root
44
43
call mpi_init(ierr)
45
44
if (ierr/= 0 ) error stop " mpi_init"
46
45
47
- call mpi_comm_size(mpi_h5comm , Nmpi, ierr)
48
- call mpi_comm_rank(mpi_h5comm , mpi_id, ierr)
46
+ call mpi_comm_size(MPI_COMM_WORLD , Nmpi, ierr)
47
+ call mpi_comm_rank(MPI_COMM_WORLD , mpi_id, ierr)
49
48
50
49
do i = 1 , command_argument_count()
51
50
call get_command_argument(i, argv, status= ierr)
@@ -77,15 +76,15 @@ program write_slab_mpi_root
77
76
print ' (a,i0,a,i0,1x,i0,1x,i0)' , " MPI-root write. " , Nmpi, " total MPI processes. shape: " , lx1, lx2, lx3
78
77
endif
79
78
80
- ! call mpi_ibcast(lx1, 1, MPI_INTEGER, mpi_root_id, mpi_h5comm , mpi_req, ierr)
81
- ! call mpi_ibcast(lx2, 1, MPI_INTEGER, mpi_root_id, mpi_h5comm , mpi_req, ierr)
82
- ! call mpi_ibcast(lx3, 1, MPI_INTEGER, mpi_root_id, mpi_h5comm , mpi_req, ierr)
79
+ ! call mpi_ibcast(lx1, 1, MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , mpi_req, ierr)
80
+ ! call mpi_ibcast(lx2, 1, MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , mpi_req, ierr)
81
+ ! call mpi_ibcast(lx3, 1, MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , mpi_req, ierr)
83
82
! call mpi_wait(mpi_req, MPI_STATUS_IGNORE, ierr)
84
- call mpi_bcast(lx1, 1 , MPI_INTEGER, mpi_root_id, mpi_h5comm , ierr)
83
+ call mpi_bcast(lx1, 1 , MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , ierr)
85
84
if (ierr/= 0 ) error stop " failed to broadcast lx1"
86
- call mpi_bcast(lx2, 1 , MPI_INTEGER, mpi_root_id, mpi_h5comm , ierr)
85
+ call mpi_bcast(lx2, 1 , MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , ierr)
87
86
if (ierr/= 0 ) error stop " failed to broadcast lx2"
88
- call mpi_bcast(lx3, 1 , MPI_INTEGER, mpi_root_id, mpi_h5comm , ierr)
87
+ call mpi_bcast(lx3, 1 , MPI_INTEGER, mpi_root_id, MPI_COMM_WORLD , ierr)
89
88
if (ierr/= 0 ) error stop " failed to broadcast lx3"
90
89
if (lx2 < 1 .or. lx1 < 1 ) then
91
90
write (stderr," (A,i0,A,i0,1x,i0,1x,i0)" ) " ERROR: MPI ID: " , mpi_id, " failed to receive lx1, lx2, lx3: " , lx1, lx2, lx3
@@ -107,7 +106,7 @@ program write_slab_mpi_root
107
106
tic = 0
108
107
if (mpi_id == mpi_root_id) call system_clock (count= tic)
109
108
110
- call generate_and_send(Nmpi, mpi_id, mpi_root_id, dx2, lx1, lx2, lx3, mt % a3, mpi_h5comm , noise, gensig, S3)
109
+ call generate_and_send(Nmpi, mpi_id, mpi_root_id, dx2, lx1, lx2, lx3, ta3 , noise, gensig, S3)
111
110
112
111
! > sanity check generated data on the worker
113
112
@@ -145,12 +144,12 @@ program write_slab_mpi_root
145
144
do i = 1 , Nmpi-1
146
145
i0 = i* dx2 + 1
147
146
i1 = (i + 1 )* dx2
148
- call mpi_recv(S3(:, i0:i1, :), lx1* dx2* lx3, MPI_REAL, i, mt % a3, mpi_h5comm , MPI_STATUS_IGNORE, ierr)
147
+ call mpi_recv(S3(:, i0:i1, :), lx1* dx2* lx3, MPI_REAL, i, ta3, MPI_COMM_WORLD , MPI_STATUS_IGNORE, ierr)
149
148
if (ierr/= 0 ) error stop " worker => root: mpi_recv 3D"
150
149
end do
151
150
else
152
151
! ! workers send data to root
153
- call mpi_send(S3, lx1* dx2* lx3, MPI_REAL, mpi_root_id, mt % a3, mpi_h5comm , ierr)
152
+ call mpi_send(S3, lx1* dx2* lx3, MPI_REAL, mpi_root_id, ta3, MPI_COMM_WORLD , ierr)
154
153
if (ierr/= 0 ) error stop " worker => root: mpi_send 3D"
155
154
endif
156
155
0 commit comments