@@ -6,9 +6,9 @@ program write_slab_mpi_root
66use , intrinsic :: ieee_arithmetic, only : ieee_is_finite
77use , intrinsic :: iso_fortran_env, only : int64, real32, real64, stderr= >error_unit
88
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
1010
11- use h5fortran, only : mpi_h5comm, hdf5_file, mpi_tags
11+ use h5fortran, only : hdf5_file
1212
1313use cli, only : get_cli, get_simsize
1414use perf, only : print_timing, sysclock2ms
@@ -18,10 +18,9 @@ program write_slab_mpi_root
1818
1919external :: mpi_bcast, mpi_init, mpi_finalize, mpi_send, mpi_recv
2020
21- type (mpi_tags) :: mt
22-
2321type (hdf5_file) :: h5
2422
23+ integer , parameter :: ta3 = 100
2524real (real32), allocatable :: S3(:,:,:), ts3(:,:,:), V3(:), dv3(:)
2625
2726! > default parameters
@@ -44,8 +43,8 @@ program write_slab_mpi_root
4443call mpi_init(ierr)
4544if (ierr/= 0 ) error stop " mpi_init"
4645
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)
4948
5049do i = 1 , command_argument_count()
5150 call get_command_argument(i, argv, status= ierr)
@@ -77,15 +76,15 @@ program write_slab_mpi_root
7776 print ' (a,i0,a,i0,1x,i0,1x,i0)' , " MPI-root write. " , Nmpi, " total MPI processes. shape: " , lx1, lx2, lx3
7877endif
7978
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)
8382! 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)
8584if (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)
8786if (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)
8988if (ierr/= 0 ) error stop " failed to broadcast lx3"
9089if (lx2 < 1 .or. lx1 < 1 ) then
9190 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
107106tic = 0
108107if (mpi_id == mpi_root_id) call system_clock (count= tic)
109108
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)
111110
112111! > sanity check generated data on the worker
113112
@@ -145,12 +144,12 @@ program write_slab_mpi_root
145144 do i = 1 , Nmpi-1
146145 i0 = i* dx2 + 1
147146 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)
149148 if (ierr/= 0 ) error stop " worker => root: mpi_recv 3D"
150149 end do
151150 else
152151 ! ! 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)
154153 if (ierr/= 0 ) error stop " worker => root: mpi_send 3D"
155154 endif
156155
0 commit comments