2
* ADIOS is freely available under the terms of the BSD license described
3
* in the COPYING file in the top level directory of this source distribution.
5
* Copyright (c) 2008 - 2009. UT-BATTELLE, LLC. All rights reserved.
8
/* ADIOS test: declare multiple groups and free them.
9
* Test issue that was fixed in 084d601de8fca676361b0ac4b96735e04295fa0f
11
* How to run: group_free_test
13
* ADIOS config file: None
15
* This is a sequential test.
18
/* This example will create 3 adios groups for writing, then frees them.
25
#include "public/adios.h"
26
#include "public/adios_types.h"
28
const int NBLOCKS = 3;
29
const int NGROUPS = 3;
31
int main (int argc, char ** argv)
34
int NX = 100, gb, offset; //local/global/offset
35
MPI_Comm comm = MPI_COMM_WORLD;
36
char g_str[100], o_str[100], l_str[100];
39
MPI_Init (&argc, &argv);
40
MPI_Comm_rank (comm, &rank);
41
MPI_Comm_size (comm, &size);
43
gb = NBLOCKS * NX * size;
44
sprintf (g_str, "%d", gb);
45
sprintf (l_str, "%d", NX);
48
adios_init_noxml (comm);
49
adios_allocate_buffer (ADIOS_BUFFER_ALLOC_NOW, 10);
51
int64_t groupid[NGROUPS];
52
int64_t var_ids[NGROUPS][NBLOCKS];
54
for (j = 0; j < NGROUPS; j++)
56
sprintf (groupname, "group%1.1d", j);
57
adios_declare_group (&groupid[j], groupname, "", adios_flag_yes);
58
adios_select_method (groupid[j], "MPI", "", "");
60
for (i = 0; i < NBLOCKS; i++)
62
offset = rank * NBLOCKS * NX + i * NX;
63
sprintf (o_str, "%d", offset);
64
var_ids[j][i] = adios_define_var (groupid[j], "temperature"
68
adios_set_transform (var_ids[j][i], "identity");
74
// free groups in an illogical order 1, 0, 2 [3 4 ...]
75
if (NGROUPS > 1) adios_free_group (groupid[1]);
76
adios_free_group (groupid[0]);
77
for (j = 2; j < NGROUPS; j++)
79
adios_free_group (groupid[j]);
82
adios_finalize (rank);