9
#include "adios_types.h"
15
int main (int argc, char ** argv)
18
int rank, size, i, j, step, block;
21
int NX = 2; // number of records written per step per process
23
int sub_blocks = 2; // number of record-blocks written per process in one step
27
MPI_Comm comm = MPI_COMM_WORLD;
29
/* ADIOS variables declarations for matching gwrite_temperature.ch */
31
uint64_t adios_groupsize, adios_totalsize;
34
MPI_Init (&argc, &argv);
35
MPI_Comm_rank (comm, &rank);
36
MPI_Comm_size (comm, &size);
38
//Global_bounds = sub_blocks * NX * size;
40
strcpy (filename, "steps.bp");
42
adios_init_noxml (comm);
43
adios_allocate_buffer (ADIOS_BUFFER_ALLOC_NOW, 1);
45
int64_t m_adios_group;
48
adios_declare_group (&m_adios_group, "steps", "", adios_flag_yes);
49
adios_select_method (m_adios_group, "MPI", "", "");
52
adios_define_var (m_adios_group, "NX" ,"", adios_integer ,0, 0, 0);
53
adios_define_var (m_adios_group, "Width" ,"", adios_integer ,0, 0, 0);
54
adios_define_var (m_adios_group, "nproc" ,"", adios_integer ,0, 0, 0);
56
for (i=0;i<sub_blocks;i++) {
58
adios_define_var (m_adios_group, "record" ,"", adios_byte ,"NX,Width", "", "");
62
for (step=0; step<steps; step++) {
64
adios_open (&m_adios_file, "steps", filename, "a", comm);
66
adios_groupsize = sub_blocks * (4 + 4 + 4 + (uint64_t) NX * (uint64_t)Width);
68
adios_group_size (m_adios_file, adios_groupsize, &adios_totalsize);
69
adios_write(m_adios_file, "nproc", (void *) &size);
70
adios_write(m_adios_file, "NX", (void *) &NX);
71
adios_write(m_adios_file, "Width", (void *) &Width);
72
/* now we will write the data for each sub block */
73
for (block=0;block<sub_blocks;block++) {
75
for (i = 0; i < NX; i++)
76
//print 19 chars here + '\0'
77
sprintf (t[i], "r%2d b%2d s%2d i%2d ", rank, block, step, i);
79
adios_write(m_adios_file, "record", t);
82
adios_close (m_adios_file);
87
adios_finalize (rank);