Skip to content

Commit 86ddd1e

Browse files
committed
add debug mode to F90 simulation, update mixed demo readme
1 parent e1502ee commit 86ddd1e

File tree

3 files changed

+66
-34
lines changed

3 files changed

+66
-34
lines changed

Tutorial/heat2d/fortran/README.MixedDemo

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ $ mpirun -n 12 simulation/heatSimulation_adios2 heat 4 3 40 50 100 100 : \
1919
-n 1 ../python/heat_all.py --infile analysis.bp --outfile p.bp
2020

2121

22+
23+
The demo also works with SST for all IO. i
24+
Make sure to use BP marshalling for the simulation output.
25+
In adios2.xml, set the engines for
26+
SimulationOutput:
27+
<engine type="SST">
28+
<parameter key="MarshalMethod" value="BP" />
29+
</engine>
30+
AnalysisOutput: SST
31+
VizInput: SST
32+

Tutorial/heat2d/fortran/adios2.xml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@
1212

1313
<!-- example engines
1414
15-
<engine type="BPFile"/>
16-
<engine type="HDF5"/>
17-
<engine type="SST"/>
18-
<engine type="InSituMPI"/>
15+
<engine type="BPFile">
16+
<engine type="HDF5">
17+
<engine type="InSituMPI">
18+
19+
<engine type="SST">
20+
<parameter key="MarshalMethod" value="BP" />
21+
</engine>
1922
2023
DataMan is more elaborate with a transport and IP address required
2124
<io name="heat">
@@ -53,7 +56,7 @@
5356
=============================================-->
5457

5558
<io name="VizInput">
56-
<engine type="BPFile">
59+
<engine type="bpfile">
5760
</engine>
5861
</io>
5962

Tutorial/heat2d/fortran/simulation/heatSimulation.F90

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ program heat_transfer
102102

103103
! can we set up T to be a sin wave
104104
if (rank==0) print '("Simulation step ",i4,": initialization")', 0
105-
call init_T()
105+
call init_T(.false.)
106106

107107
curr = 1;
108108
call heatEdges(curr)
@@ -155,44 +155,62 @@ end subroutine heatEdges
155155

156156

157157
!!*********************
158-
subroutine init_T()
158+
subroutine init_T(debug)
159159
use heat_vars
160160
implicit none
161161
include 'mpif.h'
162+
logical, intent(in) :: debug
162163
integer :: i,j,k
163164
real*8 :: v, x,y,hx,hy
164165
real*8 :: minv, maxv, mingv, maxgv, skew, ratio
165166

166167

167-
hx = 2.0 * 4.0*atan(1.0d0)/gndx
168-
hy = 2.0 * 4.0*atan(1.0d0)/gndy
169-
170-
minv = 1.0e30
171-
maxv = -1.0e30
172-
173-
do j=0,ndy+1
174-
y = 0.0 + hy*(j - 1 + posy*ndy)
175-
do i=0,ndx+1
176-
x = 0.0 + hx*(i - 1 + posx*ndx)
177-
v = cos(8*x) + cos(6*x) - cos(4*x) + cos(2*x) - cos(x) + &
178-
sin(8*y) - sin(6*y) + sin(4*y) - sin(2*y) + sin(y)
179-
if (v < minv) minv = v
180-
if (v > maxv) maxv = v
181-
T(i,j,1) = v
168+
if (debug) then
169+
hx = 10.0
170+
do while (ndx / hx > 1.0)
171+
hx = hx * 10.0
182172
end do
183-
end do
184-
185-
call MPI_Allreduce(minv, mingv, 1, MPI_DOUBLE, MPI_MIN, app_comm, ierr)
186-
call MPI_Allreduce(maxv, maxgv, 1, MPI_DOUBLE, MPI_MAX, app_comm, ierr)
187-
188-
! normalize to [0..2*edgetemp]
189-
skew = 0.0 - mingv
190-
ratio = 2 * edgetemp / (maxgv-mingv)
191-
do j=0,ndy+1
192-
do i=0,ndx+1
193-
T(i,j,1) = (T(i,j,1) + skew) * ratio
173+
hy = 10.0
174+
do while (ndy / hy > 1.0)
175+
hy = hy * 10.0
194176
end do
195-
end do
177+
hx = hx * hy
178+
do j=0,ndy+1
179+
do i=0,ndx+1
180+
T(i,j,1) = rank + (j-1)/hy + (i-1)/hx
181+
end do
182+
end do
183+
else
184+
hx = 2.0 * 4.0*atan(1.0d0)/gndx
185+
hy = 2.0 * 4.0*atan(1.0d0)/gndy
186+
187+
minv = 1.0e30
188+
maxv = -1.0e30
189+
190+
do j=0,ndy+1
191+
y = 0.0 + hy*(j - 1 + posy*ndy)
192+
do i=0,ndx+1
193+
x = 0.0 + hx*(i - 1 + posx*ndx)
194+
v = cos(8*x) + cos(6*x) - cos(4*x) + cos(2*x) - cos(x) + &
195+
sin(8*y) - sin(6*y) + sin(4*y) - sin(2*y) + sin(y)
196+
if (v < minv) minv = v
197+
if (v > maxv) maxv = v
198+
T(i,j,1) = v
199+
end do
200+
end do
201+
202+
call MPI_Allreduce(minv, mingv, 1, MPI_DOUBLE, MPI_MIN, app_comm, ierr)
203+
call MPI_Allreduce(maxv, maxgv, 1, MPI_DOUBLE, MPI_MAX, app_comm, ierr)
204+
205+
! normalize to [0..2*edgetemp]
206+
skew = 0.0 - mingv
207+
ratio = 2 * edgetemp / (maxgv-mingv)
208+
do j=0,ndy+1
209+
do i=0,ndx+1
210+
T(i,j,1) = (T(i,j,1) + skew) * ratio
211+
end do
212+
end do
213+
endif
196214

197215
end subroutine init_T
198216

0 commit comments

Comments
 (0)