Skip to content

Commit 100efb0

Browse files
committed
Update heat2d example for the ADIOS2 API changes (Put/Get)
1 parent e85020e commit 100efb0

File tree

6 files changed

+33
-26
lines changed

6 files changed

+33
-26
lines changed

Tutorial/heat2d/cpp/analysis/heatAnalysis.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <stdexcept>
2121
#include <string>
2222
#include <vector>
23+
#include <chrono>
24+
#include <thread>
2325

2426
#include "AnalysisSettings.h"
2527

@@ -163,7 +165,7 @@ int main(int argc, char *argv[])
163165

164166
// Arrays are read by scheduling one or more of them
165167
// and performing the reads at once
166-
reader.GetDeferred<double>(*vTin, Tin.data());
168+
reader.Get<double>(*vTin, Tin.data());
167169
/*printDataStep(Tin.data(), settings.readsize.data(),
168170
settings.offset.data(), rank, step); */
169171
reader.EndStep();
@@ -182,8 +184,8 @@ int main(int argc, char *argv[])
182184

183185
/* Output Tout and dT */
184186
writer->BeginStep();
185-
writer->PutDeferred<double>(*vTout, Tout.data());
186-
writer->PutDeferred<double>(*vdT, dT.data());
187+
writer->Put<double>(*vTout, Tout.data());
188+
writer->Put<double>(*vdT, dT.data());
187189
writer->EndStep();
188190

189191
step++;

Tutorial/heat2d/cpp/simulation/IO_adios2.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ void IO::write(int step, const HeatTransfer &ht, const Settings &s,
7070
MPI_Comm comm)
7171
{
7272
writer->BeginStep();
73-
// using PutDeferred() you promise the pointer to the data will be intact
73+
// using Put() you promise the pointer to the data will be intact
7474
// until the end of the output step.
7575
// We need to have the vector object here not to destruct here until the end
7676
// of function.
7777
std::vector<double> v = ht.data_noghost();
78-
writer->PutDeferred<double>(*varT, v.data());
78+
writer->Put<double>(*varT, v.data());
7979
writer->EndStep();
8080
}

Tutorial/heat2d/cpp/visualization/heatVisualization.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <stdexcept>
1515
#include <string>
1616
#include <vector>
17+
#include <chrono>
18+
#include <thread>
1719

1820
#include "VizOutput.h"
1921
#include "VizSettings.h"
@@ -115,7 +117,7 @@ int main(int argc, char *argv[])
115117
// Create a 2D selection for the subset
116118
vTin->SetSelection(
117119
adios2::Box<adios2::Dims>({0, 0}, vTin->m_Shape));
118-
reader.GetDeferred<double>(*vTin, Tin.data());
120+
reader.Get<double>(*vTin, Tin.data());
119121
reader.EndStep();
120122

121123
std::cout << "Visualization step " << step

Tutorial/heat2d/fortran/analysis/heatAnalysis_adios2_file.F90

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@ program reader
1515
integer :: ts=0 ! actual step in file that we read
1616

1717
! ADIOS related variables
18-
integer*8 :: adios2obj ! ADIOS2 object
19-
integer*8 :: io ! IO group handle
20-
integer*8 :: fh ! File handle
21-
integer*8 :: sel ! ADIOS selection object
22-
integer*8 :: var_T ! variable objects
18+
type (adios2_adios) :: adios2obj ! ADIOS2 object
19+
type (adios2_io) :: io ! IO group handle
20+
type (adios2_engine) :: fh ! File handle
21+
type (adios2_variable) :: var_T ! variable objects
2322
character(:), allocatable :: engine_type ! some infoe
2423
! Variable information
2524
integer :: ndim
@@ -85,7 +84,7 @@ program reader
8584
endif
8685
call adios2_set_step_selection(var_T, ts*1_8, 1_8, ierr)
8786
call adios2_set_selection(var_T, 2, offset, readsize, ierr)
88-
call adios2_get_deferred(fh, var_T, T, ierr)
87+
call adios2_get(fh, var_T, T, ierr)
8988
call adios2_close(fh, ierr)
9089
call print_array (T, offset, rank, ts)
9190

Tutorial/heat2d/fortran/analysis/heatAnalysis_adios2_stream.F90

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ program reader
1616
integer :: i,j
1717

1818
! ADIOS2 related variables
19-
integer*8 :: adios2obj ! ADIOS2 object
20-
integer*8 :: io ! IO group handle
21-
integer*8 :: fh ! File handle
22-
integer*8 :: sel ! ADIOS selection object
23-
integer*8 :: var_T ! variable objects
19+
type (adios2_adios) :: adios2obj ! ADIOS2 object
20+
type (adios2_io) :: io ! IO group handle
21+
type (adios2_engine) :: fh ! File handle
22+
type (adios2_variable) :: var_T ! variable objects
2423
character(:), allocatable :: engine_type ! some info
2524
! Variable information
2625
integer :: vartype, nsteps, ndim
@@ -100,7 +99,7 @@ program reader
10099
! Arrays are read by scheduling one or more of them
101100
! and performing the reads at once
102101
! In streaming mode, always step 0 is the one available for read
103-
call adios2_get_deferred(fh, "T", T, ierr)
102+
call adios2_get(fh, "T", T, ierr)
104103

105104
! Read all deferred and then release resources to this step
106105
call adios2_end_step(fh, ierr)

Tutorial/heat2d/fortran/simulation/io_adios2.F90

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88
! Author: William F Godoy
99
!
1010
module heat_io
11-
11+
use adios2
1212
implicit none
1313
! adios handlers
14-
integer*8 :: adios, io, bp_writer, var_gndx, var_gndy, var_T, var_dT
14+
type(adios2_adios) :: adios
15+
type(adios2_io) :: io
16+
type(adios2_engine) :: bp_writer
17+
type(adios2_variable) :: var_gndx, var_gndy, var_t, var_dT
1518

1619
contains
1720

@@ -74,14 +77,16 @@ subroutine io_write(tstep,curr)
7477
start_dims(2) = offy
7578
count_dims(2) = ndy
7679

77-
call adios2_define_variable (var_T, io, "T", 2, shape_dims, &
80+
call adios2_define_variable (var_T, io, "T", adios2_type_dp, &
81+
2, shape_dims, &
7882
start_dims, count_dims, &
7983
adios2_constant_dims, &
80-
T(1:ndx,1:ndy,curr), adios2_err )
84+
adios2_err )
8185

82-
call adios2_define_variable( var_dT, io, "dT", 2, shape_dims, &
86+
call adios2_define_variable( var_dT, io, "dT", adios2_type_dp, &
87+
2, shape_dims, &
8388
start_dims, count_dims, &
84-
adios2_constant_dims, dT, adios2_err )
89+
adios2_constant_dims, adios2_err )
8590
endif
8691

8792
call MPI_BARRIER(app_comm, adios2_err)
@@ -94,8 +99,8 @@ subroutine io_write(tstep,curr)
9499
! here the T(1:ndx,1:ndy,curr)
95100
allocate(T_temp(1:ndx,1:ndy))
96101
T_temp = T(1:ndx,1:ndy,curr)
97-
call adios2_put_deferred( bp_writer, var_T, T_temp, adios2_err )
98-
call adios2_put_deferred( bp_writer, var_dT, dT, adios2_err )
102+
call adios2_put( bp_writer, var_T, T_temp, adios2_err )
103+
call adios2_put( bp_writer, var_dT, dT, adios2_err )
99104

100105
call adios2_end_step( bp_writer, adios2_err)
101106

0 commit comments

Comments
 (0)